systolic-arrays-explained

/about

About this site

Systolic Arrays Explained is about the hardware that does a model's matrix multiplies: systolic arrays, their dataflows, and the matrix units of TPUs. Each chapter is built around an animation. It is the sixth of a family of companion sites, with the Transformer Decoder Explainer, LLM Inference Explained, LLM Architectures Explained, GPU Kernels Explained, Numerics Explained and Inference Trade-offs Explained. The chapters link the matching slides of the Google TPU series.

The model

reference/systolic.py is a cycle-accurate model of a parameterised array in plain Python, and src/lib/sa/model.ts repeats it line for line. Every PE's registers are recomputed each cycle from the previous cycle's, exactly as flip-flops behave, in weight-, output- and input-stationary dataflows, with row-stationary for a convolution as a reference; it also tiles problems that do not fit. The arithmetic is all integer, so the two agree exactly. The model page lists its conventions and closed forms.

How it is checked

What is illustrative

The animations

Every animation has play and pause, step back and forward, a scrub bar, speeds from 0.25× to 4× and reset; with the animation focused, Space plays or pauses and the arrow keys step. Each step has a one-line caption, also announced to screen readers. With reduce motion set in your system, nothing plays by itself. Animations pause when scrolled out of view. Colours come from Okabe and Ito's colour-blind-safe palette, the same in light and dark mode: activations (A) blue, weights (B) vermillion, partial sums sky blue, results purple. A PE that multiplies in a cycle gets a thick outline; an idle PE is grey and hatched.

Source

The code, the model and the tests are on GitHub (MIT licence). The design system is copied from the companion sites; the README records where each piece came from.