mlc-ai/modern-gpu-programming-for-mlsys
mlc-ai/modern-gpu-programming-for-mlsys has 1,381 GitHub stars and 145 forks. GitHot measured +1 stars in 24 hours and +3 in 7 days. Last checked 2026-11-10 18:55 UTC. Last push 2026-11-02.
A tutorial on modern GPU programming for machine learning systems
측정된 스타 증가
- in 24h
- +1
- in 7 days
- +3
- in 15 days
- 업데이트 지연
- in 1 month
- 업데이트 지연
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalModern GPU Programming For MLSys
This book teaches modern GPU kernel programming as a progression: understand the GPU hardware → learn to program it → write state-of-the-art kernels. It treats the Blackwell-class GPU — its memory hierarchy and Tensor Memory, its tensor-core and asynchronous data-movement engines, warpgroups and clusters — as the real subject. The vehicle is TIRx (Tensor IR next), a Python DSL for writing GPU kernels at the IR level.
📖 Read it online: https://mlc.ai/modern-gpu-programming-for-mlsys/
Chinese version: https://mlc.ai/modern-gpu-programming-for-mlsys/zh/
🤝 Contribute: Corrections, examples, and improvements are welcome through the GitHub repository.
What's inside
- Part I — Understanding the GPU. Execution and memory model, the performance model (roofline, overlap), a deep dive into data layout, the memory and compute engines (TMA, Tensor Memory, Tensor Cores), asynchronous coordination, and advanced scheduling (CLC).
- Part II — Programming a GPU with TIRx. An introduction to TIRx through one runnable
single-MMA GEMM — scope, layout, and dispatch, and how compilation works — plus the tensor
layout model (
TileLayout, named axes, swizzle). - Part III — GEMM: Tiled to SOTA. A tiled GEMM built up through TMA pipelining, persistent scheduling, warp specialization, and 2-CTA clusters.
- Part IV — Flash Attention 4. A complete attention kernel built from the Part III techniques: two MMAs with softmax between them, online-softmax rescaling, causal masking, and GQA.
- Appendices. TIRx language reference, reproducible GPU benchmarking and profiling, compiler internals, and asynchronous-kernel debugging.
Build the book locally
The book is a Sphinx site (Markdown/MyST + reStructuredText):
pip install -r requirements-docs.txt
sphinx-build -b html . _build/html
Preview
python -m http.server -d _build/html 8000
Open http://localhost:8000. On a remote machine the server runs there, so forward the
port — ssh -L 8000:localhost:8000 user@your-server — then open the URL locally. (VS Code
Remote SSH auto-forwards it.)
Running the kernels (requires a Blackwell GPU)
The kernels in this book target Blackwell (sm_100a), so running them needs a Blackwell GPU
(such as a B200), the TIRx compiler, and a CUDA build of PyTorch.
1. Install the TIRx compiler. Its Python module is tvm_tirx:
pip install apache-tvm-tirx cuda-bindings
The default wheel includes native LLVM support. For additional cross-compilation targets,
install apache-tvm-tirx[all-targets].
Verify:
python -c "import tvm_tirx; print(tvm_tirx.__version__)"
2. Install PyTorch with a CUDA build matching your GPU (used for the example inputs and the reference checks) — see https://pytorch.org.
3. Install the reference kernels to run the complete Flash Attention example.
Use the latest main branch of the companion repository:
git clone https://github.com/mlc-ai/TIRx-kernels.git
cd TIRx-kernels
pip install -e .
Run it with, e.g., python -m tirx_kernels.test --kernel fp16_bf16_gemm.
TIRx parses kernel source via Python source inspection, so examples should live in a file
or notebook cell rather than inside python -c.
Deployment
Every push to main is built and published automatically by GitHub Actions
(.github/workflows/build_deploy.yaml) to https://mlc.ai/modern-gpu-programming-for-mlsys/.
관련 프로젝트 살펴보기
sindresorhus/awesome
😎 온갖 흥미로운 주제에 관한 Awesome 목록 [참고: 기존 풀 리퀘스트를 따라잡을 여유가 생길 때까지 풀 리퀘스트가 일시적으로 비활성화되어 있습니다]
535,162 스타EbookFoundation/free-programming-books
:books: 무료로 이용할 수 있는 프로그래밍 도서
401,435 스타nilbuild/developer-roadmap
개발자의 커리어 성장을 돕는 인터랙티브 로드맵, 가이드 및 기타 교육 콘텐츠.
371,810 스타vinta/awesome-python
“Python으로 X를 하고 싶은데, 어떤 도구를 써야 할까?”에 답하는 결정판 목록.
334,018 스타