$ show NVIDIA/cutlass
NVIDIA CUTLASS is a comprehensive C++ template library and Python DSL for implementing high-performance CUDA kernels, primarily focused on matrix multiply (GEMM), convolution, and attention operations. It provides a layered architecture from low-level warp matrix multiply-accumulate (MMA) and copy instructions (CuTe atoms) up through threadblock-level collective mainloops and epilogues, kernel-level schedulers (persistent, stream-K, warp-specialized), and a high-level operator API for runtime dispatch with fusion support. The repository includes a Python-embedded DSL (CuTeDSL) that uses MLIR-based compilation to generate optimized CUDA kernels, a separate Python code generation backend (cutlass_cppgen) for JIT compilation, and an extensive profiling and testing infrastructure. It spans NVIDIA GPU architectures from Volta to Blackwell and is actively maintained with contributions to deep learning frameworks like PyTorch and JAX.
The LLM identified 4 files worth highlighting for reuse:
A standalone C++ header-only library for layout algebra operations (zipped_divide, blocked_product, composition, coalesce, etc.) used by the CUTLASS compiler. It provides shape, stride, and layout types along with algorithms for tile partitioning and coordinate mapping. It demonstrates a clean, templated design that can be extracted and reused in other GPU code generation projects without relying on the rest of CUTLASS.
A generic utility for filtering exception tracebacks in DSL environments. It recursively cleans __cause__ and __traceback__ by removing internal DSL frames and compiler-generated frame names (e.g., loop_body, while_region). This pattern is reusable across any Python-based DSL that compiles code and produces synthetic stack frames, improving debugging for end users.
A topological pass manager for DAG-based IR transformation. It defines EVTPassBase with dependency lists and a pass manager that schedules execution respecting dependencies. This pattern is generic and can be extracted to manage any sequence of compiler passes with dependency resolution, not just the epilogue fusion context.
A template-based trait system that abstracts NVIDIA SM90 (Hopper) MMA instructions (GMMA). It defines MMA_Traits with shape, element types, and instruction descriptors, and serves as a reusable pattern for modeling any hardware instruction set as composable C++ traits. The design allows generic algorithms (like collective MMA) to work with different architectures by swapping the trait class.