releaase 2.11 (#703)
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "cutlass/matrix_coord.h"
|
||||
#include "cutlass/complex.h"
|
||||
#include "cutlass/semaphore.h"
|
||||
#include "cutlass/gemm/kernel/params_universal_base.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -105,16 +106,12 @@ public:
|
||||
//
|
||||
|
||||
/// Argument structure
|
||||
struct Arguments {
|
||||
|
||||
struct Arguments : UniversalArgumentsBase
|
||||
{
|
||||
//
|
||||
// Data members
|
||||
//
|
||||
|
||||
GemmUniversalMode mode;
|
||||
GemmCoord problem_size;
|
||||
int batch_count;
|
||||
|
||||
typename EpilogueOutputOp::Params epilogue;
|
||||
|
||||
void const * ptr_A_real;
|
||||
@@ -144,17 +141,13 @@ public:
|
||||
int64_t batch_stride_B_imag;
|
||||
int64_t batch_stride_C;
|
||||
int64_t batch_stride_C_imag;
|
||||
int64_t batch_stride_D;
|
||||
int64_t batch_stride_D_imag;
|
||||
|
||||
|
||||
//
|
||||
// Methods
|
||||
//
|
||||
|
||||
Arguments():
|
||||
mode(GemmUniversalMode::kGemm),
|
||||
batch_count(1),
|
||||
Arguments() :
|
||||
ptr_A_real(nullptr),
|
||||
ptr_A_imag(nullptr),
|
||||
ptr_B_real(nullptr),
|
||||
@@ -163,7 +156,7 @@ public:
|
||||
ptr_C_imag(nullptr),
|
||||
ptr_D_real(nullptr),
|
||||
ptr_D_imag(nullptr)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/// constructs an arguments structure
|
||||
Arguments(
|
||||
@@ -194,11 +187,9 @@ public:
|
||||
int64_t batch_stride_C = 0,
|
||||
int64_t batch_stride_C_imag = 0,
|
||||
int64_t batch_stride_D = 0,
|
||||
int64_t batch_stride_D_imag = 0
|
||||
):
|
||||
mode(mode),
|
||||
problem_size(problem_size),
|
||||
batch_count(batch_count),
|
||||
int64_t batch_stride_D_imag = 0)
|
||||
:
|
||||
UniversalArgumentsBase(mode, problem_size, batch_count, batch_stride_D),
|
||||
epilogue(epilogue),
|
||||
ptr_A_real(ptr_A_real),
|
||||
ptr_A_imag(ptr_A_imag),
|
||||
@@ -222,10 +213,8 @@ public:
|
||||
batch_stride_B_imag(batch_stride_B_imag),
|
||||
batch_stride_C(batch_stride_C),
|
||||
batch_stride_C_imag(batch_stride_C_imag),
|
||||
batch_stride_D(batch_stride_D),
|
||||
batch_stride_D_imag(batch_stride_D_imag) {
|
||||
|
||||
}
|
||||
batch_stride_D_imag(batch_stride_D_imag)
|
||||
{}
|
||||
|
||||
/// Returns arguments for the transposed problem
|
||||
Arguments transposed_problem() const {
|
||||
@@ -243,16 +232,30 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Structure for precomputing values in host memory and passing to kernels
|
||||
//
|
||||
|
||||
/// Parameters structure
|
||||
struct Params {
|
||||
cutlass::gemm::GemmCoord problem_size;
|
||||
cutlass::gemm::GemmCoord grid_tiled_shape;
|
||||
int swizzle_log_tile;
|
||||
|
||||
struct Params : UniversalParamsBase<
|
||||
ThreadblockSwizzle,
|
||||
ThreadblockShape,
|
||||
ElementA,
|
||||
ElementB,
|
||||
ElementC>
|
||||
{
|
||||
using ParamsBase = UniversalParamsBase<
|
||||
ThreadblockSwizzle,
|
||||
ThreadblockShape,
|
||||
ElementA,
|
||||
ElementB,
|
||||
ElementC>;
|
||||
|
||||
//
|
||||
// Data members
|
||||
//
|
||||
|
||||
typename Mma::IteratorA::Params params_A_real;
|
||||
typename Mma::IteratorA::Params params_A_imag;
|
||||
typename Mma::IteratorB::Params params_B_real;
|
||||
@@ -264,10 +267,6 @@ public:
|
||||
|
||||
typename EpilogueOutputOp::Params output_op;
|
||||
|
||||
GemmUniversalMode mode;
|
||||
int batch_count;
|
||||
int gemm_k_size;
|
||||
|
||||
void * ptr_A_real;
|
||||
void * ptr_A_imag;
|
||||
void * ptr_B_real;
|
||||
@@ -278,54 +277,28 @@ public:
|
||||
void * ptr_D_imag;
|
||||
|
||||
int64_t batch_stride_A;
|
||||
int64_t batch_stride_A_imag;
|
||||
int64_t batch_stride_B;
|
||||
int64_t batch_stride_B_imag;
|
||||
int64_t batch_stride_C;
|
||||
|
||||
int64_t batch_stride_A_imag;
|
||||
int64_t batch_stride_B_imag;
|
||||
int64_t batch_stride_C_imag;
|
||||
int64_t batch_stride_D;
|
||||
int64_t batch_stride_D_imag;
|
||||
|
||||
int *semaphore;
|
||||
|
||||
//
|
||||
// Methods
|
||||
// Host dispatch API
|
||||
//
|
||||
|
||||
CUTLASS_HOST_DEVICE
|
||||
Params():
|
||||
batch_count(0),
|
||||
gemm_k_size(0),
|
||||
swizzle_log_tile(0),
|
||||
mode(cutlass::gemm::GemmUniversalMode::kGemm),
|
||||
ptr_A_real(nullptr),
|
||||
ptr_A_imag(nullptr),
|
||||
ptr_B_real(nullptr),
|
||||
ptr_B_imag(nullptr),
|
||||
ptr_C_real(nullptr),
|
||||
ptr_C_imag(nullptr),
|
||||
ptr_D_real(nullptr),
|
||||
ptr_D_imag(nullptr),
|
||||
batch_stride_A(0),
|
||||
batch_stride_A_imag(0),
|
||||
batch_stride_B(0),
|
||||
batch_stride_B_imag(0),
|
||||
batch_stride_C(0),
|
||||
batch_stride_C_imag(0),
|
||||
batch_stride_D(0),
|
||||
batch_stride_D_imag(0),
|
||||
semaphore(nullptr) { }
|
||||
/// Default constructor
|
||||
Params() = default;
|
||||
|
||||
CUTLASS_HOST_DEVICE
|
||||
/// Constructor
|
||||
Params(
|
||||
Arguments const &args,
|
||||
cutlass::gemm::GemmCoord const & grid_tiled_shape,
|
||||
int gemm_k_size,
|
||||
void *workspace = nullptr
|
||||
):
|
||||
problem_size(args.problem_size),
|
||||
grid_tiled_shape(grid_tiled_shape),
|
||||
swizzle_log_tile(ThreadblockSwizzle().get_log_tile(grid_tiled_shape)),
|
||||
Arguments const &args, /// GEMM application arguments
|
||||
int device_sms, /// Number of SMs on the device
|
||||
int sm_occupancy) /// Kernel SM occupancy (in thread blocks)
|
||||
:
|
||||
ParamsBase(args, device_sms, sm_occupancy),
|
||||
params_A_real(args.lda_real),
|
||||
params_A_imag(args.lda_imag),
|
||||
params_B_real(args.ldb_real),
|
||||
@@ -335,9 +308,6 @@ public:
|
||||
params_D_real(args.ldd_real),
|
||||
params_D_imag(args.ldd_imag),
|
||||
output_op(args.epilogue),
|
||||
mode(args.mode),
|
||||
batch_count(args.batch_count),
|
||||
gemm_k_size(gemm_k_size),
|
||||
ptr_A_real(const_cast<void *>(args.ptr_A_real)),
|
||||
ptr_A_imag(const_cast<void *>(args.ptr_A_imag)),
|
||||
ptr_B_real(const_cast<void *>(args.ptr_B_real)),
|
||||
@@ -347,21 +317,32 @@ public:
|
||||
ptr_D_real(args.ptr_D_real),
|
||||
ptr_D_imag(args.ptr_D_imag),
|
||||
batch_stride_A(args.batch_stride_A),
|
||||
batch_stride_A_imag(args.batch_stride_A_imag),
|
||||
batch_stride_B(args.batch_stride_B),
|
||||
batch_stride_B_imag(args.batch_stride_B_imag),
|
||||
batch_stride_C(args.batch_stride_C),
|
||||
batch_stride_A_imag(args.batch_stride_A_imag),
|
||||
batch_stride_B_imag(args.batch_stride_B_imag),
|
||||
batch_stride_C_imag(args.batch_stride_C_imag),
|
||||
batch_stride_D(args.batch_stride_D),
|
||||
batch_stride_D_imag(args.batch_stride_D_imag),
|
||||
semaphore(static_cast<int *>(workspace)) {
|
||||
batch_stride_D_imag(args.batch_stride_D_imag)
|
||||
{}
|
||||
|
||||
/// Returns the workspace size (in bytes) needed for this problem geometry
|
||||
size_t get_workspace_size() const
|
||||
{
|
||||
size_t workspace_bytes = ParamsBase::get_workspace_size();
|
||||
if (this->mode == GemmUniversalMode::kGemmSplitKParallel)
|
||||
{
|
||||
// Double the size returned by the base class because we need to
|
||||
// accumulate two ElementC components
|
||||
workspace_bytes *= 2;
|
||||
}
|
||||
|
||||
return workspace_bytes;
|
||||
}
|
||||
|
||||
void update(
|
||||
Arguments const &args,
|
||||
void *workspace = nullptr) {
|
||||
|
||||
/// Lightweight update given a subset of arguments. Problem geometry is assumed
|
||||
/// to remain the same.
|
||||
void update(Arguments const &args)
|
||||
{
|
||||
ptr_A_real = const_cast<void *>(args.ptr_A_real);
|
||||
ptr_A_imag = const_cast<void *>(args.ptr_A_imag);
|
||||
|
||||
@@ -374,21 +355,11 @@ public:
|
||||
ptr_D_real = const_cast<void *>(args.ptr_D_real);
|
||||
ptr_D_imag = const_cast<void *>(args.ptr_D_imag);
|
||||
|
||||
batch_stride_A = args.batch_stride_A;
|
||||
batch_stride_A_imag = args.batch_stride_A_imag;
|
||||
batch_stride_B = args.batch_stride_B;
|
||||
batch_stride_B_imag = args.batch_stride_B_imag;
|
||||
batch_stride_C = args.batch_stride_C;
|
||||
batch_stride_C_imag = args.batch_stride_C_imag;
|
||||
batch_stride_D = args.batch_stride_D;
|
||||
batch_stride_D_imag = args.batch_stride_D_imag;
|
||||
|
||||
output_op = args.epilogue;
|
||||
|
||||
semaphore = static_cast<int *>(workspace);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// Shared memory storage structure
|
||||
union SharedStorage {
|
||||
typename Mma::SharedStorage main_loop;
|
||||
@@ -398,15 +369,12 @@ public:
|
||||
public:
|
||||
|
||||
//
|
||||
// Methods
|
||||
// Host dispatch API
|
||||
//
|
||||
|
||||
CUTLASS_DEVICE
|
||||
GemmPlanarComplex() { }
|
||||
|
||||
/// Determines whether kernel satisfies alignment
|
||||
static Status can_implement(Arguments const &args) {
|
||||
|
||||
static Status can_implement(Arguments const &args)
|
||||
{
|
||||
static int const kAlignmentA = Mma::IteratorA::AccessType::kElements;
|
||||
static int const kAlignmentB = Mma::IteratorB::AccessType::kElements;
|
||||
static int const kAlignmentC = Epilogue::OutputTileIterator::kElementsPerAccess;
|
||||
@@ -440,12 +408,23 @@ public:
|
||||
return Status::kSuccess;
|
||||
}
|
||||
|
||||
static size_t get_extra_workspace_size(Arguments const &args,
|
||||
cutlass::gemm::GemmCoord const &grid_tiled_shape) {
|
||||
public:
|
||||
|
||||
return 0;
|
||||
//
|
||||
// Device-only API
|
||||
//
|
||||
|
||||
// Factory invocation
|
||||
CUTLASS_DEVICE
|
||||
static void invoke(
|
||||
Params const ¶ms,
|
||||
SharedStorage &shared_storage)
|
||||
{
|
||||
GemmPlanarComplex op;
|
||||
op(params, shared_storage);
|
||||
}
|
||||
|
||||
|
||||
/// Executes one GEMM
|
||||
CUTLASS_DEVICE
|
||||
void operator()(Params const ¶ms, SharedStorage &shared_storage) {
|
||||
|
||||
Reference in New Issue
Block a user