6.5.7 · D1Advanced & Emerging Architectures

Foundations — Google TPU architecture and systolic arrays

3,101 words14 min readBack to topic

This page assumes you know nothing. Every letter, arrow, and word the parent topic leans on is built here, in order, each one earning its place before the next uses it.


0. A number, a list of numbers, a grid of numbers

Before any formula, fix the three shapes of data.

Figure — Google TPU architecture and systolic arrays

Why the topic needs this: a neural network layer stores its learned knowledge as a matrix of weights, and the data flowing through it as vectors of activations. Everything the TPU does is pushing vectors through matrices.

Read Question ::: Answer:

What does point to?
The number in row 3, column 1 of matrix .

Why the topic needs it: the parent writes the core formula as . That is unreadable until you know = row of the answer, = column of the answer, = the thing being summed over.


1. Multiply and add — the atom of the machine

Picture: an empty jar labelled . Each round you drop in one product ; the jar keeps the sum of everything dropped so far.

Why the topic needs it: the parent's throughput formula (built and explained in §5, once = array side and = clock frequency exist) has its factor of only because each MAC is 2 FLOPs. Miss this and the formula looks like magic.


2. The dot product — a sum of MACs in a row

Now the strange symbols in that formula:

Picture: a row of jars, each holding one product ; the pours them all into one big jar.

Figure — Google TPU architecture and systolic arrays

Why the topic needs it: the whole matrix-multiply formula is one dot product per output cell. The systolic array is nothing but a machine for computing many dot products in parallel.


3. Matrix multiply — a grid of dot products

Now we can read the parent's central equation.

Trace the indices with a picture:

Figure — Google TPU architecture and systolic arrays
  • is fixed to pick one row of (the red row).
  • is fixed to pick one column of (the blue column).
  • is the counter that walks along that row and down that column together, multiplying the pair it lands on and adding to the running sum.

Read:

Why must 's columns equal 's rows?
Each output is a dot product of a row of and a column of , and a dot product needs both lists to be the same length.

Why the topic needs it: this equation is the workload. Everything else — the array, the streaming, the fill cost — exists to run this one formula cheaply.


4. Where the pain comes from — memory vs. arithmetic

The multiplies are cheap. The trouble is fetching the numbers.

Picture: a factory (compute) fed by a single narrow conveyor belt (memory). If each delivered part is used for many operations, the factory stays busy. If each part is used once and thrown away, the factory idles waiting for the belt.

Figure — Google TPU architecture and systolic arrays

Why the topic needs it: the entire justification for a systolic array is "read each number once, reuse it times." That raises arithmetic intensity, which is the number the Roofline model plots on its x-axis. The parent's claim "arithmetic intensity " is exactly this idea made precise.


5. Clock, cycle, pipeline — how "flowing" is measured

With and now defined, the parent's formula reads cleanly: an grid has cells; in steady state each finishes one MAC (= 2 FLOPs) every cycle, and there are cycles per second, so peak throughput FLOP/s.

Picture: a garden hose. Turn the tap on and water does not exit instantly — it must first travel the length of the hose (fill). That travel time is wasted if you only wanted one cup.

Read:

Why do systolic arrays prefer large batches?
The fixed fill/drain cost ( cycles) is paid once; a big batch spreads it over many useful cycles so efficiency approaches 100%.

6. The specialised-chip vocabulary


Prerequisite map

The diagram below is a dependency map: read each arrow as "you need the box on the left before the box on the right makes sense." Follow the arrows from the top foundations down to the TPU at the bottom. (The text before the diagram is just drawing instructions for Obsidian — ignore the syntax and read the boxes and arrows.)

scalar vector matrix

index Aij row and column

MAC multiply then add

dot product sum of MACs

matrix multiply Cij

memory read cost

arithmetic intensity

FLOP and throughput

clock and cycle

pipeline fill and drain

systolic array PE grid

ASIC domain specific

8 bit quantization

TPU architecture

Each foundation feeds the next; together they arrive at the systolic array and the TPU.


Equipment checklist

Test yourself — reveal only after you have answered aloud.

Can I read and say which row and column it names?
Yes — is the row, is the column.
Do I know the two meanings of the symbol ?
Between numbers it is plain multiplication; between matrices it is the matrix multiply of §3.
Can I state a dot product as a sum of products?
— multiply matching entries, add them.
Do I know why means add, not multiply?
Sigma = Sum; the multiply symbol would be (pi), which never appears here.
Can I compute one entry of a matrix product?
It is the dot product of row of with column of .
Do I know why matrix shapes must match ()?
The shared dimension is the length of each dot product; both lists must be equally long.
Can I say what one MAC is, its starting value, and how many FLOPs it is?
Accumulator starts at ; each step multiplies two numbers and adds to it; 1 multiply + 1 add = 2 FLOPs.
Do I know what FLOP/s, TOPS, and "peak" mean?
FLOP/s = float ops per second; TOPS = trillion integer ops per second; peak = best-case speed with every unit busy.
Can I define arithmetic intensity in one consistent unit?
Operations done per value fetched from memory (top and bottom both counted as values/bytes).
Do I know where and come from?
outputs times -long dot products = MACs; = the input values of and read once.
Can I say what a byte is?
The standard small data unit; one 8-bit number fits in one byte.
Do I know what a clock cycle, fill/drain, and a batch are?
A cycle is one tick; fill/drain is startup cost while data crosses the array; a batch is many inputs processed together.
Can I explain why the TPU drops caches and branch prediction?
Its dataflow is fixed and predictable, so it spends that saved chip area on more MAC units instead.
Can I explain the difference between inference and training?
Training learns the weights (needs precision); inference uses a trained network (tolerates low precision).