Skip to content

fpga: systolic wavefront array spec -- matrix multiply as a schedule (for the ai-accelerator course) - #7719

Open
gHashTag wants to merge 1 commit into
masterfrom
fpga/systolic
Open

gHashTag wants to merge 1 commit into
masterfrom
fpga/systolic

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 8, 2026

Copy link
Copy Markdown
Owner

What

specs/fpga/systolic.t27 -- a 4x4 Kung-Leiserson wavefront array for matrix multiply, modeled tick by tick. This is the one new spec gHashTag/trinity#1487 (AI accelerator course, module dataflow, lesson systolic-arrays) asks for; same path as #7626 took for the buses course.

The schedule, as the spec states it

  • a[j][q] enters row j's west edge at tick j+q; b[q][k] enters column k's north edge at tick q+k; both walk one cell per tick.
  • So every operand pair of output (j,k) meets inside the cell at tick j+k+q -- N consecutive MACs per output, no gaps, no double booking, each cell busy every tick after the wavefront reaches it.
  • The whole run is 3N-2 ticks (10 for N=4) for N^3 MACs on N^2 cells; the weight-stationary variant is 2N-1 (7) -- the trade the course lesson teaches.

Tests (test-report: 6/6 pass, 1 invariant proved, 0 vacuous)

test what it pins
pair_meets_inside_the_cell all 64 (j,k,q) triples meet on one tick
macs_of_one_output_are_consecutive the pipeline never stalls
every_mac_fires_exactly_once playing every tick fires exactly 64 MACs in 10 ticks
the_wavefront_takes_three_n_minus_two 10 ticks vs weight-stationary 7
the_array_computes_the_product schedule == plain triple loop, negatives and zeros included, Python 3 oracle constants named in the test
identity_leaves_the_matrix_alone the array cannot skip ticks and still lands on A

Verified locally: t27c test-report specs/fpga/systolic.t27 100%, t27c gen-verilog exit 0 (tests/invariant correctly reported NOT LOWERED by the synthesis backend).

Honesty line carried in the header: algorithm truth only -- no board measurement, no frequency claimed.

Closes nothing in this repo; the course issue is gHashTag/trinity#1487.

🤖 Generated with Claude Code

…(for the ai-accelerator course)

A 4x4 Kung-Leiserson wavefront array for matrix multiply, modeled tick by
tick: a[j][q] enters row j's west edge at tick j+q, b[q][k] enters column
k's north edge at tick q+k, both walk one cell per tick, and every operand
pair of output (j,k) therefore meets inside the cell at tick j+k+q -- N
consecutive MACs per output, no gaps, no double booking.

Six tests + one invariant, none vacuous (test-report 100%):
- pair_meets_inside_the_cell: all 64 (j,k,q) triples meet on one tick
- macs_of_one_output_are_consecutive: the pipeline never stalls
- every_mac_fires_exactly_once: playing every tick fires exactly N^3 = 64
  MACs in 3N-2 = 10 ticks -- a lost MAC or a double firing breaks the count
- the_wavefront_takes_three_n_minus_two: 3N-2 = 10 ticks vs the
  weight-stationary variant's 2N-1 = 7
- the_array_computes_the_product: the schedule equals the plain triple
  loop, entry by entry, on a matrix with negatives and zeros (Python 3
  oracle, constants named in the test)
- identity_leaves_the_matrix_alone: the array cannot skip ticks and still
  lands on A untouched

Course use: gHashTag/trinity#1487 module dataflow lesson systolic-arrays.
Algorithm truth only -- no board measurement, no frequency claimed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-08 07:24:56 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 48
PRs with All Checks Green 2
READY 2
FAILING 48
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=39fa3908f9fd != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

This was referenced Oct 8, 2026
This was referenced Oct 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant