How to Tame Blackwell Without Going Mad from CUDA
When it comes to writing GPU kernels, most of us immediately picture endless pages of CUDA C++ code, juggling pointers, and the agonizing debug of memory leaks or race conditions. The situation gets even more complex when monsters like the NVIDIA Blackwell architecture (sm_100a) hit the market. There's so much asynchrony and new data engines inside that the old "just launch a thread to a core" approaches don't squeeze out even half the performance anymore.
Recently I stumbled upon the modern-gpu-programming-for-mlsys project from the MLC-AI team. Essentially, it's not just a repository, but a living interactive tutorial on modern GPU programming. The guys went all-in: they teach you to write SOTA (state-of-the-art) kernels using Python and a new DSL called TIRx.
Why This Isn't Just Another Tutorial
Usually GPU courses get stuck on the classic matrix multiplication from the 2010s. Here, the focus is shifted to tomorrow's hardware. The center of attention is the Blackwell architecture, its memory hierarchy, tensor cores, and asynchronous data movement mechanisms.
The authors propose a path from understanding the hardware to writing kernels that actually work in modern ML systems. Instead of fighting with low-level C++, you write in TIRx (Tensor IR next). This is an Apache TVM extension that lets you describe kernel logic in Python while maintaining control over registers, cache, and tensor engines.
What's Inside This Tutorial
All content is broken down into logical blocks that gradually raise the difficulty bar.
First, they cover the execution and memory model. No boring definitions here, but plenty of practice working with TMA (Tensor Memory Accelerator) and understanding how data actually reaches the compute units. Interestingly, the authors dwell in detail on the Roofline model—it helps understand what your code is bottlenecked on: memory bandwidth or the raw power of the cores.
Then comes the deep dive into TIRx. You learn to work with tiles (TileLayout), axes, and the swizzle mechanism (clever data shuffling in memory to avoid bank conflicts). At the end, you get a working GEMM (matrix multiplication) kernel.
After that comes the real "meat." The authors show how to turn a regular GEMM into a high-performance monster. TMA pipelines, warp specialization, and grouping CTAs into clusters come into play. If these terms sound like incantations, the tutorial will neatly lay them out on shelves.
In the finale, you create Flash Attention 4. This is exactly what modern large language models run on. The kernel includes two MMA (Matrix-Matrix Accumulation) stages, online softmax, and GQA (Grouped Query Attention) support.
Technical Stack and Features
The project is tightly coupled with the Apache TVM ecosystem. To run the examples, you'll need:
- Library
apache-tvm(TIRx ships inside it). - PyTorch for verifying results and preparing data.
- A Blackwell GPU (e.g., B200) if you want to run the code on real hardware.
If you don't have a Blackwell at hand (which is logical for most of us right now), the repository is still extremely useful as a theoretical base. The logic of memory optimization and computation scheduling applies to older architectures too, although some features like TMA are specific to newer NVIDIA generations.
To build the book locally and read it in a convenient format, standard Sphinx is enough:
pip install -r requirements-docs.txt
sphinx-build -b html . _build/html
Is It Worth Your Time
I often encounter ML infrastructure developers who are afraid to dive into kernel writing, considering it the prerogative of "C++ gods." This project proves that with the right abstractions (like TIRx) and understanding of the architecture, you can write world-class code while staying in the Python ecosystem.
The project will be especially useful for those who work on optimizing neural networks "under the hood" or want to understand why Flash Attention is faster than the usual approach. Even if you're not planning to release your own Blackwell library tomorrow, going through how tensor memory and asynchronous queues work really clears the mind and changes your perspective on high-performance computing.
The only downside is that the entry barrier is still high. This isn't "GPU for dummies," but rather "GPU for those who want to become pros." But if you're ready to figure out how bytes actually move inside a graphics card, it's hard to find better material on the topic right now.
Related projects