Unit 6 of 14 · about 4 hours · measure

Compute, memory and communication bounds and exposed communication

Optimizing the wrong bound wastes the change. This unit predicts the limit first, then proves overlap with timelines instead of assuming it.

You'll be able to

  • Label a workload compute, memory or communication bound from roofline intensity and trace evidence.
  • Measure collective overlap and exposed communication for one bucket or prefetch policy.
  • Predict the dominant limit of one run before tracing, then quantify the residual.

Covers

Compute-bound, memory-bound and communication-bound diagnosisCollective overlap and exposed communication measurement
1

Read

In this order, only the parts listed

0 of 4 done

  1. Roofline derivations with answersHow to Scale Your Model - Chapters 1, 5, 9 and 12

    Where Does the Time Go through A Few Problems to Work, with the intensity definition, the Q1 derivation and Q5 on the H100 crossover, all with answers

  2. GPU rooflines for parallel dimensionsHow to Scale Your Model - Chapters 1, 5, 9 and 12

    Rooflines for LLM Scaling on GPUs with the DP, TP, EP and PP cost models, worked examples and Quiz 5 with answers

    Keep TPU ICI constants out of NCCL predictions. Re-parameterize collective costs for your fabric.

  3. Overlap math and roofline tablesMachine Learning Systems Volume II - Fleet Orchestration and Performance Engineering

    Communication-Computation Overlap with the overlap inequality and the 7B worked step, and The Memory Wall and Roofline Diagnosis with the intensity table

  4. Overlap in practiceAI Systems Performance Engineering - Chapters 1 to 5, 13 and 14

    Chapter 4, Overlapping Communication and Computation (Pipelining), with Achieving Maximal Overlap in Practice and Distributed Data Parallel Strategies

2

Focus on

  • Intensity is . Above the ridge (near 295 FLOP per byte for H100 FP16) the op is compute bound; below it, memory bound. Communication bound means exposed collective time dominates the step.
  • Exposed communication is total collective time minus the overlapped part. Overlap needs asynchronous buckets or prefetch on separate streams plus enough compute to hide the transfer.
  • Small messages are launch bound, not bandwidth bound. Halving the bytes halves the bandwidth term but leaves the latency term, so the factor-of-two slogans fail there.
Common mistakes · 3
  • Claiming overlap from asynchronous issue alone. Concurrency needs timeline proof that compute and communication actually coincide.
  • Assuming reduce-scatter always costs half an all-reduce. That holds for ring all-reduce, which is reduce-scatter plus all-gather; NCCL may run all-reduce as a tree or with in-switch reduction, so measure both.
  • Treating intensity as a hardware constant. It is a property of the op shape and batch; the ridge is the hardware property.
3

Try it yourself

Closed-book, before checking anything

Closed-book, compute intensity for an int8 matmul with and , the JAX Q1 shape made concrete (about 17M bytes, about 1.07G FLOPs, ) and label it memory bound against a ridge of 295. Then state the exposed-communication formula as total minus overlapped time.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Intensity 63 against ridge 295: which bound?Answer

    Memory bound. Achievable throughput is bandwidth times intensity, well below peak FLOPs.

  2. 2.What is exposed communication?Answer

    Collective time not hidden under compute: total communication minus the overlapped portion, measured from aligned timelines.

  3. 3.How do you prove overlap instead of mere asynchrony?Answer

    Show concurrent compute and communication intervals on aligned rank timelines with dependencies that permit concurrency, not just nonblocking calls.

  4. 4.When does the reduce-scatter factor-of-two claim break?Answer

    When all-reduce is not a ring. In the ring model both the latency and the bandwidth terms of reduce-scatter are half those of all-reduce; a tree or in-switch all-reduce, which NCCL may pick, breaks the ratio, so measure it.

5

Practice

You're done when

