Gemm class provides a high-level interface for constructing, compiling, and running General Matrix Multiply operations in CUTLASS.
Class Reference
cutlass.op.Gemm
D = alpha * (A @ B) + beta * C
The data types and layouts of operands are bound to the Gemm object throughout its lifetime and cannot be changed after construction.
tensor, optional
Input tensor A with shape (M, K). Can be torch.Tensor, numpy.ndarray, or cupy.ndarray. If provided, the element type and layout are inferred from this tensor.
tensor, optional
Input tensor B with shape (K, N). Can be torch.Tensor, numpy.ndarray, or cupy.ndarray. If provided, the element type and layout are inferred from this tensor.
tensor, optional
Input tensor C with shape (M, N). Can be torch.Tensor, numpy.ndarray, or cupy.ndarray. If provided, the element type and layout are inferred from this tensor.
tensor, optional
Output tensor D with shape (M, N). Can be torch.Tensor, numpy.ndarray, or cupy.ndarray. If provided, the element type and layout are inferred from this tensor.
scalar, optional
default:"1.0"
Scalar multiplier for the A @ B product.
scalar, optional
default:"0.0"
Scalar multiplier for the C tensor. When beta=0, C is not read.
cutlass.DataType, optional
Data type for operand A. Overrides generic
element parameter.cutlass.DataType, optional
Data type for operand B. Overrides generic
element parameter.cutlass.DataType, optional
Data type for operand C. Overrides generic
element parameter.cutlass.DataType, optional
Data type for operand D. Overrides generic
element parameter.cutlass.DataType, optional
Data type used for accumulation. If not specified, defaults to the element type.
cutlass.DataType, optional
Generic data type for all operands (A, B, C, D) and accumulator. Can be overridden per operand.
cutlass.LayoutType, optional
Memory layout for operand A. Overrides generic
layout parameter.cutlass.LayoutType, optional
Memory layout for operand B. Overrides generic
layout parameter.cutlass.LayoutType, optional
Memory layout for operand C and D. Overrides generic
layout parameter.cutlass.LayoutType, optional
Generic layout for all operands. Can be overridden per operand.
int, optional
Compute capability of the target device (e.g., 90 for H100). Defaults to auto-detection.
int, optional
Compute capability of the kernel to generate. Useful for using older kernel implementations on newer hardware.
Methods
run()
tensor, optional
Input tensor A. If not provided, uses the tensor from initialization.
tensor, optional
Input tensor B. If not provided, uses the tensor from initialization.
tensor, optional
Input tensor C. If not provided, uses the tensor from initialization.
tensor, optional
Output tensor D. If not provided, uses the tensor from initialization.
scalar, optional
Scalar alpha. If not provided, uses the value from initialization.
scalar, optional
Scalar beta. If not provided, uses the value from initialization.
bool
default:"True"
If True, waits for the kernel to complete. If False, returns immediately.
bool
default:"False"
If True, prints the generated CUDA C++ code.
GemmArguments object that can be used to synchronize or retrieve results.
compile()
run() will compile if needed.
cutlass.TileDescription, optional
Custom tile description for advanced kernel configuration.
int, optional
Memory alignment requirement in elements. Defaults to automatic selection.
plan()
Properties
activation
cutlass.epilogue.identity(default)cutlass.epilogue.relucutlass.epilogue.gelucutlass.epilogue.sigmoidcutlass.epilogue.tanhcutlass.epilogue.silucutlass.epilogue.hardswishcutlass.epilogue.leaky_relu