CUTLASS 3.3.0 (#1167)
* Release 3.3.0 Adds support for mixed precision GEMMs On Hopper and Ampere Adds support for < 16B aligned GEMMs on Hopper Enhancements to EVT Enhancements to Python interface Enhancements to Sub-byte type handling in CuTe Several other bug-fixes and performance improvements. * minor doc update
This commit is contained in:
@@ -40,12 +40,16 @@ namespace cute
|
||||
{
|
||||
|
||||
/** Compile-time rational arithmetic type.
|
||||
* Like cute::C for std::integral_constant, cute::R for std::ratio has a short name
|
||||
* Like cute::C for std::integral_constant, cute::R for std::ratio has a short name
|
||||
* for error messages and compile times.
|
||||
* The static data members @a num and @a den represent the reduced numerator and denominator
|
||||
* of the rational value. Thus, two cute::R types with different @a n or @a d are distinct types
|
||||
* even if they represent the same rational value. A cute::R exposes the reduced canonical type
|
||||
* via its type member. That is, cute::R<3,6>::type is cute::R<1,2> and cute::R<6,3>::type is cute::C<2>
|
||||
* of the rational value. Thus, two cute::R types with different @a n or @a d are distinct types
|
||||
* even if they represent the same rational value.
|
||||
* A cute::R exposes the reduced canonical type via its ::type member.
|
||||
* That is, cute::R<3,6>::type is cute::R<1,2> and cute::R<6,3>::type is cute::C<2>.
|
||||
* A cute::R<n,d>::value can be used much like any other trait::value. It can be involved in
|
||||
* arithmetic expressions (according to the operator-overloads for cute::C and cute::R,
|
||||
* though these may be incomplete) but with a potential rational value rather than an integral value.
|
||||
*/
|
||||
template <auto n, auto d>
|
||||
class R {
|
||||
@@ -53,7 +57,7 @@ class R {
|
||||
static constexpr auto an = abs(n);
|
||||
static constexpr auto ad = abs(d);
|
||||
static constexpr auto g = gcd(an, ad);
|
||||
|
||||
|
||||
public:
|
||||
static constexpr auto num = signum(n) * signum(d) * an / g;
|
||||
static constexpr auto den = ad / g;
|
||||
@@ -63,28 +67,28 @@ class R {
|
||||
|
||||
template <auto a, auto b>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a,b>::type
|
||||
typename R<a,b>::type
|
||||
ratio(C<a>, C<b>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto a, auto b, auto x, auto y>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a*x,b*y>::type
|
||||
typename R<a*x,b*y>::type
|
||||
operator*(R<a,b>, R<x,y>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto a, auto b, auto c>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a*c,b>::type
|
||||
typename R<a*c,b>::type
|
||||
operator*(R<a,b>, C<c>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto c, auto a, auto b>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a*c,b>::type
|
||||
typename R<a*c,b>::type
|
||||
operator*(C<c>, R<a,b>) {
|
||||
return {};
|
||||
}
|
||||
@@ -109,28 +113,28 @@ operator*(R<a,b>, C const& c) {
|
||||
|
||||
template <auto a, auto b, auto x, auto y>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a*y+b*x, b*y>::type
|
||||
typename R<a*y+b*x, b*y>::type
|
||||
operator+(R<a,b>, R<x,y>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto a, auto b, auto c>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a+c*b,b>::type
|
||||
typename R<a+c*b,b>::type
|
||||
operator+(R<a,b>, C<c>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto c, auto a, auto b>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<a+c*b,b>::type
|
||||
typename R<a+c*b,b>::type
|
||||
operator+(C<c>, R<a,b>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto a, auto b, auto x, auto y>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
bool_constant<R<a,b>::num == R<x,y>::num && R<a,b>::den == R<x,y>::den>
|
||||
bool_constant<R<a,b>::num == R<x,y>::num && R<a,b>::den == R<x,y>::den>
|
||||
operator==(R<a,b>, R<x,y>) {
|
||||
return {};
|
||||
}
|
||||
@@ -144,14 +148,14 @@ operator==(R<a,b>, C<c>) {
|
||||
|
||||
template <auto c, auto a, auto b>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
bool_constant<R<a,b>::num == c && R<a,b>::den == 1>
|
||||
bool_constant<R<a,b>::num == c && R<a,b>::den == 1>
|
||||
operator==(C<c>, R<a,b>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <auto a, auto b>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
typename R<abs(a),abs(b)>::type
|
||||
typename R<abs(a),abs(b)>::type
|
||||
abs(R<a,b>) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user