Repository navigation
Phase 6: WebAssembly harness and golden fixtures - #3
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 6: the engine compiled to WebAssembly, with a headless Node test against golden fixtures.
wasm/harness/:TinyAttnSimowns onetiny_attn_topmodel and its own Verilator context, so several instances run side by side. Embind bindings expose it to JavaScript.wasm/build.sh: Verilatesrtl/, links with Emscripten intoweb/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.ymlnow 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).