Skip to content

Phase 7 (partial): browser visualizer for the engine - #4

Merged
deaneeth merged 3 commits into
mainfrom
feat/phase-7-web-ui
Oct 26, 2026
Merged

deaneeth merged 3 commits into
mainfrom
feat/phase-7-web-ui

Conversation

@deaneeth

@deaneeth deaneeth commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase 7: the browser visualizer at /app runs the WASM engine clock by clock.

  • Controls: FLASH or NAIVE, causal, overlap, cfg_qrows, HBM latency; Start, Step, Back, Run to end, Reset.
  • Inputs: presets, or your own Q, K and V (editable in the page; quantized in the browser the same way as the golden model).
  • Views: tile schedule, current tile values, the K and V tile buffers (read from the RTL), HBM traffic against the golden traffic model, the dequantized output with its deviation from float attention, and an attention heatmap (engine probabilities from HBM for NAIVE; float reference for FLASH, which never stores P).
  • Engine: new read-only debug ports for the K/V buffers (dbg_kbuf, dbg_vbuf, dbg_kv_sel); no behavior change.

Verification

  • pnpm test:e2e (Playwright, production build): 5 passed.
  • pnpm test (Vitest): 10 passed.
  • node wasm/test.mjs: PASS (exact O, bytes, tiles, K/V loads, cycles, tile state, probabilities, K/V buffer in use).
  • pytest sim/golden: 54 passed (fixture, web-data and traffic-table freshness).
  • bash sim/lint.sh: clean. pnpm typecheck, pnpm lint, pnpm build: clean.

Notes

  • The Playwright smoke test runs in web CI against the committed engine build.
  • astro dev hangs without output in this environment; the production build works.

…s, NAIVE P matrix

/app runs the WASM engine in the browser: start, step, back, run to end, reset. Shows the tile
schedule (FLASH and NAIVE), the current tile's values, HBM bytes, tile and K/V counters,
controller state, the dequantized output with its deviation from float attention, and for NAIVE
the probability matrix read back from HBM.

Shared with the golden model: presets (generated presets.ts), quantization (quantize.ts checked
against golden values), tile order (checked against tile counts in the fixtures). Engine harness
gains the tile-state and probability readouts (32-bit values; BigInt avoided).

Not yet built from the Phase 7 list: MatrixEditor, SramPanel, HbmMeter, FLASH heatmap, Playwright
smoke test. See docs/ARCHITECTURE.md section 12.
…ter, heatmap, smoke tests

- Matrix editor: Q, K and V values are editable in the page; the browser quantizes them the same way as the golden model. Editing resets the run; "Reset to preset" restores the preset.
- SRAM panel: the K and V tile buffers, read from the RTL (new debug ports dbg_kbuf, dbg_vbuf, dbg_kv_sel; no behavior change). The buffer in use is outlined.
- HBM meter: bytes so far against the expected total for the configuration, from web/src/lib/traffic-table.ts, generated from sim/golden/traffic.py (freshness checked in pytest).
- Attention heatmap: engine probabilities from HBM for NAIVE; float reference for FLASH, which never stores P (labelled as such).
- Playwright smoke test (pnpm test:e2e, five tests) against the production build: FLASH output against the float reference, step and back, NAIVE probabilities, editing and re-running, phone width without horizontal scroll.
- WASM harness: getKVBuffers(); the Node test checks the buffer in use holds the last K/V tile loaded.

Phase 7 exit criteria in docs/PLAN.md are met. Docs updated: ARCHITECTURE section 12, STATE_SCHEMA, PLAN, CONTEXT, README.
web/public/tiny_attn.{mjs,wasm} are tracked again: the Vercel build has no Emscripten, so /app needs
them in git. web CI now runs Vitest and the Playwright smoke tests against the committed engine.
.gitignore re-includes the two files.
@deaneeth
deaneeth merged commit 70fe2d3 into main Oct 26, 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