Skip to content

Phase 6: WebAssembly harness and golden fixtures - #3

Merged
deaneeth merged 1 commit into
mainfrom
feat/phase-6-wasm-harness
Oct 25, 2026
Merged

deaneeth merged 1 commit into
mainfrom
feat/phase-6-wasm-harness

Conversation

@deaneeth

Copy link
Copy Markdown
Member

Summary

Phase 6: the engine compiled to WebAssembly, with a headless Node test against golden fixtures.

  • wasm/harness/: TinyAttnSim owns one tiny_attn_top model and its own Verilator context, so several instances run side by side. Embind bindings expose it to JavaScript.
  • wasm/build.sh: Verilates rtl/, links with Emscripten into web/public/tiny_attn.{mjs,wasm}. Size: 206 KB raw, 81 KB gzipped (budget 500 KB).
  • wasm/test.mjs: runs three golden fixtures (FLASH sequential, FLASH with overlap and causal masking, NAIVE with causal masking) on interleaved instances. Checks O, HBM bytes, tiles, K/V loads and busy cycles exactly, and checks that a fresh instance reproduces a run.
  • wasm/fixtures/ + sim/golden/export_fixtures.py: golden runs; a pytest checks they're not stale.
  • docs/STATE_SCHEMA.md: the JavaScript API and the per-clock snapshot. The snapshot is a subset of the planned full state; per-PE and softmax-lane values are Phase 7.

Verification

  • bash wasm/build.sh && node wasm/test.mjs: PASS.
  • pytest sim/golden: 53 passed (includes the fixture freshness check).
  • wasm.yml now builds the engine, runs the Node test, and enforces the size budget.

Notes

  • web/public/tiny_attn.{mjs,wasm} are build outputs and are gitignored; the web build will need a step to produce them (Phase 8).

TinyAttnSim (one model instance with its own VerilatedContext, so instances run side by side),
embind bindings, build script (81 KB gzipped), Node test over three golden fixtures (FLASH
sequential, FLASH overlap causal, NAIVE causal) with interleaved instances, exact O, bytes,
tiles, K/V loads and cycles. State schema documented; fixture freshness pinned in pytest.
@deaneeth
deaneeth merged commit df90df8 into main Oct 25, 2026
4 checks passed
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