Maps to: Stanford CS 217 Hardware Accelerators for Machine Learning (Winter 2026), Lecture 8 · Thu 01/29/2026 · Interconnects and Network-on-Chip. HW2 is out. Lab 4 (the accelerator top level with its interconnect) is the block of §6. Reading (from the schedule):
- N. Enright Jerger, A. Kannan, Z. Li, G. Loh, NoC architectures for silicon interposer systems, MICRO 2014;
- E. Qin, A. Samajdar, H. Kwon, V. Nadella, S. Srinivasan, D. Das, B. Kaul, T. Krishna, SIGMA: a sparse and irregular GEMM accelerator with flexible interconnects for DNN training, HPCA 2020;
- A. Li, S. L. Song, J. Chen, J. Li, X. Liu, N. Tallent, K. Barker, Evaluating modern GPU interconnect: PCIe, NVLink, NV-SLI, NVSwitch and GPUDirect, IEEE TPDS 2020.
Basis: The slides are not public. This lecture follows the session title, the three readings, and standard texts on interconnection networks (Dally & Towles; Jerger, Krishna & Peh). Architecture facts are taken from those sources and labelled. The experiments use models written for these notes:
- a cycle-level mesh NoC (
noc.py);- topology formulas, a Benes network routed by the looping algorithm, and a SIGMA-style fabric model (
fabrics.py);- the course’s toy accelerator, which connects Lecture 5’s systolic arrays and Lecture 6’s vector units through this lecture’s NoC (
toy_accel.py).The experiments do not reflect what was said in class. Code:
code/lecture08/(4 scripts + 3 modules; the NoC sweeps take ~19 s, the rest ~1–3 s) Reading time: 3–4 hours including running the code
0. How to read this lecture
0.1 Learning goals
After this lecture you should be able to:
- Name the communication patterns of ML accelerators — multicast of weights and activations, reduction of partial sums, unicast of tiles, permutations for sparse data — and say which fabric serves each.
- Compare topologies (bus, ring, mesh, torus, trees, crossbar, butterfly, Benes) by cost (links, crosspoints) and capability (bisection, diameter, average hops, uniform-traffic bound).
- Explain how a router works: input buffers, credit-based flow control, virtual cut-through, routing, switch allocation. Compute zero-load latency and the saturation bound of a mesh.
- Explain deadlock in a network, and how dimension-order routing and the turn model avoid it.
- Explain why a Benes network can route any permutation while a butterfly cannot, and what SIGMA’s flexible distribution and reduction networks buy for sparse and irregular GEMMs — and what they cost.
- Find the bottleneck of an accelerator from its blocks’ rates (DRAM, NoC, arrays, vector units), and explain why prefill and decode want different designs.
- Estimate chip-to-chip collective times over PCIe and NVLink, and tell bandwidth-bound from latency-bound communication.
0.2 Prerequisites and scope
| Assumed | Introduced here | Developed later |
|---|---|---|
| Lecture 2: ready/valid channels, back-pressure, deadlock from full FIFOs | routers, credits, virtual cut-through, routing, deadlock in networks | GPU interconnects inside an SM cluster (L11) |
| Lecture 5: systolic arrays, multicast along rows | topologies, permutation networks, multicast/reduction trees | spatial dataflow fabrics (L12–13) |
| Lecture 6: vector units; Lecture 7: global buffer, DRAM | SIGMA’s flexible fabrics; the toy accelerator end to end | mapping onto the fabric (L9) |
| Lecture 1: roofline, bandwidth | chip-to-chip links and all-reduce | multi-chip systems (L16–17) |
0.3 Map
§1 communication patterns of ML; why the interconnect matters
§2 topologies by the numbers; permutation networks (butterfly, Benes) ← code 01 (Parts 1-2)
§3 routers: buffers, credits, flow control, routing, deadlock ← code 02 (Parts 2-3)
§4 performance: zero-load latency, saturation, patterns, chiplets ← code 02 (Parts 1, 4)
§5 flexible fabrics for ML: multicast and reduction trees, SIGMA ← code 01 (Part 3), code 03
§6 the toy accelerator end to end (Lab 4) ← code 04 (Parts 1-3)
§7 beyond one chip: PCIe, NVLink, all-reduce ← code 04 (Part 4)
§8 summary §9 pitfalls §10 exercises §11 further reading §12 next lecture
0.4 Notation
| Symbol | Meaning |
|---|---|
| , | nodes; a mesh has |
| flit | flow-control unit: what a link carries per cycle (here one flit = one cycle) |
| packet | a message of flits; the head carries the route |
| hop | one router-to-router link |
| bisection | links cut by the best cut into two equal halves (one direction) |
| zero-load latency | latency of a packet in an otherwise empty network |
| saturation | offered load at which latency grows without bound |
| VCT | virtual cut-through: a packet may advance if the next buffer can hold all of it |
1. Why the interconnect matters
1.1 Intuition: a city’s roads
A city with excellent factories (PE arrays) and warehouses (buffers) still stalls if the roads between them are narrow, all lead through one square, or jam in a gridlock where every car waits for the one in front. An accelerator’s interconnect is its road system. Its design decides latency, the traffic it can carry (bandwidth), and whether traffic can lock up (deadlock).
1.2 The communication patterns of ML
| Pattern | Example | What serves it |
|---|---|---|
| multicast / broadcast | the same weight tile to every PE row; the same activations to every core (§6) | buses, trees, systolic forwarding (L5), multicast routers |
| reduction | partial sums of a split-K GEMM into one output (L7 §6.2) | adder trees, systolic accumulation, in-network reduction |
| unicast | a tile from the global buffer to one core; results back | mesh NoC |
| permutation / gather | a sparse layer’s non-zero weights each need a different input | crossbars, Benes networks (SIGMA) |
| all-reduce / all-to-all across chips | data-parallel gradients; tensor-parallel activations; MoE token routing | PCIe, NVLink/NVSwitch, optical circuit switches (TPU v4) |
Systolic arrays (Lecture 5) solve multicast and reduction inside the matrix unit with neighbour-to-neighbour wires. The NoC handles everything between units. Wires cost energy: in Eyeriss’s accounting, a hop across the PE array costs about 2× a MAC and a global-buffer access 6×. The pattern a dataflow creates (Lecture 9) therefore decides the network it needs.
2. Topologies
2.1 The metrics
- Links and switch crosspoints measure cost (a radix- router is roughly an crossbar).
- Diameter and average hops set the latency.
- Bisection bandwidth sets the throughput for global traffic. Under uniform random traffic half of all packets cross the bisection, half of them in each direction, so the offered load per node is bounded by flits per cycle, where is the bisection in links.
Script 01, Part 1 (fabrics.topologies):
| N = 64 | Links | Crosspoints | Bisection | Diameter | Avg hops | Uniform bound |
|---|---|---|---|---|---|---|
| bus | 1 | 64 | 1 | 1 | 1.00 | 0.016 |
| ring | 64 | 576 | 2 | 32 | 16.25 | 0.125 |
| mesh 8×8 | 112 | 1,600 | 8 | 14 | 5.33 | 0.500 |
| torus 8×8 | 128 | 1,600 | 16 | 8 | 4.06 | 1.000 |
| binary tree | 126 | 567 | 1 | 12 | 10.19 | 0.062 |
| fat tree (full bisection) | 384 | 3,072 | 32 | 12 | 10.19 | 1.000 |
| crossbar | 64 | 4,096 | 32 | 1 | 1.00 | 1.000 |
At the mesh’s bound halves (0.25) and its average path doubles (10.7 hops); the crossbar’s crosspoints grow to 65,536. The mesh is the default NoC because it has:
- radix-5 routers;
- only short, local wires that tile with the chip;
- a cost that grows linearly with N.
Its weakness — a bisection that grows only as — matters for uniform traffic, which ML rarely produces. Its traffic is mostly local or broadcast, and the compiler can place it (Lecture 9).
2.2 Permutation networks: butterfly and Benes
To send each of N inputs to a different output in one pass — a permutation — a crossbar needs crosspoints.
- A butterfly needs only stages of N/2 2×2 switches, but has exactly one path per input–output pair. Two connections that need the same link conflict, so the butterfly is blocking.
- A Benes network is a butterfly followed by its mirror image: stages. The extra stages give every connection a choice, and Benes proved that every permutation can be routed without conflicts (it is rearrangeably non-blocking).
The looping algorithm (fabrics.benes_route) finds the switch settings recursively:
- The two inputs of each input switch must go to different subnetworks (upper or lower). So must the two outputs of each output switch.
- These constraints form cycles of even length, so the connections can be 2-coloured: colour = subnetwork.
- Each subnetwork then routes a half-size permutation, recursively.
Script 01, Part 2 routes random permutations:
| N | Crossbar crosspoints | Butterfly: conflict-free | Benes crosspoints | Benes: routed |
|---|---|---|---|---|
| 8 | 64 | 10% | 80 | 100% |
| 64 | 4,096 | 0% | 1,408 | 100% |
| 1,024 | 1,048,576 | 0% | 38,912 | 100% |
A Benes network delivers any permutation at ~4% of a crossbar’s crosspoints for N = 1,024. That is why SIGMA uses one to give every multiplier its own operand (§5.2). The catch: routing needs the whole permutation in advance — fine when the compiler knows the sparsity pattern, impossible for unpredictable traffic.
3. Routers
3.1 The router and its pipeline
A mesh router has five ports (N, E, S, W and Local). In noc.py:
- A packet’s head arrives in an input buffer (8 flits per port by default).
- Routing chooses the output port(s) toward the destination.
- Switch allocation: each free output port picks one requesting input buffer by round-robin, and only the head packet of each buffer can compete (head-of-line blocking).
- The packet traverses the switch and the link, one flit per cycle.
Router and link each take one cycle, so a packet spends 2 cycles per hop, plus cycles to serialize its flits.
3.2 Flow control and credits
A sender must not overflow the receiver’s buffer. With credit-based flow control the sender keeps a counter of free slots downstream. It spends credits when it sends; the receiver returns them when the flits leave its buffer. Lecture 2’s ready/valid channels are the single-cycle version of the same idea. Three granularities exist:
- store-and-forward: wait for the whole packet before forwarding (latency × packet length per hop);
- virtual cut-through (VCT, used here): forward the head as soon as the next buffer has room for the whole packet;
- wormhole: forward flit by flit, with buffers smaller than a packet. A blocked packet then spans several routers.
Because credits return only when flits leave, a buffer that holds just one packet throttles its link. Script 02, Part 2 (uniform traffic):
| Packet flits | Buffer flits | Latency @ 0.05 | @ 0.25 | Accepted @ 0.35 |
|---|---|---|---|---|
| 1 | 8 | 12.7 | 14 | 0.36 |
| 4 | 4 | 17.3 | 365 (sat.) | 0.16 |
| 4 | 8 | 16.2 | 23 | 0.31 |
| 4 | 16 | 16.2 | 22 | 0.34 |
| 8 | 8 | 22.7 | 197 (sat.) | 0.21 |
One-packet buffers halve the capacity (0.16 vs 0.31). Larger packets add serialization (8 flits: +6.5 cycles at low load) and need deeper buffers.
3.3 Routing and deadlock
- Dimension-order (XY): go along X until the column matches, then along Y. It is deterministic, simple, and deadlock-free on a mesh.
- Adaptive: any productive direction, preferring the less congested one (most credits). It spreads load around hotspots.
- Deadlock: four packets, each holding a buffer and waiting for the buffer held by the next, in a cycle — none can ever move. In a mesh a cycle needs packets turning in all four directions.
XY routing never turns from Y back to X, so it can never close such a cycle. Glass and Ni’s turn model forbids just enough turns to break every cycle. West-first routing forbids the turns into west: a packet goes west first if it needs to, then adapts among the other directions. Virtual channels (several buffers per port) offer another escape, used for tori and adaptive routing. Script 02, Part 3:
| Routing | Transpose @ 0.1 | @ 0.2 | @ 0.3 | Uniform @ 0.3, one-packet buffers |
|---|---|---|---|---|
| XY | 19 | 123 (sat.) | 347 (sat.) | 514 cycles |
| west-first | 19 | 68 (sat.) | 181 (sat.) | 871 cycles |
| fully adaptive | 18 | 19 | 23 | deadlock |
On transpose traffic — , where XY funnels each column’s packets through a few links — adaptive routing is still unsaturated at 0.3 while XY saturates. But with one-packet buffers, fully adaptive routing deadlocks on uniform traffic: the simulator detects packets in flight and no movement for 2,000 cycles. With two-packet buffers it did not deadlock in our runs. Deep buffers make deadlock rarer, not impossible: only a routing restriction (or virtual channels) rules it out.
4. Performance: latency vs load
4.1 Zero-load latency and saturation
For an 8 × 8 mesh with uniform traffic, hops and 4-flit packets give cycles. As load rises, packets wait in buffers, and at saturation the queues grow without bound. Script 02, Part 1 (8 × 8, XY, 4-flit packets; mean latency in cycles):
| Pattern | Zero-load | 0.05 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | Max accepted |
|---|---|---|---|---|---|---|---|---|
| uniform | 15.7 | 16 | 17 | 20 | 48 (sat.) | 208 | 400 | 0.31 |
| transpose | 17.0 | 18 | 19 | 123 (sat.) | 347 | 548 | 640 | 0.20 |
| hotspot (20% to one node) | 15.4 | 16 | 174 (sat.) | 788 | 817 | 852 | 891 | 0.08 |
| neighbour (one hop east) | 8.6 | 9 | 9 | 9 | 9 | 9 | 10 | 0.50 |
- Uniform traffic saturates at 0.31 flits/node/cycle, 61% of the bisection bound (0.50). The rest is lost to head-of-line blocking and imperfect allocation. The fraction is 52% for a 4 × 4 mesh and 57% for 6 × 6, measured with
noc.saturation(Exercise 12). - Hotspot traffic is limited by one node’s ejection port: , exactly what the simulation finds.
- Neighbour traffic never saturates in this range: locality is worth more than any router optimization.
4.2 Chiplets and interposers
Large accelerators are increasingly built from chiplets on a silicon interposer or package substrate. Links that cross a chiplet boundary are longer and may be narrower or slower. Jerger et al. (MICRO 2014) study how to use the interposer’s own wiring as an additional network layer. Script 02, Part 4 splits the 8 × 8 mesh into four 4 × 4 chiplets and slows the boundary links:
| Design | Uniform @ 0.05 | @ 0.2 | @ 0.3 | Neighbour @ 0.3 |
|---|---|---|---|---|
| monolithic | 16 | 20 | 48 | 9.0 |
| boundary links +4 cycles | 20 | 27 | 143 (sat.) | 10.1 |
| +4 cycles, half bandwidth | 21 | 81 (sat.) | 341 (sat.) | 11.0 |
Only 16 links are slow, but they are the bisection, and uniform traffic crosses them half the time. Traffic that stays within a chiplet hardly notices. Multi-chiplet accelerators therefore place heavy communication inside chiplets, and make the interposer links wide.
5. Flexible fabrics for ML
5.1 Multicast and reduction trees
Broadcasting a tile from one node to all others by unicast sends N − 1 copies through the source’s single injection port. A multicast tree — routers replicate the packet along an XY spanning tree — sends one copy over each tree link. Script 01, Part 3 (source at the mesh center):
| Mesh | Tile flits | Unicast cycles | Tree cycles | Speedup | Unicast link-flits | Tree link-flits |
|---|---|---|---|---|---|---|
| 4×4 | 64 | 968 | 72 | 13× | 2,048 | 960 |
| 8×8 | 512 | 32,272 | 528 | 61× | 131,072 | 32,256 |
The cycle-level mesh confirms the unicast case (965 cycles vs 968 by formula for the 4 × 4, 64-flit case). Reduction is the mirror image: gathering partial sums into one node serializes at its ejection port, while adding them in the routers along a tree takes one pass. Because broadcasts and reductions are everywhere in ML, routers that multicast and reduce pay for themselves.
5.2 SIGMA: flexible distribution and reduction
A rigid systolic array spends a PE on every weight, zero or not, and pads shapes that do not fill it (Lecture 5). SIGMA (Qin et al., HPCA 2020) instead treats its multipliers as a flat pool:
- stationary non-zeros: only the non-zero weights are loaded, packed so that each output column’s non-zeros sit next to each other;
- a Benes distribution network delivers to every multiplier the input element its weight needs, multicasting shared inputs;
- a forwarding adder network (FAN) sums each column’s group, whatever its size.
A plain binary adder tree can only reduce aligned power-of-two groups. The FAN forwards partial sums across group boundaries and reduces any mix of contiguous groups in levels. Script 03, Part 1 (group sizes from the columns of random sparse 256 × 256 weights; segmented_reduce matches numpy):
| Density | Mean group | Values | Plain-tree slots (padded) | Plain-tree efficiency | FAN levels |
|---|---|---|---|---|---|
| 50% | 128.7 | 32,955 | 49,408 | 67% | 8 |
| 20% | 50.8 | 13,004 | 16,640 | 78% | 7 |
| 5% | 13.0 | 3,331 | 4,588 | 73% | 5 |
Script 03, Part 2 compares a rigid 128 × 128 weight-stationary array with a flexible 16,384-multiplier engine on the same layers:
| Layer | Density | Rigid utilization | Flexible utilization | Speedup |
|---|---|---|---|---|
| prefill 2048×4096×4096 | 100% | 1.000 | 1.000 | 1.0× |
| 10% | 0.100 | 0.995 | 9.9× | |
| decode 64×4096×4096 | 100% | 0.499 | 1.000 | 2.0× |
| 10% | 0.050 | 0.990 | 19.9× | |
| depthwise-like 1024×9×64 | 100% | 0.026 | 0.554 | 22× |
The flexible engine replicates its stationary set when it is smaller than the pool, so a few non-zeros still fill the multipliers. Flexibility pays on sparse and oddly shaped layers and costs nothing in utilization on dense, regular ones.
5.3 What flexibility costs
Script 03, Part 3:
| Design | Distribution switches | Reduction | Input elements per cycle |
|---|---|---|---|
| rigid 128 × 128 array | 0 (neighbour links) | systolic accumulation | 128 |
| one 16,384-port Benes + FAN | 221,184 | 16,383 adders + forwarding links | up to 4,096 distinct |
| 128 blocks of 128 (SIGMA’s Flex-DPE style) | 106,496 | 16,256 adders | up to 4,096 distinct |
A systolic array reads 128 inputs per cycle and reuses each along a row of PEs for free. The flexible engine must deliver a different input to each group of multipliers every cycle: wider buffer reads and a large distribution network, both paid in area and energy. SIGMA’s argument is that for sparse, irregular training workloads the utilization gain outweighs this cost. For dense, regular inference GEMMs, a systolic array remains simpler and cheaper.
6. The toy accelerator end to end (Lab 4)
6.1 Assembly
toy_accel.py connects the course’s blocks:
- a mesh NoC;
- one or more global-buffer slices (each injecting one flit per cycle into the network);
- cores, each with a weight-stationary systolic array (Lecture 5) and a vector unit (Lecture 6);
- DRAM behind the buffer (Lecture 7).
A layer is split by output columns across the cores. Each core needs its own weight columns (unicast), and all of X — the same activations go to every core. That broadcast is sent either as unicast copies or as one multicast tree.
6.2 A functional run
Script 04, Part 1 runs a small layer with every block’s own simulator:
- the NoC replays every packet (
noc.run_trace); - each core’s array computes its columns cycle by cycle in integers (
systolic.simulate); - each core’s vector unit applies GELU (
vector_unit.run).
| Layer | Error vs numpy | NoC: replay / bound | Arrays: sim / formula | Vector units: sim / steady state |
|---|---|---|---|---|
| 32×48×64 | 4.7e-8 | 965 / 960 | 214 / 214 | 235 / 96 |
| 64×64×128 | 3.2e-8 | 2,565 / 2,560 | 1,046 / 1,046 | 575 / 384 |
The assembled machine computes the right answer, and the data movement dominates. Eight copies of X leave through the buffer’s one port. The vector units run well above their steady state because each output column (32–64 elements) is a short row (Lecture 6 §4.5).
6.3 Checking the NoC model
For large layers we cannot replay every packet, so estimate_layer uses the busiest port: the maximum flits any link, injection port or ejection port must carry. Script 04, Part 2 checks it:
| Accelerator | Layer | Replay | Bound | Ratio |
|---|---|---|---|---|
| 1 slice + 15 cores | 64×256×512 | 11,785 | 11,776 | 1.00 |
| 4 slices + 12 cores | 64×256×512 | 4,360 | 2,560 | 1.70 |
| 4 slices + 12 cores | 128×512×512 | 17,500 | 8,192 | 2.14 |
The bound is exact when one port carries most of the traffic. When several slices inject at once, their packets block each other in the routers, and the real time is up to 2× the bound. Analytical models need a simulation to calibrate them.
6.4 Bottlenecks: prefill vs decode
Script 04, Part 3 compares accelerators on a 4 × 4 mesh at 1 GHz, with 64 × 64 arrays and DRAM at 512 B/cycle, reporting the busiest resource:
| Layer | Accelerator | DRAM | NoC | Arrays | Layer time |
|---|---|---|---|---|---|
| MLP up, prefill 2,048 | 1 slice + 15 cores, unicast | 377 µs | 5.77 ms | 1.97 ms | 5.77 ms |
| 1 slice, multicast | 377 µs | 2.10 ms | 1.97 ms | 2.10 ms | |
| 2 slices + 14 cores, multicast | 377 µs | 1.05 ms | 2.10 ms | 2.10 ms | |
| 4 slices + 12 cores, multicast | 377 µs | 590 µs | 2.49 ms | 2.49 ms | |
| MLP up, decode batch 16 | 1 slice, multicast | 231 µs | 1.84 ms | 62 µs | 1.84 ms |
| 2 slices, multicast | 231 µs | 919 µs | 66 µs | 919 µs | |
| 4 slices, multicast | 231 µs | 460 µs | 78 µs | 460 µs |
- Prefill reuses every weight 2,048 times. Once multicast stops X from being sent 15 times, NoC and arrays balance (2.1 ms). Converting cores into buffer slices then only removes compute (2.49 ms with 4 slices).
- Decode uses every weight byte only 16 times, so each byte’s trip across the NoC dominates. The buffer’s injection bandwidth sets the speed, and every extra slice helps (1.84 → 0.46 ms).
- The two phases want different machines. Whatever the mix, the on-chip path from DRAM to the cores (64 B/cycle per slice here) should be at least as wide as the DRAM (512 B/cycle). Otherwise the NoC, not memory, is the decode bottleneck. Lecture 13’s SambaNova and Lecture 16’s Trainium make this trade-off explicitly.
7. Beyond one chip
7.1 Links
When a model spans several chips, chip-to-chip links become the interconnect. Per-direction bandwidths from the public specifications:
| Link | GB/s per direction |
|---|---|
| PCIe 3.0 / 4.0 / 5.0 × 16 | 16 / 32 / 64 |
| NVLink 2 (V100, 6 links) | 150 |
| NVLink 3 (A100, 12 links) | 300 |
| NVLink 4 (H100, 18 links) | 450 |
Li et al. (TPDS 2020) measured PCIe, NVLink, NV-SLI and NVSwitch systems and found several effects:
- achieved bandwidth falls short of these nominal numbers;
- it depends strongly on the topology — which GPUs share a PCIe switch, which have direct NVLinks (the DGX-1’s hybrid cube-mesh is not all-to-all), or whether an NVSwitch connects everyone;
- the communication library must route collectives around it.
7.2 All-reduce: bandwidth vs latency
A ring all-reduce over P devices takes steps of bytes each: time ≈ . Script 04, Part 4 (8 devices, = 2 µs per step, assumed):
| Link | 16 GB of gradients (data parallel) | 8 KiB per decode layer (tensor parallel) | 16 MiB per prefill layer |
|---|---|---|---|
| PCIe 3.0 | 1.75 s | 28.9 µs | 1.86 ms |
| PCIe 5.0 | 438 ms | 28.2 µs | 487 µs |
| NVLink 4 | 62.3 ms | 28.0 µs | 93.2 µs |
Large messages (gradient synchronization in training) are bandwidth-bound, and the link matters 28× between PCIe 3.0 and NVLink 4. A decode step’s small all-reduces are latency-bound: ~28 µs each on any link. With two per layer (after attention and after the MLP) over 32 layers, that is ~1.8 ms per token. That is why tensor parallelism across slow links hurts LLM inference, and why NVSwitch domains, TPU optical circuit switches and low-latency collectives matter.
8. Summary
- ML communicates in multicast, reduction, unicast and permutation patterns. Systolic arrays handle the first two inside the matrix unit; the NoC handles the rest.
- The mesh is the default NoC: radix-5 routers, short wires, linear cost. Its bisection grows only as √N (uniform bound 0.50 at 64 nodes, 0.25 at 256).
- A butterfly blocks on almost every permutation. A Benes network routes any permutation, using the looping algorithm, with ~4% of a crossbar’s crosspoints at N = 1,024.
- Routers buffer, route, allocate and forward. Credits prevent overflow. One-packet buffers halve throughput.
- Deadlock is a cycle of full buffers. XY and turn-model routing rule it out; fully adaptive routing deadlocked with one-packet buffers.
- Latency = zero-load (, ~16 cycles for 8 × 8) + queueing. Uniform traffic saturates at 61% of the bisection bound, a hotspot at its ejection port, neighbour traffic not at all.
- Slow chiplet boundaries cut the bisection: locality decides whether they matter.
- Multicast trees beat unicast broadcast 13–61×.
- SIGMA’s Benes + forwarding adder network keeps multipliers busy on sparse and irregular GEMMs (9.9× at 10% density, 22× on a K = 9 layer). It pays with large distribution networks and operand bandwidth.
- In the toy accelerator, the slowest resource sets the layer time. Prefill needs multicast and compute; decode needs buffer-to-core bandwidth at least as wide as DRAM. The busiest-port model is exact for one source and up to 2× optimistic for several.
- Between chips, gradient all-reduces are bandwidth-bound (1.75 s on PCIe 3.0 vs 62 ms on NVLink 4 for 16 GB). Decode all-reduces are latency-bound (~28 µs each on any link).
9. Common pitfalls
- “Peak link bandwidth × links = network throughput.” Uniform traffic saturates at ~60% of the bisection bound; hotspots at one port (§4.1).
- “Bigger buffers prevent deadlock.” They make it rarer. Only routing restrictions or virtual channels prevent it (§3.3).
- “Adaptive routing is always better.” It wins on adversarial patterns but needs deadlock avoidance, and can lose with shallow buffers (§3.3).
- “Broadcast = N unicasts.” That serializes at the source; multicast trees are 13–61× faster (§5.1).
- “Flexible fabrics are free utilization.” They cost switches and operand bandwidth (§5.3).
- “An analytical NoC bound is the NoC time.” Only when one port dominates (§6.3).
- “NVLink makes tensor parallelism cheap.” Not for small, latency-bound messages (§7.2).
10. Exercises
Exercise 1 (zero-load latency). Compute the zero-load latency of an 8 × 8 mesh under uniform traffic with 1-cycle routers and links and 4-flit packets. What changes with 8-flit packets? With 2-cycle routers?
Answer
cycles (script 02: 15.7). 8-flit packets: +4 → 19.7 (measured 22.7 at load 0.05 with 8-flit buffers: queueing already adds a little). 2-cycle routers: — per-hop delay matters most on large meshes, which is why routers are pipelined aggressively and why express links exist.
Exercise 2 (bisection bound). Derive for uniform traffic and apply it to an 8 × 8 mesh and torus. Why does script 02 saturate the mesh at 0.31, not 0.50?
Answer
Each node sends λ flits per cycle; a destination in the other half is chosen with probability ≈ 1/2, so flits per cycle cross the bisection, in each direction, over links: . Mesh: B = 8 → 0.5; torus: B = 16 → 1.0. The simulator reaches 61% of 0.5: XY routing does not balance load perfectly across the bisection, and head-of-line blocking (only a buffer’s first packet can compete) leaves links idle while packets wait behind blocked ones.
Exercise 3 (hotspots). In script 02, 20% of all traffic goes to one node. Derive the saturation load. How would you remove the bottleneck in an accelerator whose “hot” node is a global-buffer slice?
Answer
The hot node ejects at most 1 flit/cycle and receives (the 63 others send 20% of their traffic there): (measured 0.080). Fixes: split the buffer into several slices at different nodes (more ejection ports, §6.4); give the buffer node a wider port; or change the dataflow so fewer cores need the same data at once — multicast for reads, in-network reduction for writes.
Exercise 4 (Benes). How many stages and 2×2 switches does a 16-port Benes network have? Why does a butterfly fail for most permutations while Benes does not?
Answer
stages × 8 switches = 56 switches (224 crosspoints, vs 256 for a crossbar — at N = 16 the saving is small; it grows as N log N vs N²). A butterfly fixes each path: after stage s, a message’s row is determined by its source’s low bits and its destination’s high bits, so two messages that agree on both collide. Benes adds the mirror half: the first stages can send each connection to either subnetwork, which the looping algorithm chooses so that no two connections need the same link.
Exercise 5 (multicast). In a 4 × 4 mesh with the source at node 10, a 64-flit tile goes to all 15 other nodes. Compute the unicast and multicast times (2 cycles per hop) and the link-flits of each. Compare with script 01.
Answer
Unicast: 15 × 64 = 960 flits through the injection port, plus the farthest node’s 4 hops × 2 = 8 → 968 cycles. Multicast tree: 64 + 8 = 72 cycles. Link-flits: unicast = 64 × (sum of distances = 32) = 2,048; tree = 64 × 15 tree links = 960. Script 01 prints the same numbers.
Exercise 6 (deadlock by hand). Draw four packets in a 2 × 2 block of routers that deadlock under fully adaptive routing. Which of their turns does XY forbid? Which does west-first forbid?
Answer
Packet a at the NW router wants to go east then south; b at NE wants south then west; c at SE wants west then north; d at SW wants north then east. Each holds its router’s buffer and waits for the next router’s buffer (held by the next packet): a cycle E→S→W→N. XY forbids the Y→X turns (S→W and N→E here), so c’s and d’s routes are impossible. West-first forbids turns into west (S→W and N→W), so b’s route is impossible. Either way the cycle cannot close.
Exercise 7 (credits and buffer depth). A credit returns to the sender 1 cycle after the flit leaves the receiver’s buffer; flits take 1 cycle on the link and 1 in the router. How deep must a buffer be for a stream of single-flit packets to use the link every cycle?
Answer
A credit makes a round trip: the flit travels to the receiver (link 1 + router 1), leaves the buffer, and its credit returns (1). So a slot is busy for ~3–4 cycles per flit, and the sender needs at least that many credits to send every cycle: ≥ 4 flits. With 4-flit packets and VCT, a whole extra packet must fit, so 8 flits — consistent with script 02, where 4-flit buffers halve and 16-flit buffers barely improve on 8.
Exercise 8 (SIGMA by formula). A 10%-dense 4,096 × 4,096 weight matrix runs on 16,384 flexible multipliers with M = 2,048 rows. Estimate the folds, cycles and utilization, and the rigid 128 × 128 array’s utilization.
Answer
nnz ≈ 0.1 × 16.8 M = 1.68 M → 103 folds of 16,384; cycles ≈ 103 × 2,048 + 28 = 211 k; useful MACs = 2,048 × 1.68 M → utilization ≈ 0.99. Rigid: it processes every weight, zero or not: utilization ≈ density × dense utilization = 0.10. Speedup ≈ 9.9× (script 03).
Exercise 9 (FAN vs plain tree). Groups of sizes 3, 5, 9 and 15 (32 values) must be summed. How many slots does a plain adder tree need? How many additions and levels does the FAN use?
Answer
Plain tree: each group padded to an aligned power of two: 4 + 8 + 16 + 16 = 44 slots (73% efficiency) — and they must also be aligned, which may force a second pass. FAN: 32 slots, 32 − 4 = 28 additions, ⌈log2 32⌉ = 5 levels.
Exercise 10 (decode on the toy accelerator). Derive the NoC time of the decode MLP layer (16 × 4,096 × 14,336, bf16) with one buffer slice injecting 64 B per cycle, and with four. What does the DRAM need, and what would you change?
Answer
Weights 4,096 × 14,336 × 2 B = 117 MB → 1.835 M cycles at 64 B/cycle (plus a little X and Y): 1.84 ms at 1 GHz; four slices: 460 µs. DRAM needs 117 MB / 512 B/cycle = 230 µs. So the on-chip path is the bottleneck: give the buffer slices (or a DRAM-to-core streaming path) ≥ 512 B/cycle of total injection bandwidth, e.g. 8 slices or wider ports — at which point decode becomes DRAM-bound, as it should be.
Exercise 11 (when is an all-reduce latency-bound?). For a ring all-reduce over 8 devices with 2 µs per step and 450 GB/s links, at what message size are the bandwidth and latency terms equal? Where do a decode layer’s activations (8 KiB) and a prefill layer’s (16 MiB) fall?
Answer
MB. 8 KiB is ~900× smaller: purely latency-bound. 16 MiB is ~2× larger: bandwidth starts to matter (93 µs vs 28 µs of latency). Batching decode requests enlarges the messages and amortizes the latency.
Exercise 12 (programming: saturation vs bisection). Use noc.saturation to find the saturation throughput of uniform traffic on 4 × 4, 6 × 6 and 8 × 8 meshes (4-flit packets, 8-flit buffers), and compare with 4/k. Why is the fraction lowest for the smallest mesh?
Answer
The author’s runs: k = 4: 0.52 (bound 1.0, 52%); k = 6: 0.38 (bound 0.67, 57%); k = 8: 0.30 (bound 0.50, 61%). For a small mesh the bisection is not the binding limit: each node can inject and eject at most one flit per cycle, and head-of-line blocking at injection and in the few routers costs proportionally more. As k grows the bisection dominates and the network gets closer to its bound.
11. Further reading
- W. J. Dally, B. Towles, Principles and Practices of Interconnection Networks, Morgan Kaufmann 2004.
- N. Enright Jerger, T. Krishna, L.-S. Peh, On-Chip Networks, 2nd ed., Morgan & Claypool 2017.
- C. J. Glass, L. M. Ni, “The turn model for adaptive routing”, ISCA 1992.
- V. E. Beneš, Mathematical Theory of Connecting Networks and Telephone Traffic, 1965; D. C. Opferman, N. T. Tsao-Wu, “On a class of rearrangeable switching networks”, Bell System Technical Journal 1971 (the looping algorithm).
- N. Enright Jerger et al., “NoC architectures for silicon interposer systems”, MICRO 2014.
- E. Qin et al., “SIGMA: a sparse and irregular GEMM accelerator with flexible interconnects for DNN training”, HPCA 2020.
- A. Li et al., “Evaluating modern GPU interconnect: PCIe, NVLink, NV-SLI, NVSwitch and GPUDirect”, IEEE TPDS 2020.
- P. Patarasuk, X. Yuan, “Bandwidth optimal all-reduce algorithms for clusters of workstations”, JPDC 2009.
12. Next lecture
Lecture 9, Compilers and software stack (Part 1): dataflows and mapping, asks how a layer is placed onto all this hardware. A convolution or GEMM is a loop nest. A mapping chooses its loop order, its tiling at each memory level and its spatial unrolling over the PEs. The mapping decides the data movement — and therefore the energy and the traffic on the very networks we built here. We will describe mappings with MAESTRO’s data-centric directives, compute reuse, traffic and energy analytically, check the model against the systolic simulator of Lecture 5, and search the enormous mapspace for the best mapping of each layer.