Systolic Matrix Multiply

Waveflow currently offers two modules to multiply complex fixed-point matrices: SystolicEngine and SystolicEngineMem. Both compute a complex fixed-point matrix product C = q(A·B) or C = q(Aᴴ·B), where every product and every sum in A·B or Aᴴ·B is computed exactly (wide enough that nothing overflows or rounds), and q(·) rounds and saturates the result once, to C’s format. The computation is bit for bit like the model waveflow.linalg.matmul.matmul. Both share one array – output-stationary, R × C processing elements.

The key difference is where the operands live:

  SystolicEngine SystolicEngineMem
interface streams: a command, then A and B, on an input stream; a Resp and C on an output stream memory: a job descriptor on an input stream, with the addresses of A, B and C; A and B read and C written over m_axi; an EngineDone out on a stream
largest product Mmax × Pmax·Kmax × Nmax, held on chip: a long inner dimension is split into panels, summed on chip any M, N that are multiples of Mmax, Nmax, split into tiles of C, one engine command each; K ≤ Pmax·Kmax, in the engine’s panels
reuse keep_a: one A for several B none across tiles
at the centre 8×8×32 back to back: 171 cycles a product (64-bit words), 94 (128-bit) 32×32×64: done at 5,813 cycles (64-bit), 3,033 (128-bit)

(Vitis HLS / Vivado xsim 2025.1, xczu48dr, 4 ns, the centre configuration of the engine page.)

The pages

  • How a systolic array works – a product that fits on the array: the dimensions, a tile, the skew, the tile period, and the three bounds on its time (compute, input, output) and its memory.
  • Systolic engine – SystolicEngine: what it computes, its parameters, the command, panels for a long inner dimension and how they are iterated, its architecture (banked buffers read in place, a continuous array, the collector), performance, limits.
  • Systolic engine behind memory – SystolicEngineMem: the job, how a large product is divided into tiles and panels and the loop over them, the block-major layout, the feeder, performance, limits.

The older SystolicUnit (waveflow/linalg/legacy/systolic.py), which the engine supersedes, is retired: it remains only for examples/mimo_cg (Retired Components).


Table of contents

  • How a systolic array works - How the systolic engine's output-stationary array multiplies C = A·B when the product fits on chip, and what bounds it: the dimensions (m, k, n of the product; R × C processing elements; L lanes; LW elements a word), a tile of R × C outputs and its skew, why tiles can follow each other every max(k, R·C/L, L) steps, and the three bounds on a product's time -- compute T·P, input k(m+n)/LW words, output m·n/LW words -- with the condition for being compute-bound, mn/(m+n) ≥ R·C/LW. Worked at the centre configuration; the on-chip memory a product needs, and how it is banked; and where larger products go.
  • Systolic engine - SystolicEngine computes C = q(A·B), q(Aᴴ·B) or the Gram matrix q(Aᴴ·A) (GRAM, its operand read once) on complex fixed-point matrices, streamed in and out: a command, then its operands; per output a Resp and C; a Status per command. Covers what it computes, its parameters, the command and its rules, a runnable check of what it accepts, its architecture -- two loaders writing banked stream-of-blocks buffers the array reads in place, an array continuous across a command's panels and outputs, a collector that turns the array's drain order into C -- a flat pysim (one process, the tasks passive, the same words and timing within 2%) -- its performance (Vitis 2025.1, centre: 171 cycles per 8×8×32 product with 64-bit words, 94 with 128-bit, 81 an output when a command carries four; measured in examples/systolic), feeding a large array (256- and 512-bit words, GRAM, Kmax up to 256: the emitter search at 16×16 in 612 cycles, 5,160 as built), and its limits.
  • Systolic engine behind memory - SystolicEngineMem multiplies matrices larger than the systolic engine, in memory: one job descriptor in, C written back, an EngineDone out. Covers the job and its rules, the block-major memory layout, a runnable check of what it accepts, its architecture -- a sequencer running the output-stationary loop over C's tiles, a feeder that owns the read port and streams each tile's panels in bursts, the engine, a writer -- its performance on a 32×32×64 product (Vitis 2025.1, centre: 5,813 cycles with 64-bit words, 3,033 with 128-bit; measured in examples/systolic), and its limits.