Basic GEMM Example
This example demonstrates how to call a CUTLASS GEMM kernel and provides a naive reference matrix multiply kernel to verify its correctness.Overview
The CUTLASS GEMM template computes the general matrix product (GEMM) using single-precision floating-point arithmetic:Key Concepts
- GEMM kernel instantiation: Defining and launching a CUTLASS GEMM kernel
- Template parameters: Configuring data types and matrix layouts
- Argument objects: Passing parameters to CUTLASS kernels
- Reference validation: Verifying correctness against a naive implementation
Implementation
Building and Running
Build the example
Run the example
Source Code Location
The complete source code for this example is available at:examples/00_basic_gemm/basic_gemm.cu
What This Example Demonstrates
- Minimal CUTLASS usage: This example deliberately uses minimal CUTLASS components to show the simplest path to getting started
- Template-based kernel instantiation: How to define a GEMM kernel using CUTLASS templates
- Argument construction: The pattern for passing arguments to CUTLASS kernels
- Correctness verification: How to validate CUTLASS output against a reference implementation
Key Takeaways
- CUTLASS provides simplified abstractions for high-performance GEMM operations
- The
cutlass::gemm::device::Gemmtemplate handles kernel instantiation - Argument objects provide a structured way to pass parameters to kernels
- CUTLASS defaults (e.g., 128x128x8 tile size) are chosen for good general performance
Next Steps
- Explore Batched GEMM for processing multiple independent matrix multiplications
- Learn about Fused Operations to combine GEMM with element-wise operations
- Check out Convolution for convolutional neural network operations