cfregly/ai-performance-engineering
Code, labs, and resources for O'Reilly AI Systems Performance Engineering: GPU optimization, distributed training, inference scaling, and full-stack tuning.
What it solves
Modern AI systems often run far below their theoretical peak speed. This repository tackles that gap by teaching a profile-first, goodput-driven approach to performance engineering. Instead of chasing raw FLOPs, it shows how to find real bottlenecks in GPUs, interconnects, and runtime stacks, then fix them to make training and inference pipelines faster, cheaper, and more reliable.
How it works
The repo is the companion to the O'Reilly book AI Systems Performance Engineering by Chris Fregly. It provides hands-on code (thousands of lines of PyTorch and CUDA C++), tooling, and resources. You get a 200+ item performance checklist covering the whole lifecycle, from mindset and hardware planning to profiling, distributed training, inference serving, and power management. The repo also links to a ChatGPT version of the book, a monthly meetup community, a YouTube channel, and slide decks from past sessions. The book itself walks through profiling with Nsight Systems/Compute and the PyTorch profiler, tuning memory and bandwidth, using compiler stacks (PyTorch + OpenAI Triton), scaling with parallelism strategies (DP, FSDP, TP, PP, CP, MoE), and serving trillion-parameter models with vLLM, SGLang, TensorRT-LLM, and NVIDIA Dynamo.
Who it’s for
AI/ML engineers, systems engineers, researchers, and platform teams who build or operate training and inference systems at scale. It’s also useful for anyone wanting to understand GPU optimization, distributed training, and high-throughput inference—whether you’re tuning a single GPU or a multi-node cluster.
Highlights
- 200+ item field-tested performance checklist covering the entire lifecycle
- Thousands of lines of PyTorch and CUDA C++ code examples for modern NVIDIA GPUs
- Direct chat with the book via a custom ChatGPT
- Monthly meetup community with 100k+ members across 20+ cities
- Chapters on profiling, memory optimization, kernel tuning, distributed training, and inference scaling
- Covers tools like Nsight, PyTorch profiler, torch.compile, Triton, vLLM, SGLang, TensorRT-LLM, and NVIDIA Dynamo
- Apache 2.0 licensed and open to contributions
Related
- Project
- Dispatch
- Project
- Project
- Project