CUTLASS 3.2.1 (#1113)
* Updates for 3.2.1 release. * Minor fix in gemm op profiler for raster order. * Add scheduler mapping for raster order in the kernels.
This commit is contained in:
@@ -30,97 +30,19 @@
|
||||
**************************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <cute/util/type_traits.hpp>
|
||||
|
||||
//#if defined(__CUDA_ARCH__)
|
||||
//# include <cuda/std/complex>
|
||||
//#else
|
||||
//# include <complex>
|
||||
//#endif
|
||||
|
||||
// Suppress warnings for code in Thrust headers.
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// We check for MSVC first, because MSVC also defines __GNUC__.
|
||||
// It's common for non-GCC compilers that emulate GCC's behavior
|
||||
// to define __GNUC__.
|
||||
//
|
||||
// thrust/complex.h triggers MSVC's warning on conversion
|
||||
// from double to float (or const float) ("possible loss of data").
|
||||
// MSVC treats this as an error by default (at least with
|
||||
// CUTLASS's default CMake configuration).
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4244 )
|
||||
#elif defined(__GNUC__)
|
||||
// With GCC + CUDA 11.4, builds show spurious "-Wconversion"
|
||||
// warnings on line 656 of thrust/detail/type_traits.h.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC_RTC__)
|
||||
#include <cuda/std/complex>
|
||||
#else
|
||||
#include <thrust/complex.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include <cute/config.hpp>
|
||||
#include <cute/util/type_traits.hpp>
|
||||
#include <cutlass/complex.h>
|
||||
|
||||
namespace cute
|
||||
{
|
||||
|
||||
//#if defined(__CUDA_ARCH__)
|
||||
//template <class T>
|
||||
//using complex = cuda::std::complex<T>;
|
||||
//#else
|
||||
//template <class T>
|
||||
//using complex = std::complex<T>;
|
||||
//#endif
|
||||
|
||||
//template <class T>
|
||||
//using complex = thrust::complex<T>;
|
||||
|
||||
#if defined(__CUDACC_RTC__)
|
||||
using cuda::std::complex;
|
||||
#else
|
||||
using thrust::complex;
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
CUTE_HOST_DEVICE
|
||||
T real(complex<T> const& z) {
|
||||
return z.real();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CUTE_HOST_DEVICE
|
||||
T imag(complex<T> const& z) {
|
||||
return z.imag();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
CUTE_HOST_DEVICE
|
||||
complex<T> conj(complex<T> const& z) {
|
||||
return complex<T>(real(z), -imag(z));
|
||||
}
|
||||
|
||||
// cute::conj forwards scalars
|
||||
template <class T>
|
||||
CUTE_HOST_DEVICE
|
||||
T conj(T z) {
|
||||
return z;
|
||||
}
|
||||
|
||||
//CUTE_HOST_DEVICE constexpr
|
||||
//float conj(float z) { return z; }
|
||||
//CUTE_HOST_DEVICE constexpr
|
||||
//double conj(double z) { return z; }
|
||||
using cutlass::complex;
|
||||
using cutlass::is_complex;
|
||||
using cutlass::RealType;
|
||||
using cutlass::real;
|
||||
using cutlass::imag;
|
||||
using cutlass::conj;
|
||||
|
||||
/// Fused multiply-add for complex numbers
|
||||
template <class T>
|
||||
@@ -131,10 +53,10 @@ fma(complex<T> & d,
|
||||
complex<T> const& b,
|
||||
complex<T> const& c)
|
||||
{
|
||||
d.real(c.real() + a.real() * b.real());
|
||||
d.imag(c.imag() + a.real() * b.imag());
|
||||
d.real(d.real() - a.imag() * b.imag());
|
||||
d.imag(d.imag() + a.imag() * b.real());
|
||||
d.real(fma( a.real(), b.real(), c.real()));
|
||||
d.imag(fma( a.real(), b.imag(), c.imag()));
|
||||
d.real(fma(-a.imag(), b.imag(), d.real()));
|
||||
d.imag(fma( a.imag(), b.real(), d.imag()));
|
||||
}
|
||||
|
||||
/// Fused multiply-add for triplets
|
||||
@@ -148,46 +70,4 @@ fma(complex<T> const& a,
|
||||
return fma(c, a, b, c);
|
||||
}
|
||||
|
||||
/// Used to determine the real-valued underlying type of a numeric type T
|
||||
template <class T>
|
||||
struct RealType {
|
||||
using Type = T;
|
||||
};
|
||||
|
||||
/// Partial specialization for complex-valued type
|
||||
template <class T>
|
||||
struct RealType<complex<T>> {
|
||||
using Type = T;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T>
|
||||
struct is_complex {
|
||||
static bool const value = false;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_complex<complex<T>> {
|
||||
static bool const value = true;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display utilities
|
||||
|
||||
#if !defined(__CUDACC_RTC__)
|
||||
template <class T>
|
||||
CUTE_HOST std::ostream& operator<<(std::ostream& os, complex<T> const& z)
|
||||
{
|
||||
T _r = z.real();
|
||||
T _i = z.imag();
|
||||
|
||||
if (bool(_i)) {
|
||||
return os << _r << "+i" << _i;
|
||||
} else {
|
||||
return os << _r;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace cute
|
||||
|
||||
Reference in New Issue
Block a user