Domain 13: GPU Engineering & CUDA
GPU programming for AI: GPU architecture, the CUDA model, the memory hierarchy, parallel patterns, performance engineering, CUDA libraries and Triton.
Unlock all 8 lessons with Unrolled Pro
Full production code, quantitative capacity math, failure recovery playbooks, and interview coaching.
Lessons
8 lessonsGPU Architecture — Thousands of Simple Cores and a Memory System to Feed Them
Every model in this course runs on GPUs, and every performance number in Domain 12 came from two datasheet figures.
The CUDA Programming Model — Grids, Blocks, Threads and Streams
CUDA is the programming model under PyTorch, cuBLAS, FlashAttention, vLLM's kernels and Triton's output.
The GPU Memory Hierarchy — Coalescing, Shared Memory and Bank Conflicts
Most kernels in an LLM are memory-bound, so the memory system decides their speed.
Parallel Computation — Reductions, Scans, Atomics and Tiled Matmul
A handful of parallel patterns cover most GPU kernels in deep learning: map (elementwise ops), reduce (sums, maxima: norms, softmax, loss), scan (prefix sums: top-p sampling, stream compaction, MoE token packing), histogram/scatter with atomics (counting tokens per expert), and tiled matrix multiplication.
GPU Performance Engineering — Occupancy, Profiling and the Roofline in Practice
Performance work without measurement is guessing, and GPU guesses are usually wrong because there are three different ways to be slow: memory-bound (not enough bytes per second), compute-bound (not enough FLOPs per second), and latency/overhead-bound (the GPU waits: launch gaps, too few warps to hide latency, synchronization, CPU stalls).
CUDA Libraries & Tools — cuBLAS, cuDNN, CUTLASS, NCCL and When Not to Write a Kernel
NVIDIA and the open-source community have spent decades tuning libraries for the operations deep learning uses most: matrix multiplication, convolution, attention, collectives, sorting and scanning.
Triton Programming — Fast Fused Kernels in Python
Triton (OpenAI, now an open-source compiler that PyTorch 2 uses internally) lets you write GPU kernels in Python at the level of blocks of data instead of individual threads.
Bridge: From One GPU to Many Machines
Atlas's kernels are near the roofline and one GPU is used well. But Atlas now runs on 60 GPU servers, a queue of nightly jobs, three databases and a vector store, in two regions.