You can predict the dominant bound for one configuration, confirm it on a trace, and quantify the residual with a named cause.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 8 more in the section
  • Machine Learning Systems Volume II - Fleet Orchestration and Performance EngineeringML Systems Textbook · primary

    Read Scheduling Problem, Orchestration Paradigms, Topology-Aware Scheduling, Elastic Scheduling, Cost Optimization, Multi-Tenancy and Quotas and Debugging Cluster Utilization, then Memory Wall and Roofline Diagnosis, Graph Compilation, Communication-Computation Overlap, System Profiling and Measurement at Scale at https://mlsysbook.ai/vol2/performance_engineering/performance_engineering.html. Use the framework to choose one bottleneck-specific lab and one rollback metric.

  • AI Systems Performance Engineering - Chapters 1 to 5, 13 and 14Chris Fregly (O'Reilly) · required

    Use Chapter 1 for goodput and reproducibility, Chapters 2 to 5 for topology, orchestration, communication, storage and the data pipeline, Chapter 13 for PyTorch profiling and scaling, and the Chapter 14 sections on graph breaks and recompilation. Run only the companion labs for the bottleneck you observe, preserve workload correctness and record hardware assumptions.

  • How to Scale Your Model - Chapters 1, 5, 9 and 12Google DeepMind · required

    Use rooflines, training cost models, profiling workflow and GPU topology to predict the dominant limit of one run. Compare the prediction with a trace and quantify the residual before proposing a change.

Also in this section

  • Machine Learning Engineering Open Book - Network, Debug, Training Performance and OrchestrationStas Bekman · required

    Use network/debug/README.md, the hang, crash and OOM sections of debug/pytorch.md, training/performance/README.md, storage/README.md and orchestration/slurm/users.md as an incident-driven reference. Build one symptom-to-evidence-to-cause runbook rather than reading every page.

  • PyTorch Flight Recorder TutorialsPyTorch · support

    Read the environment-variable Flight Recorder tutorial (trace buffer, dump on timeout, fr_trace analysis), then the newer tutorial at https://docs.pytorch.org/tutorials/intermediate/debug_hangs_with_flight_recorder.html, which needs torchcomms and can run on CPU with Gloo. Diagnose one injected hang from per-rank dumps.

  • MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUsJiang et al. (NSDI 2024) · support

    Read the efficiency optimizations, the fault-tolerance loop (heartbeats, diagnostics, fast restart) and the straggler and diagnosis tooling. Its MFU and scale numbers are its own cluster's results.

  • Revisiting Reliability in Large-Scale Machine Learning Research ClustersKokolis et al. (2024) · support

    Read the failure taxonomy, mean time to failure versus job size and the scheduler-side metrics. Use them to model goodput with failures for one job size.

  • CS336 Assignment 2 (Spring 2026) - Profiling and Parallelism AnalysisStanford University · required

    Revisit Section 2 profiling and Section 8 communication analysis. Produce warmup-controlled timing, Nsight or PyTorch traces, memory evidence and analytic DP, FSDP, TP and 2D comparisons on configurations you can execute honestly.

  • Ultra-Scale Playbook - Benchmarking ConfigurationsHugging Face · support

    Study the configuration-search experiments and Lessons learned on benchmarking as method. Its heatmaps are its own H100 cluster's results; reproduce the method on a tiny legal search space, separating analytic predictions, simulations and measurements.

  • TorchTitanPyTorch · depth

    Read docs/debugging.md (memory snapshots, fake-backend modes, Flight Recorder dumps) and the CPU unit tests under tests/unit_tests/cpu/, then the configuration, metrics, profiling, checkpoint and parallelization seams at a pinned commit. Select one bounded issue or measurable improvement and follow the contribution standards; do not attempt a wholesale rewrite.

  • Distributed Training Systems LaboratoryRoadmap-Final · support

    Complete the capstone with a fixed workload, correctness oracle, analytic plan, fault campaign, aligned traces and one real-code extension. Label CPU simulation, single-GPU evidence and multi-GPU evidence separately.