6.5.7 · D4Advanced & Emerging Architectures

Exercises — Google TPU architecture and systolic arrays

2,226 words10 min readBack to topic

Level 1 — Recognition

Recall Solution

WHAT: "Systolic" comes from systole, the heartbeat — the contraction that pumps blood. WHY the metaphor: just as a heartbeat pushes blood rhythmically from chamber to chamber, the array pushes data rhythmically, one hop per clock, from cell to neighbouring cell. No cell reaches out to global memory mid-computation; everything is passed hand-to-hand. The key property captured: local, rhythmic dataflow with maximal reuse.

Recall Solution
  • Weights stay put (that's what "weight-stationary" means) — each cell holds one weight for the whole computation.
  • Activations move horizontally (left → right), passed along via .
  • Partial sums move vertically (top → bottom), each cell adding its product: .

Level 2 — Application

Recall Solution

WHAT: plug into . WHY the factor 2: each cell finishes one MAC per clock = 1 multiply + 1 add = 2 ops. Converting to TOPS ( ops/s): .

Recall Solution

WHAT: cycles. Wasted fraction: the fill/drain part is cycles, so WHY it matters: one fifth of the run went into just filling the pipeline — a warning that small batches on this array are inefficient (we tackle that head-on in L3).

Recall Solution

WHAT — count the MACs: an product does MACs, here . Naïve reads: each MAC reads 1 element of and 1 of reads. Systolic reads: each of the inputs is read exactly once. WHY: the reuse factor equals the array dimension — every operand marched across cells before leaving.


Level 3 — Analysis

Recall Solution

WHAT: solve . Multiply out: , so , giving Round up: rows. WHY: the fixed 511-cycle fill is only "diluted" once the useful stream vastly outnumbers it. Higher utilisation targets demand exponentially larger batches — this is why TPUs are throughput machines, not latency machines.

Recall Solution

WHAT — cycles, then seconds (time = cycles ÷ ):

  • A: cycles . Time .
  • B: cycles . Time . Winner: A, and it is ~4.45× faster in wall-clock time. WHY: equal peak throughput hides the clock. B reaches its peak only in perfect steady state; its slow clock stretches every cycle, and its larger array pays a bigger fill. Peak FLOP/s is a ceiling, not a delivered time.
Figure — Google TPU architecture and systolic arrays

Level 4 — Synthesis

Recall Solution

WHAT — pick N: . (Square is forced here since the whole budget is one square array.) Peak: — exactly the TPUv1 ballpark. Utilisation for : fill ; The tension: with a fixed cell budget, a bigger raises peak throughput (∝ ) but also raises the fill cost (), which hurts utilisation on modest batches. At this 256-array runs only two-thirds efficient — you would either enlarge the batch or, if latency-bound, prefer a smaller array. There is no free lunch; you are trading peak ceiling against fill overhead. See Dataflow architectures for the general form of this trade.

Recall Solution

WHAT: array AI MACs/byte. Compare with the balance point : since , you are compute-bound (a good place to be — you are limited by your silicon, not by DRAM). Margin: past the balance point. WHY: the whole reason for the systolic layout is to push AI up high enough to clear the memory wall; here you clear it by 2.56×, so adding more memory bandwidth would not speed you up — only more/faster cells would.


Level 5 — Mastery

Recall Solution

WHAT — build it: useful MACs in a batch (each of rows drives all cells once). Total cycles , and time . So WHY the shape: it is exactly peak × utilisation. As , and delivered (the ceiling). At , tiny — the single row barely amortises the fill. Numbers: peak TOPS (from 4.1); ; Reading it: you paid for 91.75 TOPS of silicon but delivered 61.2 — the missing third leaked into pipeline fill. That gap is the L3/L4 lesson made quantitative.

Figure — Google TPU architecture and systolic arrays
Recall Solution

(a) Why 8-bit suffices for inference: an 8-bit multiplier is far smaller and lower-energy than a 32-bit float multiplier, so you fit many more MAC cells in the same silicon → higher → higher peak. Inference only needs a forward pass, and a well-quantised network tolerates 8-bit weights/activations with negligible accuracy loss (see Quantization and 8-bit inference). More cells + adequate precision = the TPUv1 bet. (b) Why 8-bit fails for training: training uses gradient descent; gradients can be tiny and are accumulated over many steps. Rounding them to 8-bit integers throws away the small values that carry learning signal — the model stops converging. Training needs floating point with wide dynamic range (bfloat16 keeps the 8 exponent bits of float32), which is why TPU v2+ switched. This is the same precision-vs-range tension the quantization note develops. The synthesis: precision is a dial, not a constant — you spend the minimum precision the task tolerates and buy throughput with the savings. Inference tolerates less; training tolerates far less rounding of gradients.