Skip to main content
⚡ CUDA programming and kernel optimization 24 articles · 8 chapters

Module 2: CUDA programming and kernel optimization

Starts with CUDA basics, works through classic kernels (Reduce, GEMM, Softmax, Attention), then covers AI compilers and profiling tools.

Start learning

Chapters

Set up a CUDA development environment, learn the Grid/Block/Thread programming model and the memory model, and write your first practical CUDA kernel
Three progressive versions of Reduce (naive, shared-memory tree reduce, Warp Shuffle) as a way to learn step-by-step CUDA operator optimization
From naive matrix multiply through Block-Warp-Thread tiling, vectorized loads, bank-conflict removal, and double buffering — a full playbook for CUDA GEMM optimization
How FlashAttention V1/V2/V3 work and how they are implemented, plus Flash-Decoding and the PagedAttention CUDA path for the decode stage
Triton's Block-level programming model, torch.compile's compilation modes, and how TVM and XLA differ in role
Nsight Systems, Nsight Compute, and PyTorch Profiler—the three tools for systematic performance diagnosis

Study tips

Prerequisites

The prerequisites module, especially chapter 5 on GPU hardware

  • Finish the GPU hardware chapter in the prerequisites module first.
  • Every kernel chapter comes with code. Run it and change it yourself.
  • The profiling tools come up throughout the module, so learn them early.