Skip to main content

Overview

The cutlass::gemm::device::Gemm template provides a device-level interface to efficient CUTLASS GEMM kernels. It maps data types and structural parameters to specific CUTLASS components at compile time, and handles logical-to-kernel argument mapping and kernel launches at runtime. Header: cutlass/gemm/device/gemm.h

Template Signature

Template Parameters

typename
Element type for A matrix operand. Examples: float, half_t, int8_t
typename
Layout type for A matrix operand. Examples: layout::RowMajor, layout::ColumnMajor
typename
Element type for B matrix operand
typename
Layout type for B matrix operand
typename
Element type for C and D matrix operands
typename
Layout type for C and D matrix operands
typename
default:"ElementC_"
Element type for internal accumulation
typename
default:"arch::OpClassSimt"
Operator class tag. Examples: arch::OpClassSimt, arch::OpClassTensorOp
typename
default:"arch::Sm70"
Tag indicating architecture to tune for. Minimum SM that supports the intended feature. Examples: arch::Sm70, arch::Sm75, arch::Sm80
typename
Threadblock-level tile size (concept: GemmShape). Defaults depend on configuration.
typename
Warp-level tile size (concept: GemmShape)
typename
Instruction-level tile size (concept: GemmShape)
typename
Epilogue output operator. Example: epilogue::thread::LinearCombination
typename
default:"threadblock::GemmIdentityThreadblockSwizzle<>"
Threadblock-level swizzling operator
int
Number of stages used in the pipelined mainloop
int
Access granularity of A matrix in units of elements
int
Access granularity of B matrix in units of elements
bool
default:"false"
If true, kernel supports split-K with serial reduction
typename
Operation performed by GEMM
bool
default:"false"
Gather operand A by using an index array
bool
default:"false"
Gather operand B by using an index array
bool
default:"false"
Scatter result D by using an index array
typename
default:"layout::NoPermute"
Permute result D

Member Types

Arguments Structure

Member Functions

Constructor

Constructs the GEMM operator.

can_implement

Determines whether the GEMM can execute the given problem. Parameters:
  • args: Arguments structure containing problem parameters
Returns: Status::kSuccess if the problem can be executed, error code otherwise

get_workspace_size

Gets the workspace size in bytes required for the operation. Parameters:
  • args: Arguments structure
Returns: Size in bytes of required workspace

initialize

Initializes GEMM state from arguments. Parameters:
  • args: Arguments structure
  • workspace: Pointer to workspace memory
  • stream: CUDA stream
Returns: Status code

update

Lightweight update given a subset of arguments.

run

Runs the kernel using initialized state.

operator()

Runs the kernel. The second overload combines initialization and execution.

Usage Example

From include/cutlass/gemm/device/gemm.h:87-114:

Complete Example

From examples/00_basic_gemm/basic_gemm.cu:78-145:

See Also