Dive into Deep Learning · §13
Computational Performance: Roofline Models, Hardware, Compilers, and Multi-GPU Scaling
arithmetic intensity · roofline & dispatch bounds · memory & precision · fusion & CUDA graphs · collectives & FSDP
The Central Problem
bf16 GEMMs saturate Tensor Cores near 165\text{ TFLOP/s}, while elementwise adds (I = 0.25) stall at 0.25\text{ TFLOP/s}.fp32 Adam consumes 16N \approx 15.1\text{ GiB} of a 24\text{ GiB} card before storing a single token’s activations.Unifying Analytical Model
t \;\gtrsim\; \max\!\left(h,\; \frac{\textrm{FLOPs}}{P},\; \frac{\textrm{bytes}}{\beta}\right)
bf16 on RTX 4090; \sim 295 on H100).Reference Machine
bf16) and \beta = 1.01\text{ TB/s} DRAM bandwidth (I^* \approx 164\text{ FLOP/B}).Chapter Structure
bf16, rematerialization, and accumulation.Study Guide
allclose) and end-to-end validation loss gates.Up next (§13.1 The Performance Model): Defining arithmetic intensity, constructing the roofline bound, avoiding asynchronous timing traps, and profiling a complete MLP training step.