Unit 1 of 9 · about 4 hours · explain, measure
Interconnects and topology: PCIe, NVLink, NVSwitch and RDMA
Every collective time in this section is bytes divided by the slowest link on its path plus latency. A wrong topology picture makes every later model wrong.
You'll be able to
- Explain how PCIe, NVLink and NVSwitch paths differ in bandwidth, latency and CPU involvement, and where RDMA removes the CPU from the path.
- Predict which hop bounds a stated exchange from a topology dump, and state the directional bandwidth assumption behind the prediction.
- Detect a silent fallback from GPUDirect RDMA to TCP sockets from logs and module checks.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Scale-up fabric: NVLink and NVSwitchAI Systems Performance Engineering - Chapters 4, 15, 17 and 18
Chapter 2, NVLink and NVSwitch
- RDMA, NICs and multinode connectivityAI Systems Performance Engineering - Chapters 4, 15, 17 and 18
Chapter 4, High-Speed, Low-Overhead Data Transfers with RDMA; Tuning Multinode Connectivity; Multinode Communication Pitfalls
- Topology detection and peer accessNCCL
Topology detection and GPU-to-GPU communication: confirm peer access before trusting any bandwidth number
- Recording the topology NCCL sawNCCL
NCCL_TOPO_DUMP_FILE and NCCL_TOPO_FILE: dump the detected graph with every measurement
Focus on
- Bandwidth numbers are directional unless stated otherwise. An 800 Gb/s NIC is 100 GB/s of line rate in one direction before headers and congestion, and a Gen4 x16 link is about 32 GB/s per direction from lane arithmetic.
- The book's hierarchy example (two NVLink pairs joined by PCIe) reduces on the fast pairs first so the slow link carries only a fraction of the data. Sketch which exchange crosses PCIe before running anything.
- GPUDirect RDMA lets the NIC read and write GPU memory without CPU copies. A container without InfiniBand devices or with mismatched GIDs silently falls back to TCP sockets, which run far below the RDMA rate on the same fabric. Confirm
NET/IBrather than sockets in the log before quoting any rate. - A Blackwell GPU advertises about 1.8 TB/s of NVLink aggregate across 18 links, which is bidirectional aggregate or 900 GB/s per direction. Per-direction phrasing of 100 GB/s per link contradicts that aggregate; use the aggregate and halve it.
Common mistakes · 3
- Quoting 1.8 TB/s as per-direction NVLink bandwidth. It is bidirectional aggregate; per-direction peaks are half that, and sustained rates are lower under imbalance.
- Assuming x16 width. A link negotiated at x8 has half the bandwidth of the same generation at x16, and links drop to a lower generation when idle. Read both under load with
nvidia-smi --query-gpu=pcie.link.gen.current,pcie.link.width.current --format=csv; an RTX 3050 6 GB desktop board reported Gen4 x8 under a copy load and Gen1 when idle. - Trusting a bandwidth number while the path fell back to TCP. Check
NCCL_DEBUG=INFOforNET/IBversus sockets andlsmod | grep nvidia_peermemfor the peer-memory module.
Try it yourself
Closed-book, before checking anything
nvidia-smi topo -m on your hardware and label each GPU pair with its path.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.GPUs 0-1 share NVLink, 2-3 share NVLink, and only PCIe joins the pairs. Where does a hierarchical all-reduce put most bytes?Answer
On the two NVLink pairs first, then one exchange across PCIe per pair, then redistribution inside each pair. The slow link handles a fraction of the data rather than every byte.
2.What line rate in GB/s does an 800 Gb/s link imply, and why is it not a measurement?Answer
800 divided by 8 is 100 GB/s of line rate. Headers, encoding, congestion and software overheads sit below it, so sustained goodput needs a measurement.
3.Which two checks expose a silent RDMA-to-TCP fallback?Answer
NCCL_DEBUG=INFOshowing socket transport instead ofNET/IBpaths, and a missing peer-memory module underlsmod | grep nvidia_peermem. Either one invalidates the RDMA bandwidth assumption.4.A Gen4 x16 link is quoted at 64 GB/s. Is that per direction?Answer
No. Lane arithmetic gives about 32 GB/s per direction (16 lanes at 16 GT/s with 128b/130b encoding). 64 GB/s is the bidirectional sum.
Practice
- AI Systems companion code ch04: PCIe staging and topology bring-up probes
Run
baseline_pcie_staging.pywith its optimized pair plusnccl_benchmark.pyon compatible single-host paths; recordnvidia-smi topo -mandNCCL_TOPO_DUMP_FILEMark NVLink-only and multi-GPU-only paths as explicit blockers with the dump attached; do not report fallback timings as link rates.
You're done when
Your sketch predicts the slow hop before you run, the dump confirms the path, and you can state every quoted rate as per-direction or bidirectional with its assumption.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 11 more in the section
- AI Systems Performance Engineering - Chapters 4, 15, 17 and 18Chris Fregly · primary
Read Chapter 4 on distributed networking communication, the parallelism parts of Chapter 15, and Chapters 17 and 18 on disaggregated prefill and decode and KV-cache transfer. Re-derive every volume and crossover for the hardware you actually have.
- NCCLNVIDIA · required
Study the collective API, communicator and topology behavior, then run a bounded nccl-tests message-size sweep when multiple GPUs are available. Correlate algorithm bandwidth, bus bandwidth and rank timelines with the - model.
Also in this section
- AI Systems Performance Engineering companion code - Chapters 4, 15 and 17Chris Fregly · support
Use compatible examples from
code/ch04,code/ch15andcode/ch17for NCCL, topology, overlap and disaggregated inference. Run preflight checks, lock and record clocks through the harness, and mark unsupported transport or topology paths as explicit blockers. - AI Performance Engineering - Distributed InferenceWafer · reference
A curated index. Use Section 5 only to find primary papers for a communication mechanism you are measuring.
- UCSD CSE 291A/DSC 291 (Spring 2026) PA2 Part 2 - Tensor Parallel CommunicationUC San Diego · required
Build all-reduce and all-to-all from point-to-point MPI calls (Section 2.1), then the data split, layer initialization and naive model-parallel forward and backward communication (Sections 2.2 to 2.5) against the provided
mpi-test.pycases and pytest files. It runs on CPU processes with Open MPI andmpi4py. - CS336 Assignment 2 - Section 8.1 Communication PrimitivesStanford University · support
Work
alternate_ring_all_reduceand the communication-volume reasoning in Section 8.1 as a written check on your cost model. - TensorTonic Language Modeling from Scratch - collective problemsTensorTonic · support
Solve Simulate Distributed Collectives, Calculate Collective Effective Bandwidth, Synchronize Data-Parallel Gradients and Reconstruct a Column-Parallel MLP Layer after the collective units.
- GPU MODE - Collective CommunicationGPU MODE · support
Use Lectures 17, 67, 70 and 78 for NCCL, NVSHMEM, fault-tolerant collectives and multi-GPU Triton. Implement or inspect one communication mechanism only after the volume and topology model is written.
- DistServeDistServe Authors · required
Study prefill-decode interference, phase-specific parallelism and goodput optimization. Build a small simulator or measured two-pool experiment and test the key-value transfer crossover rather than reproducing the complete serving system.
- NVIDIA Inference Xfer LibraryNVIDIA · support
Inspect memory registration, transfer backends and metadata APIs as the state-movement layer for disaggregation. Run only supported local transports and compare measured transfer setup and steady-state cost with the model.
- DeepEPDeepSeek · depth
Reconstruct expert dispatch and combine paths, low-latency versus high-throughput modes and hardware assumptions. Test a small supported path only after a standard collective baseline and load-skew model exist.
- Splitwise: Efficient Generative LLM Inference Using Phase SplittingMicrosoft Research · support
Read arXiv:2311.18677v2 (ISCA 2024) for the phase characterization and the homogeneous and heterogeneous cluster designs. Test the throughput, cost and power claims as hardware-specific results, and compare its placement with DistServe on your workload.
- Mooncake: Trading More Storage for Less ComputationUSENIX FAST 25 · support
Study the KVCache-centric disaggregated architecture, the global cache with its transfer engine, and the prefill scheduling with early rejection. Test the effective-capacity claims as trace-specific results.