S433 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S4 · Lesson 33 · Directories and interconnection networks

Directory-based coherence, its storage cost, message hops, and network topologies

Snooping needs every cache to see every miss, which a single bus can provide for a few dozen cores at most. Larger machines replace the broadcast with a directory: for every memory line, a home node records which caches hold it, so a miss sends messages only to the caches that matter. The messages travel over a network of point-to-point links, a mesh on a chip or a fat tree across a data center, and its shape decides how far a message must go and how much traffic can cross the machine at once. Directories trade broadcast bandwidth for storage and extra hops.

  • Network diameter, the most hops between any two nodes, against the number of nodes N, for a ring (N/2), a 2D mesh (2(N−1)), a 2D torus (about N) and a hypercube (log2⁡N).
  • The ring is cheap but its diameter grows linearly; the mesh and torus fit flat chips; the hypercube grows slowly but needs log2⁡N links per node.
  • The readouts give bisection width, the links cut when the machine is split in half, for M nodes: the bandwidth for traffic that crosses the middle.

Predict

A full bit-vector directory keeps one presence bit per core for every 64-byte line. With 64 cores, how big is the directory compared to the data?

Name it

Directory protocols

Each line has a home node holding its directory entry: a state (uncached, shared, exclusive) and a record of which caches hold it.

  • Read miss, line clean at home: requester → home → requester: 2 messages.
  • Read miss, line modified in another cache: requester → home → owner → requester (with a copy to home): 3 hops on the critical path.
  • Write miss to a shared line: the home sends invalidations to each sharer and collects their acknowledgments.

Miss latency ≈ (critical-path messages) × (average hops × per-hop latency + per-message overhead).

Directory storage

  • Full bit vector: N bits per line, an overhead of N8B for B-byte lines.
  • Limited pointers: p pointers of ⌈log2⁡N⌉ bits each.

Interconnection networks

Topology (N nodes)DiameterBisection linksLinks per node
ringN/222
2D mesh, k × k2(k−1)kup to 4
2D torus, k × k (k even)k2k4
hypercubelog2⁡NN/2log2⁡N

On a k × k mesh the average distance between two distinct nodes is 2k3 hops under uniform traffic. Bisection bandwidth = bisection links × link bandwidth caps all-to-all traffic.

Worked example

Compare an 8 × 8 mesh and an 8 × 8 torus: diameter, bisection and (for the mesh) average distance. With 3 ns per hop, what's the critical-path latency of a 3-hop miss on the mesh at average distance, ignoring overheads?

Show the solution
  1. Mesh. Diameter 14, bisection 8 links, and average distance 2×8/3=5.33hops
  2. Torus. Diameter 8, bisection 16 links.
  3. A 3-message miss on the mesh. It crosses about 3×5.33=16hops which at 3 ns per hop is 48 ns before memory or cache access times.
  4. Why placement matters. That's why placing data near the cores that use it matters on large chips.

Answer the mesh has diameter 14, bisection 8 links and an average distance of 5.33 hops; the torus has diameter 8 and bisection 16; the miss's critical path is about 48 ns.

Worked example

A 1024-core machine with 64-byte lines: what does a full bit vector cost, and what do 4 limited pointers cost?

Show the solution
  1. Full bit vector. 1024 bits per 512-bit line: 1024/512=200% overhead.
  2. Four pointers. Each is log2⁡1024=10 bits: 4×10=40bits which is 7.8% overhead.
  3. Overflow. Lines shared by more than four caches overflow, which is rare for most data but common for widely read code and constants, so systems handle overflow with a broadcast or a coarser vector.

Answer a full bit vector costs 200% of the line, and four limited pointers cost 40 bits, 7.8%.

Worked example

Compare a 64-node hypercube with an 8 × 8 mesh: diameter, bisection links and links per node.

Show the solution
  1. Hypercube. Diameter log2⁡64=6, bisection 32 links, and 6 links per node.
  2. Mesh. Diameter 14, bisection 8 links, up to 4 links per node, and an average distance of 2×8/3=5.3hops
  3. Trade-off. The hypercube has four times the bisection and much shorter paths, but its node degree grows with size, so large machines use meshes, tori or fat trees.

Answer the hypercube has diameter 6, 32 bisection links and 6 links per node; the mesh has diameter 14, 8 bisection links and up to 4 links per node.

Check

A full bit-vector directory tracks 64 cores for 32-byte lines. What's its storage overhead relative to the data?

Check

A limited-pointer directory keeps 2 pointers per line for 1024 cores. How many bits of pointers is that?

Check

What's the diameter of an 8 × 8 mesh?

Check

What's the average distance between two distinct nodes of an 8 × 8 mesh under uniform traffic?

Check

An 8 × 8 torus has links of 16 GB/s in each direction. What's its bisection bandwidth, counting one direction?

Check

A directory miss has 3 messages on its critical path, each crossing 3 hops of 5 ns and paying 20 ns of overhead at the end. What's the network part of its latency?

Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.

Check

Compare an 8 × 8 mesh and an 8 × 8 torus.

(a)

What is the mesh's diameter?

(b)

What is its average distance under uniform traffic?

(c)

What is the torus's bisection?

Check

A directory serves 256 cores with 64-byte lines.

(a)

What storage overhead does a full bit vector add?

(b)

How many bits do 8 limited pointers take?

Check

A miss's critical path has m messages, each crossing h hops at t per hop plus o of overhead.

Step 1

What is its latency?

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°.

Explain why

Why do large multiprocessors use directories instead of snooping?

Practice

Keep practicing

11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.