Jacky LightBlock Island
Hardware Notes

How does a chip multiply matrices?

Follow a pair of numbers through a multiply–accumulate array as neighboring cells pass data along.

Take a row [2, 3] from one matrix and a column [4, 5] from another. Their dot product is 23. That single output takes two multiplications and an addition. How can a grid of cells share inputs across many outputs?

Inside one cell

Start with a cleared accumulator. The first pair leaves 2 × 4 = 8. The second updates the sum to 8 + 3 × 5 = 23. Over several clock cycles, one cell builds up an output.

Pass the inputs along

Imagine a two-dimensional array with one cell responsible for each output. Row elements enter from the left and column elements enter from above. Stagger the rows and columns in time so each pair meets at the intended cell. After the multiply–accumulate, one input travels right and the other down. Neighbors can reuse both.

Each input can contribute to multiple outputs, saving trips to fetch it from farther away. The array takes time to fill and drain. Small or awkwardly shaped matrices can leave cells idle.

Trace a real design

In this example the partial sum stays in its cell. Other dataflows keep different values in place. In the first-generation TPU diagram, trace the weights, activations, and partial sums separately to see what stays and what moves. Jouppi et al., In-Datacenter Performance Analysis of a Tensor Processing Unit