The Systolic Tile
SystolicTop (src/systars/top.py) is a compute tile with three
memory levels and two data-moving processes. It follows the CSP model of
kpu-sim: processes push whole tiles downstream when
the downstream buffer has room, and nobody polls or requests data.
The left column carries operands down from L3 to the fabric; the right column carries results back up. The Streamer is the only process that touches both columns.
The compute hierarchy
Section titled “The compute hierarchy”Built bottom up, each level a lib.wiring.Component:
| Level | File | What it is |
|---|---|---|
PE |
core/pe.py |
One MAC with an input register on every link. Run-time mode: output-stationary (0) or stationary (1). |
PEArray |
core/pe_array.py |
A tile_rows x tile_cols block of PEs. Purely structural, since every link is already registered. |
SystolicArray |
core/systolic_array.py |
A grid_rows x grid_cols grid of PEArrays, 8x8 to 64x64 PEs. No skew or deskew registers. |
SystolicTop |
top.py |
The tile: fabric, scratchpad, Combiner, controllers, BlockMover engines and the command queues. |
The memory levels
Section titled “The memory levels”SYSTARS uses KPU names for its memories, never cache names:
| Level | Implementation | Written by | Read by |
|---|---|---|---|
| L3 | Outside the tile, over AXI | BlockMover STORE | BlockMover LOAD |
| L2 | memory/scratchpad.py: two bank groups of 1R1W banks (L2) |
BlockMover LOAD | Streamer |
| Combiner | memory/combiner.py |
The result path; a LOAD with LocalAddr bit 31 |
BlockMover STORE |
| L1 | memory/stream_buffer.py |
The Streamer (stream buffers); the fabric (result buffers) | The fabric (stream buffers); the result path (result buffers) |
The processes
Section titled “The processes”The tile is a pipeline of CSP processes, one per hop of a tile’s flow (#44, after kpugen esg#98). Credits flow upstream, data and tile-ready tokens flow downstream, and a process fires when its firing rule holds:
| Hop | Process | Fires when |
|---|---|---|
| L3 → L2 | the BlockMover’s inbound leg (BlockMoverIn) |
its L2 (or Combiner) slot’s credit is free; emits the slot’s token when done |
| L2 → L1 | the Streamer (controller/streamer.py) |
its L2 tile’s token is there, its Combiner slot’s credit is free, and the fabric can take the stream on schedule; returns the L2 credit once the tile’s last block is in L1 |
| L1 → fabric → L1 | the fabric | push-only, no flow control |
| L1 → L2 | the result path (controller/result_path.py) |
each result row as it leaves the L1 result buffers; emits the Combiner slot’s token once the tile’s rows are in |
| L2 → L3 | the BlockMover’s outbound leg (BlockMoverOut) |
the result tile’s token is there; returns the Combiner slot’s credit when done |
The BlockMover is one component (controller/blockmover.py) with both legs and their
engines (blockmover/reader.py, writer.py) on the tile’s one L3 port. A LOAD or STORE moves
a whole tile per command: len rows, stride bytes apart, row_bytes each, from any byte
address, with no AXI burst crossing a 4 KB boundary.
The Streamer turns L2 tiles into element streams through L1. As each producing COMPUTE starts, it describes the result tile to the result path. The result path holds L1’s result buffers, turns the fabric’s result columns back into rows, and writes them into the Combiner.
Each process runs its own program, an in-order queue of its commands. The tile takes them as
one stream, and cmd_type names the process (0: a LOAD, 1: a STORE, 2: an EXECUTE).
Every command carries cmd_sync: the slots it reads and fills, and the ACQUIRE, SIGNAL, WAIT
and RELEASE flags that take and return credits and tile-ready tokens (controller/sync.py). The
ISA page specifies the commands, opcodes and flags.
Configuration
Section titled “Configuration”One dataclass, SystolicConfig (config.py), sets everything: the grid and tile shape,
input_bits (default 8), acc_bits (32), the supported dataflow flags (default
OUTPUT_STATIONARY | B_STATIONARY), scratchpad and Combiner capacity, slot counts and
queue lengths. The presets are DEFAULT_CONFIG, LEAN_CONFIG, CHIP_CONFIG and
LARGE_CONFIG. The RTL targets in targets.py use small shapes, such as the 4x4
systolic_top that the cocotb tests run (python3 -m systars.targets list).
The three dataflows
Section titled “The three dataflows”One fabric runs all three dataflows. The PE has only two modes: weight-stationary (WS) and
input-stationary (IS) differ only in which operand the ISA lays out as stationary. A CONFIG
command selects the mode at run time (rs1: 0 = OS, 1 = WS, 2 = IS), and SystolicConfig.dataflow decides which modes are built: WS needs B_STATIONARY
and IS needs A_STATIONARY, so the default (OUTPUT_STATIONARY | B_STATIONARY) builds OS
and WS.
| Output-stationary (OS) | Weight-stationary (WS) | Input-stationary (IS) | |
|---|---|---|---|
| Held in each PE | C[i, j], the running sum | one element of B | one element of Aᵀ |
| Streamed east | A, row-major in L2 | A, column-major in L2 | B |
| Moves south | B, column-major in L2 | partial sums | partial sums |
| Results leave | north, on the last marker |
south | south, as Cᵀ |
| Layout fix-up | B loaded with a TRANSPOSE LOAD |
A loaded with TRANSPOSE |
STORE with TRANSPOSE turns Cᵀ into C |
| Per command | COMPUTE streams K <= KB elements |
PRELOAD B, then COMPUTE streams M <= KB rows |
PRELOAD A, then COMPUTE streams B |
| Conv2d | yes | not yet | not yet |
KB is the longest block a stream buffer holds: one L2 row, sp_width / input_bits elements.
Output-stationary. Three markers travel east with A: valid, first and last. first
makes the PE overwrite instead of accumulate, so a reduction needs no clear and may span
several commands (cmd_chain), with C held in the PEs between them. On last, the PE launches
c + a * b into the c_up register of the PE to its north. PE(i, j)’s result leaves the north
edge in clock s + K + j + 2i, so each column delivers one result every other clock.
Stationary. Each PE has an active weight w and a shadow. A weight travels down its
column’s registered chain with a w_valid marker, one PE per clock; each PE takes it into its
shadow and passes the old shadow south, so a column streamed bottom row first leaves every PE
with its own weight. A stream’s first element (first) swaps the shadow in, so the weights
change with the wavefront. Nothing is broadcast but the static in_control_dataflow
(tests/unit/test_fabric_structure.py checks it). Each PE computes
out_psum = in_psum + a * w, and the column sum leaves the south edge as a finished result.
Schedule rules
Section titled “Schedule rules”These come from the Streamer’s docstring and are checked by the tests:
- The next command starts
Iclocks after the previous one:I = max(K, R, C)for OS,max(M, R)for stationary. APRELOADhas its own issue path on the scratchpad’s B port, beside the stream on port A, and the nextPRELOADstartsmax(R, C)clocks later. WithK >= R, C, the next tile’s blocks reach L1 as the previous ones finish. In OS, back-to-back reductions are also bound by the drain rule below. - The OS drain rule. A command that ends a reduction starts so its results leave
2R - 1clocks after the previous reduction’s, so two results never collide on a north link. WithK >= 2R - 1(chained K tiles count) the rule costs nothing; on a 4x4 array withK = 4, consecutive single-command reductions start 7 clocks apart instead of 4. PRELOADdoes not wait for the stream ahead of it: its weights reach each PE’s shadow after that stream’s swap has passed. A stationaryCOMPUTEstarts at leastR - 1clocks after the lastPRELOAD, so withM >= max(R, C)tiles with new weights stream back to back.CONFIGwaits until the Streamer is idle.
Current limits
Section titled “Current limits”SystolicTopand the controllers are not synthesis targets yet:just synthcovers the PE, the arrays, the scratchpad and the Combiner.- Conv2d runs only in OS. WS and IS need a column-write LOAD (branes-ai/embodied-ai-soc-generator#25).
- Matmul loads both operand tiles for every output tile (
isa/matmul.py), so L3 supplies A once per column of C tiles and B once per row of C tiles: correct, but not traffic-optimal. - The hardware loop unrollers (
LoopMatmul,LoopConv) are not built; today the ISA instructions issue the tiled command streams.