@@ -50,11 +50,11 @@ namespace arch {
|
||||
// Enumerates the reserved named barriers to avoid potential conflicts
|
||||
// This enum class specifies the NamedBarriers reserved by CUTLASS.
|
||||
enum class ReservedNamedBarriers {
|
||||
EpilogueBarrier = 0,
|
||||
TransposeBarrier = 1,
|
||||
TransformBarrier = 2,
|
||||
StreamkBarrier0 = 3,
|
||||
StreamkBarrier1 = 4
|
||||
EpilogueBarrier = 1,
|
||||
TransposeBarrier = 2,
|
||||
TransformBarrier = 3,
|
||||
StreamkBarrier0 = 4,
|
||||
StreamkBarrier1 = 5
|
||||
, FirstUserBarrier = StreamkBarrier1 + 1
|
||||
};
|
||||
|
||||
@@ -204,12 +204,12 @@ public:
|
||||
}
|
||||
|
||||
CUTLASS_DEVICE
|
||||
uint32_t test_wait(uint32_t phase, uint32_t pred=true) const {
|
||||
bool test_wait(uint32_t phase, uint32_t pred=true) const {
|
||||
return ClusterBarrier::test_wait(&this->barrier_, phase, pred);
|
||||
}
|
||||
|
||||
CUTLASS_DEVICE
|
||||
uint32_t try_wait(uint32_t phase) const {
|
||||
bool try_wait(uint32_t phase) const {
|
||||
return ClusterBarrier::try_wait(&this->barrier_, phase);
|
||||
}
|
||||
|
||||
@@ -260,8 +260,8 @@ public:
|
||||
".reg .pred P1; \n\t"
|
||||
"LAB_WAIT: \n\t"
|
||||
"mbarrier.try_wait.parity.shared::cta.b64 P1, [%0], %1, %2; \n\t"
|
||||
"@P1 bra.uni DONE; \n\t"
|
||||
"bra.uni LAB_WAIT; \n\t"
|
||||
"@P1 bra DONE; \n\t"
|
||||
"bra LAB_WAIT; \n\t"
|
||||
"DONE: \n\t"
|
||||
"}"
|
||||
:
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
}
|
||||
|
||||
CUTLASS_DEVICE
|
||||
static uint32_t test_wait(ValueType const* smem_ptr, uint32_t phase, uint32_t pred) {
|
||||
static bool test_wait(ValueType const* smem_ptr, uint32_t phase, uint32_t pred) {
|
||||
#if CUDA_BARRIER_ENABLED
|
||||
uint32_t smem_addr = cute::cast_smem_ptr_to_uint(smem_ptr);
|
||||
uint32_t waitComplete;
|
||||
@@ -289,7 +289,7 @@ public:
|
||||
: "=r"(waitComplete)
|
||||
: "r"(smem_addr), "r"(phase), "r"(pred));
|
||||
|
||||
return waitComplete;
|
||||
return static_cast<bool>(waitComplete);
|
||||
#elif defined(__CUDA_ARCH__)
|
||||
asm volatile ("brkpt;\n" ::);
|
||||
#endif
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
}
|
||||
|
||||
CUTLASS_DEVICE
|
||||
static uint32_t try_wait(ValueType const* smem_ptr, uint32_t phase) {
|
||||
static bool try_wait(ValueType const* smem_ptr, uint32_t phase) {
|
||||
#if CUDA_BARRIER_ENABLED
|
||||
uint32_t smem_addr = cute::cast_smem_ptr_to_uint(smem_ptr);
|
||||
uint32_t waitComplete;
|
||||
@@ -311,7 +311,7 @@ public:
|
||||
: "=r"(waitComplete)
|
||||
: "r"(smem_addr), "r"(phase));
|
||||
|
||||
return waitComplete;
|
||||
return static_cast<bool>(waitComplete);
|
||||
#elif defined(__CUDA_ARCH__)
|
||||
asm volatile ("brkpt;\n" ::);
|
||||
#endif
|
||||
@@ -323,16 +323,17 @@ public:
|
||||
static void arrive(ValueType const* smem_ptr, uint32_t cta_id, uint32_t pred) {
|
||||
#if CUDA_BARRIER_ENABLED
|
||||
uint32_t smem_addr = cute::cast_smem_ptr_to_uint(smem_ptr);
|
||||
asm volatile(
|
||||
"{\n\t"
|
||||
".reg .pred p;\n\t"
|
||||
".reg .b32 remAddr32;\n\t"
|
||||
"setp.eq.u32 p, %2, 1;\n\t"
|
||||
"@p mapa.shared::cluster.u32 remAddr32, %0, %1;\n\t"
|
||||
"@p mbarrier.arrive.shared::cluster.b64 _, [remAddr32];\n\t"
|
||||
"}"
|
||||
:
|
||||
: "r"(smem_addr), "r"(cta_id), "r"(pred));
|
||||
if (pred) {
|
||||
asm volatile(
|
||||
"{\n\t"
|
||||
".reg .b32 remAddr32;\n\t"
|
||||
"mapa.shared::cluster.u32 remAddr32, %0, %1;\n\t"
|
||||
"mbarrier.arrive.shared::cluster.b64 _, [remAddr32];\n\t"
|
||||
"}"
|
||||
:
|
||||
: "r"(smem_addr), "r"(cta_id));
|
||||
}
|
||||
|
||||
#elif defined(__CUDA_ARCH__)
|
||||
asm volatile ("brkpt;\n" ::);
|
||||
#endif
|
||||
|
||||
@@ -201,252 +201,6 @@ struct Mma<
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Integer matrix multiply .8816 (8b)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S8 * S8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 16>,
|
||||
32,
|
||||
int8_t,
|
||||
layout::RowMajor,
|
||||
int8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 16>;
|
||||
|
||||
using ElementA = int8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int8_t, 4>;
|
||||
|
||||
using ElementB = int8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k16.row.col.s32.s8.s8.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U8 * S8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 16>,
|
||||
32,
|
||||
uint8_t,
|
||||
layout::RowMajor,
|
||||
int8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 16>;
|
||||
|
||||
using ElementA = uint8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint8_t, 4>;
|
||||
|
||||
using ElementB = int8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k16.row.col.s32.u8.s8.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S8 * U8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 16>,
|
||||
32,
|
||||
int8_t,
|
||||
layout::RowMajor,
|
||||
uint8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 16>;
|
||||
|
||||
using ElementA = int8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int8_t, 4>;
|
||||
|
||||
using ElementB = uint8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k16.row.col.s8.u8 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U8 * U8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 16>,
|
||||
32,
|
||||
uint8_t,
|
||||
layout::RowMajor,
|
||||
uint8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 16>;
|
||||
|
||||
using ElementA = uint8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint8_t, 4>;
|
||||
|
||||
using ElementB = uint8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k16.row.col.s32.u8.u8.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Integer matrix multiply (8b) with SATURATE
|
||||
@@ -693,252 +447,6 @@ struct Mma<
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Integer matrix multiply (4b)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S4 * S4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 32>,
|
||||
32,
|
||||
int4b_t,
|
||||
layout::RowMajor,
|
||||
int4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 32>;
|
||||
|
||||
using ElementA = int4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int4b_t, 8>;
|
||||
|
||||
using ElementB = int4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int4b_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k32.row.col.s32.s4.s4.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U4 * S4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 32>,
|
||||
32,
|
||||
uint4b_t,
|
||||
layout::RowMajor,
|
||||
int4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 32>;
|
||||
|
||||
using ElementA = uint4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint4b_t, 8>;
|
||||
|
||||
using ElementB = int4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int4b_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k32.row.col.s32.u4.s4.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S4 * U4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 32>,
|
||||
32,
|
||||
int4b_t,
|
||||
layout::RowMajor,
|
||||
uint4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 32>;
|
||||
|
||||
using ElementA = int4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int4b_t, 8>;
|
||||
|
||||
using ElementB = uint4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint4b_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k32.row.col.s32.s4.u4.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U4 * U4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<8, 8, 32>,
|
||||
32,
|
||||
uint4b_t,
|
||||
layout::RowMajor,
|
||||
uint4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<8, 8, 32>;
|
||||
|
||||
using ElementA = uint4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint4b_t, 8>;
|
||||
|
||||
using ElementB = uint4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint4b_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 2>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm75;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM75_ENABLED)
|
||||
|
||||
unsigned const & A = reinterpret_cast<unsigned const &>(a);
|
||||
unsigned const & B = reinterpret_cast<unsigned const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile("mma.sync.aligned.m8n8k32.row.col.s32.u4.u4.s32 {%0,%1}, {%2}, {%3}, {%4,%5};\n"
|
||||
: "=r"(D[0]), "=r"(D[1])
|
||||
: "r"(A), "r"(B), "r"(C[0]), "r"(C[1]));
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
CUTLASS_NOT_IMPLEMENTED();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Integer matrix multiply (4b) - SATURATE
|
||||
|
||||
@@ -535,256 +535,6 @@ struct Mma<
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix Multiply 16816 - S8 input, S32 accumulation
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S8 * S8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,16>,
|
||||
32,
|
||||
int8_t,
|
||||
layout::RowMajor,
|
||||
int8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,16>;
|
||||
|
||||
using ElementA = int8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int8_t, 8>;
|
||||
|
||||
using ElementB = int8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const &B = reinterpret_cast<uint32_t const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k16.row.col.s32.s8.s8.s32 {%0,%1,%2,%3}, {%4,%5}, {%6}, "
|
||||
"{%7,%8,%9,%10};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(B), "r"(C[0]), "r"(C[1]), "r"(C[2]),
|
||||
"r"(C[3]));
|
||||
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U8 * S8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,16>,
|
||||
32,
|
||||
uint8_t,
|
||||
layout::RowMajor,
|
||||
int8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,16>;
|
||||
|
||||
using ElementA = uint8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint8_t, 8>;
|
||||
|
||||
using ElementB = int8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const &B = reinterpret_cast<uint32_t const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k16.row.col.s32.u8.s8.s32 {%0,%1,%2,%3}, {%4,%5}, {%6}, "
|
||||
"{%7,%8,%9,%10};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(B), "r"(C[0]), "r"(C[1]), "r"(C[2]),
|
||||
"r"(C[3]));
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S8 * U8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,16>,
|
||||
32,
|
||||
int8_t,
|
||||
layout::RowMajor,
|
||||
uint8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,16>;
|
||||
|
||||
using ElementA = int8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int8_t, 8>;
|
||||
|
||||
using ElementB = uint8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const &B = reinterpret_cast<uint32_t const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k16.row.col.s32.s8.u8.s32 {%0,%1,%2,%3}, {%4,%5}, {%6}, "
|
||||
"{%7,%8,%9,%10};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(B), "r"(C[0]), "r"(C[1]), "r"(C[2]),
|
||||
"r"(C[3]));
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U8 * U8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,16>,
|
||||
32,
|
||||
uint8_t,
|
||||
layout::RowMajor,
|
||||
uint8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,16>;
|
||||
|
||||
using ElementA = uint8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint8_t, 8>;
|
||||
|
||||
using ElementB = uint8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint8_t, 4>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const &B = reinterpret_cast<uint32_t const &>(b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k16.row.col.s32.u8.u8.s32 {%0,%1,%2,%3}, {%4,%5}, {%6}, "
|
||||
"{%7,%8,%9,%10};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(B), "r"(C[0]), "r"(C[1]), "r"(C[2]),
|
||||
"r"(C[3]));
|
||||
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix Multiply 16816 - S8 input, S32 accumulation - SATURATE
|
||||
@@ -1031,252 +781,6 @@ struct Mma<
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix Multiply 16832 - S8 input, S32 accumulation
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S8 * S8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,32>,
|
||||
32,
|
||||
int8_t,
|
||||
layout::RowMajor,
|
||||
int8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,32>;
|
||||
|
||||
using ElementA = int8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int8_t, 16>;
|
||||
|
||||
using ElementB = int8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int8_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k32.row.col.s32.s8.s8.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U8 * S8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,32>,
|
||||
32,
|
||||
uint8_t,
|
||||
layout::RowMajor,
|
||||
int8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,32>;
|
||||
|
||||
using ElementA = uint8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint8_t, 16>;
|
||||
|
||||
using ElementB = int8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<int8_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k32.row.col.s32.u8.s8.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S8 * U8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,32>,
|
||||
32,
|
||||
int8_t,
|
||||
layout::RowMajor,
|
||||
uint8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,32>;
|
||||
|
||||
using ElementA = int8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<int8_t, 16>;
|
||||
|
||||
using ElementB = uint8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint8_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k32.row.col.s32.s8.u8.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U8 * U8 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16,8,32>,
|
||||
32,
|
||||
uint8_t,
|
||||
layout::RowMajor,
|
||||
uint8_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16,8,32>;
|
||||
|
||||
using ElementA = uint8_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<uint8_t, 16>;
|
||||
|
||||
using ElementB = uint8_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<uint8_t, 8>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k32.row.col.s32.u8.u8.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix Multiply 16832 - S8 input, S32 accumulation - SATURATE
|
||||
@@ -1310,7 +814,7 @@ struct Mma<
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using Operator = OpMultiplyAddSaturate;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
@@ -1430,7 +934,7 @@ struct Mma<
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using Operator = OpMultiplyAddSaturate;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
@@ -1523,269 +1027,6 @@ struct Mma<
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix Multiply 16864 - S4 input, S32 accumulation
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S4 * S4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16, 8, 64>,
|
||||
32,
|
||||
cutlass::int4b_t,
|
||||
layout::RowMajor,
|
||||
cutlass::int4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16, 8, 64>;
|
||||
|
||||
using ElementA = cutlass::int4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<cutlass::int4b_t, 32>;
|
||||
|
||||
using ElementB = cutlass::int4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<cutlass::int4b_t, 16>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k64.row.col.s32.s4.s4.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U4 * S4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16, 8, 64>,
|
||||
32,
|
||||
cutlass::uint4b_t,
|
||||
layout::RowMajor,
|
||||
cutlass::int4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16, 8, 64>;
|
||||
|
||||
using ElementA = cutlass::uint4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<cutlass::uint4b_t, 32>;
|
||||
|
||||
using ElementB = cutlass::int4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<cutlass::int4b_t, 16>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k64.row.col.s32.u4.s4.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = S4 * U4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16, 8, 64>,
|
||||
32,
|
||||
cutlass::int4b_t,
|
||||
layout::RowMajor,
|
||||
cutlass::uint4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16, 8, 64>;
|
||||
|
||||
using ElementA = cutlass::int4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<cutlass::int4b_t, 32>;
|
||||
|
||||
using ElementB = cutlass::uint4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<cutlass::uint4b_t, 16>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k64.row.col.s32.s4.u4.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/// Matrix multiply-add operation: S32 = U4 * U4 + S32
|
||||
template <>
|
||||
struct Mma<
|
||||
gemm::GemmShape<16, 8, 64>,
|
||||
32,
|
||||
cutlass::uint4b_t,
|
||||
layout::RowMajor,
|
||||
cutlass::uint4b_t,
|
||||
layout::ColumnMajor,
|
||||
int,
|
||||
layout::RowMajor,
|
||||
OpMultiplyAdd> {
|
||||
|
||||
using Shape = gemm::GemmShape<16, 8, 64>;
|
||||
|
||||
using ElementA = cutlass::uint4b_t;
|
||||
using LayoutA = layout::RowMajor;
|
||||
using FragmentA = Array<cutlass::uint4b_t, 32>;
|
||||
|
||||
using ElementB = cutlass::uint4b_t;
|
||||
using LayoutB = layout::ColumnMajor;
|
||||
using FragmentB = Array<cutlass::uint4b_t, 16>;
|
||||
|
||||
using ElementC = int;
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
CUTLASS_HOST_DEVICE
|
||||
void operator()(
|
||||
FragmentC &d,
|
||||
FragmentA const &a,
|
||||
FragmentB const &b,
|
||||
FragmentC const &c
|
||||
) const {
|
||||
|
||||
#if defined(CUTLASS_ARCH_MMA_SM80_ENABLED)
|
||||
|
||||
uint32_t const *A = reinterpret_cast<uint32_t const *>(&a);
|
||||
uint32_t const *B = reinterpret_cast<uint32_t const *>(&b);
|
||||
|
||||
int const *C = reinterpret_cast<int const *>(&c);
|
||||
int *D = reinterpret_cast<int *>(&d);
|
||||
|
||||
asm volatile(
|
||||
"mma.sync.aligned.m16n8k64.row.col.s32.u4.u4.s32 {%0,%1,%2,%3}, {%4,%5,%6,%7}, "
|
||||
"{%8,%9}, {%10,%11,%12,%13};\n"
|
||||
: "=r"(D[0]), "=r"(D[1]), "=r"(D[2]), "=r"(D[3])
|
||||
: "r"(A[0]), "r"(A[1]), "r"(A[2]), "r"(A[3]), "r"(B[0]), "r"(B[1]),
|
||||
"r"(C[0]), "r"(C[1]), "r"(C[2]), "r"(C[3]));
|
||||
|
||||
#else
|
||||
CUTLASS_UNUSED(a);
|
||||
CUTLASS_UNUSED(b);
|
||||
CUTLASS_UNUSED(c);
|
||||
CUTLASS_UNUSED(d);
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix Multiply 16864 - S4 input, S32 accumulation - SATURATE
|
||||
@@ -1819,7 +1060,7 @@ struct Mma<
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using Operator = OpMultiplyAddSaturate;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
@@ -1947,7 +1188,7 @@ struct Mma<
|
||||
using LayoutC = layout::RowMajor;
|
||||
using FragmentC = Array<int, 4>;
|
||||
|
||||
using Operator = OpMultiplyAdd;
|
||||
using Operator = OpMultiplyAddSaturate;
|
||||
using ArchTag = arch::Sm80;
|
||||
|
||||
/// Computes multiply-add
|
||||
@@ -2261,5 +1502,4 @@ struct Mma<
|
||||
|
||||
} // namespace arch
|
||||
} // namespace cutlass
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,12 +37,9 @@
|
||||
|
||||
#include "cutlass/cutlass.h"
|
||||
|
||||
#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 900) && (__CUDACC_VER_MAJOR__ >= 12))
|
||||
#if (defined(__CUDA_ARCH_FEAT_SM90_ALL))
|
||||
#if (defined(__CUDA_ARCH__) &&\
|
||||
(__CUDA_ARCH__ >= 900) && (__CUDACC_VER_MAJOR__ >= 12) && defined(__CUDA_ARCH_FEAT_SM90_ALL))
|
||||
#define CUDA_CTA_RECONFIG_ACTIVATED 1
|
||||
#endif
|
||||
#else
|
||||
#define CUDA_CTA_RECONFIG_ACTIVATED 0
|
||||
#endif
|
||||
|
||||
namespace cutlass {
|
||||
@@ -55,6 +52,7 @@ void warpgroup_reg_alloc(){
|
||||
asm volatile( "setmaxnreg.inc.sync.aligned.u32 %0;\n" : : "n"(RegCount) );
|
||||
#endif
|
||||
}
|
||||
|
||||
template<uint32_t RegCount>
|
||||
CUTLASS_DEVICE
|
||||
void warpgroup_reg_dealloc(){
|
||||
|
||||
Reference in New Issue
Block a user