S4 · Lesson 34 · On-chip networks
Routers, flits and flow control, zero-load latency and saturation throughput
A many-core chip's cores, cache slices and memory controllers talk over a network on the die: a mesh of routers, each joined to its neighbors by wide links. Every cache miss to a remote slice and every coherence message rides it. Its latency adds a router pipeline per hop, its throughput is capped by how much traffic can cross the chip's middle, and its buffers must cover the time it takes a credit to come back. This lesson computes all three.
- The curve is a network's average latency against the load offered per node, with a zero-load latency and saturation at ; a simple queueing shape, , captures how latency climbs near saturation.
- For a k × k mesh under uniform random traffic the bisection caps the injection rate at flits per node per cycle; a torus doubles it.
- Real networks saturate a little below the bisection limit, because routing and arbitration can't use every link every cycle.
Predict
An 8 × 8 mesh carries uniform random traffic; each link moves one flit per cycle in each direction. What is the highest injection rate per node the bisection allows?
Cutting the mesh in half severs 8 links, 8 flits per cycle each way. Half the nodes, 32, are on each side, and half of their traffic crosses: flits per cycle each way. Setting gives , or in general.
Name it
Packets and flits
A message is split into flits, the units a link moves per cycle; a 64-byte cache line on 16-byte links is 4 flits plus usually a header flit. Wormhole flow control lets a packet's flits follow its head through routers without storing the whole packet at each.
Latency
With H hops, a router pipeline of cycles and a link of , and a packet of L bits on links of b bits:
Average distances under uniform traffic: about on a k × k mesh, about on a torus.
Throughput
The bisection limits uniform traffic: flits per node per cycle on a k × k mesh, on a torus. Latency rises steeply as the offered load nears it.
Flow control and buffers
Routers hold flits in buffers and send them on only when the next router has space, tracked by credits. A buffer needs as many slots as the credit round trip in cycles, or the link idles while credits return. Virtual channels share one physical link among several buffered queues, so a blocked packet doesn't block others behind it, and separate classes of messages (requests and replies) can't deadlock each other.
Worked example
On an 8 × 8 mesh with 3-cycle routers and 1-cycle links, what is the zero-load latency of a 64-byte line on 16-byte links, at the average distance?
Show the solution
- Hop latency. The average distance is hops, each costing 3 + 1 = 4 cycles:
- Serialization. The 512-bit line crosses a 128-bit link in
- Total. before any queueing.
- Round trip. A request and its reply each pay it, which is why remote cache slices cost tens of cycles.
Answer the zero-load latency is about 25 cycles.
Worked example
A link's credit round trip is 1 cycle across the link, 3 cycles through the next router to free a slot, and 1 cycle for the credit to return. How many flit buffers does each virtual channel need?
Show the solution
- Credit round trip. Five cycles pass between sending a flit and learning its slot is free again:
- Buffers. So 5 buffers keep the link busy.
- With only 3. The sender would wait 2 cycles in every 5: the link would run at 60% however light the traffic.
Answer each virtual channel needs 5 flit buffers.
Worked example
Compare the saturation injection rates of an 8 × 8 mesh and an 8 × 8 torus, and their average distances.
Show the solution
- Mesh. Saturation at flits per node per cycle, with 5.3 hops on average.
- Torus. Saturation at flits per node per cycle, with about 4.1 hops on average (exactly scaled for distinct pairs).
- The cost. The torus doubles the bisection with its wraparound links but needs long wires or a folded layout to keep them short.
Answer the mesh saturates at 0.5 flits per node per cycle with 5.3 hops on average; the torus at 1.0, with about 4.1 hops.
Check
An 8 × 8 mesh has 2-cycle routers and 1-cycle links 32 bytes wide; a message carries 128 bytes.
(a)
What is its zero-load latency at the average distance?
(b)
And corner to corner?
Check
An 8 × 8 network has links 16 bytes wide in each direction at 2 GHz.
(a)
What injection rate per node saturates a mesh under uniform traffic?
(b)
And a torus?
(c)
What is the mesh's bisection bandwidth in each direction?
Check
A flit takes 1 cycle(s) to cross a link and 2 cycles to leave the next router's buffer; the credit takes 2 cycle(s) to return. Each virtual channel has 4 buffer slots.
(a)
What is the credit round trip?
(b)
What fraction of the link's capacity can one virtual channel use?
Check
Why do on-chip routers use virtual channels?
Check
A k × k mesh has routers of t cycles and 1-cycle links of b bytes; messages carry L bytes.
Step 1
What is the average distance between distinct nodes?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is the zero-load latency at that distance?
Step 3
What injection rate saturates it under uniform traffic?
Check
Write avg_hops(k, torus): the average shortest-path hop count between distinct nodes of a k × k mesh (or torus, with wraparound), by enumerating all pairs.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does a network's latency climb steeply as its load approaches saturation?
At light load a packet finds every router and link free and arrives after the zero-load latency. As the offered load grows, packets increasingly arrive at a router or link that's busy and must wait in a buffer. The waiting time depends on how often the resource is busy, and, as in any queue, it grows like one over one minus the utilization: modest at half load, enormous near full load. The bisection links saturate first under uniform traffic, so packets crossing the middle of the chip queue the longest, and the average latency rises sharply as the injection rate nears the bisection limit.
Practice
Keep practicing
6 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.