NVlabs/CuTe
Reference implementation and examples of the CuTe Layout representation and algebra.
What it solves
PyCuTe provides a pure-Python reference implementation of the hierarchical layout-and-tensor algebra used in NVIDIA's CUTLASS 3.x. It allows developers to learn the complex algebra, prototype new data transformations, and generate test vectors for C++ and DSL implementations without requiring a GPU.
How it works
At its core, PyCuTe defines a Layout as a function that maps coordinates to offsets using a Shape (the domain) and a Stride (the mapping logic). It implements a suite of algebraic operations to manipulate these layouts, including:
- Coalesce: Simplifies layouts to the minimum number of modes.
- Composition: Indexes one layout through another.
- Complement: Identifies missing modes to fill a codomain.
- Logical Divide/Product: Handles tiling and repetition of patterns.
- Inversion/Nullspace: Analyzes and inverts maps.
It also supports F2 (XOR-swizzle) strides to help visualize and manage shared-memory bank conflicts. A thin Tensor layer pairs these layouts with an Accessor to provide a data model.
Who it’s for
- Developers working with CUTLASS 3.x or the CuTe DSL.
- Engineers prototyping GPU tensor operations and memory layouts.
- Researchers studying hierarchical layout algebra.
Highlights
- GPU-Independent: Runs in plain Python (3.10+) with no hardware requirements.
- Visualization Tools: Includes utilities to render layouts as ASCII tables, colored SVGs, or TikZ/PDFs.
- Comprehensive Algebra: Implements the full layout algebra described in the CuTe Whitepaper.
- Swizzle Support: Specifically handles XOR-swizzling to visualize bank conflicts.
Related
- Project
- Project
- Project
- Project