decode: remove layout/memcfg conversion programs (48% of decode programs) — SA1/SA2 bit-exact arms #104

Closed
opened 2026-09-27 16:55:44 +02:00 by Grok · 4 comments
Owner

Desk research 2026-09-27 (no hardware, no new speed number). Note: docs/notes/decode-sharded-activations-2026-09-27.md (branch serving-throughput).

Problem

B=8 4k decode, per chip: 2365 programs, 39.8 ms busy, 3.17 ms idle (ttx-wb-wb-prod-g2-bitexact-20260927T130708Z.jsonl). ~1135 programs (48%) are pure layout/memcfg conversions: 2.42 ms busy, ceiling ~3.9 ms incl. their idle share (estimate). Per layer: 13 conversion programs per GDN layer, 30 per attention layer, ~30 model-level. RoPE alone = 12 layout programs per attention layer.

Ranked changes (B=8 / B=1, estimate; bit-exact unless noted)

  1. GDN a/b read directly by gdn_decode_conv_gates via column offset (b slice starts mid-tile → untilize+RM slice+tilize today, gdn/tp.py:651-662): 0.45–0.71 / 0.34–0.48 ms; + qkv from fused output 0.14–0.27.
  2. Attention: gate after concat-heads, concat output straight into wo (attention/tp.py:446,474-484,746; prefill already does this bit-identically): 0.15–0.21 / 0.10–0.14.
  3. KV direct: v from nlp_create_qkv_heads_decode straight into paged_update_cache, drop k pad (upstream tt_transformers idiom): 0.18–0.28 / 0.16–0.23.
  4. B=1 only: packed op updates state rows [0:B] in place (−144 programs): 0.65–0.76 ms at B=1.
  5. Packed GDN op writes TILE output: 0.16–0.23 / 0.15–0.18.
  6. Drop DRAM copy in RoPE (rope_tp.py:335): 0.05–0.10.
  7. (later, new kernels) fused GDN norm+gate ~0.7–1.0; fused q/k-norm+partial RoPE ~0.8–1.0.
  8. Residual add folded into norm (galaxy idiom): 0.12–0.29, probe first.
  • Not bit-exact, keep out of bundle: sharded norm output straight into in-proj (K-block 8→5).

Items 1–3,5,6: ~1.1–1.8 ms at B=8; 1.6–2.1 ms at B=1 with item 4 (estimate).

Measurement plan

  • prod-g2-EFS-SA1 (Python only): QWEN36_DEC_ATTN_POST_SHARDED, QWEN36_DEC_KV_DIRECT, QWEN36_DEC_ROPE_NOCOPY (16 banners each).
  • prod-g2-EFS-SA2 (kernel image, fail closed): QWEN36_DEC_GDN_AB_DIRECT, QWEN36_DEC_GDN_O_TILE, QWEN36_DEC_GDN_STATE_ROWS (48 banners each). Matching wb-* arms.
  • Gate: bitwise single GDN + attention layer incl. KV pages and GDN state; must-fail fault rung; workbench token_ids_sha256 = control at B=1/B=8; batch-equiv 8/8 incl. uneven/staggered.
  • Proof: per_chip.*.programs 2365 → ~2221 (SA1) → ~1885–1981 (SA2); per-kernel counts (fill_pad 32→0, untilize 52→4, tilize 103→7, …) as listed in the note §4. Then idle_us, wall_ms, served sweep via tt-bundle-loop.
  • Nice-to-have: workbench keeps the ordered program sequence for one layer instead of top-25.
Desk research 2026-09-27 (no hardware, no new speed number). Note: `docs/notes/decode-sharded-activations-2026-09-27.md` (branch `serving-throughput`). ## Problem B=8 4k decode, per chip: 2365 programs, 39.8 ms busy, 3.17 ms idle (`ttx-wb-wb-prod-g2-bitexact-20260927T130708Z.jsonl`). ~1135 programs (48%) are pure layout/memcfg conversions: 2.42 ms busy, ceiling ~3.9 ms incl. their idle share (estimate). Per layer: 13 conversion programs per GDN layer, 30 per attention layer, ~30 model-level. RoPE alone = 12 layout programs per attention layer. ## Ranked changes (B=8 / B=1, estimate; bit-exact unless noted) 1. GDN `a`/`b` read directly by `gdn_decode_conv_gates` via column offset (b slice starts mid-tile → untilize+RM slice+tilize today, `gdn/tp.py:651-662`): 0.45–0.71 / 0.34–0.48 ms; + qkv from fused output 0.14–0.27. 2. Attention: gate after concat-heads, concat output straight into wo (`attention/tp.py:446,474-484,746`; prefill already does this bit-identically): 0.15–0.21 / 0.10–0.14. 3. KV direct: v from `nlp_create_qkv_heads_decode` straight into `paged_update_cache`, drop k pad (upstream tt_transformers idiom): 0.18–0.28 / 0.16–0.23. 4. B=1 only: packed op updates state rows [0:B] in place (−144 programs): 0.65–0.76 ms at B=1. 5. Packed GDN op writes TILE output: 0.16–0.23 / 0.15–0.18. 6. Drop DRAM copy in RoPE (`rope_tp.py:335`): 0.05–0.10. 7. (later, new kernels) fused GDN norm+gate ~0.7–1.0; fused q/k-norm+partial RoPE ~0.8–1.0. 8. Residual add folded into norm (galaxy idiom): 0.12–0.29, probe first. - Not bit-exact, keep out of bundle: sharded norm output straight into in-proj (K-block 8→5). Items 1–3,5,6: ~1.1–1.8 ms at B=8; 1.6–2.1 ms at B=1 with item 4 (estimate). ## Measurement plan - `prod-g2-EFS-SA1` (Python only): `QWEN36_DEC_ATTN_POST_SHARDED`, `QWEN36_DEC_KV_DIRECT`, `QWEN36_DEC_ROPE_NOCOPY` (16 banners each). - `prod-g2-EFS-SA2` (kernel image, fail closed): `QWEN36_DEC_GDN_AB_DIRECT`, `QWEN36_DEC_GDN_O_TILE`, `QWEN36_DEC_GDN_STATE_ROWS` (48 banners each). Matching `wb-*` arms. - Gate: bitwise single GDN + attention layer incl. KV pages and GDN state; must-fail fault rung; workbench `token_ids_sha256` = control at B=1/B=8; batch-equiv 8/8 incl. uneven/staggered. - Proof: `per_chip.*.programs` 2365 → ~2221 (SA1) → ~1885–1981 (SA2); per-kernel counts (fill_pad 32→0, untilize 52→4, tilize 103→7, …) as listed in the note §4. Then `idle_us`, `wall_ms`, served sweep via tt-bundle-loop. - Nice-to-have: workbench keeps the ordered program sequence for one layer instead of top-25.
Author
Owner

Runbook: https://git.bitp.cz/donach/tt-stack/src/branch/serving-throughput/docs/runbooks/104-decode-layout-sa.md. Count attribution in the note re-checked against the c67 by_kernel_chip0: matches. SA1 (Python: ATTN_POST_SHARDED split into gate / gate,in0 since the sharded-in0 wo takes a different reader and must be gated like c68, KV_DIRECT, ROPE_NOCOPY, SA_FAULT must-fail) is being implemented by pi on branch decode-sa1 with arms + a c70 queue. Rank 1 (a/b direct) needs our conv_gates kernel -> SA2 image. No hardware run yet.

Runbook: https://git.bitp.cz/donach/tt-stack/src/branch/serving-throughput/docs/runbooks/104-decode-layout-sa.md. Count attribution in the note re-checked against the c67 by_kernel_chip0: matches. SA1 (Python: ATTN_POST_SHARDED split into gate / gate,in0 since the sharded-in0 wo takes a different reader and must be gated like c68, KV_DIRECT, ROPE_NOCOPY, SA_FAULT must-fail) is being implemented by pi on branch decode-sa1 with arms + a c70 queue. Rank 1 (a/b direct) needs our conv_gates kernel -> SA2 image. No hardware run yet.
Author
Owner

SA1 screen (c73) vs the c70 band (2 reps: makespan 0.30%, TG 0.04%). All 3 cells are outside the band.

cell TG ms/token makespan
B=8 4k 40.74 → 40.17 −1.0%
B=8 32k 50.84 → 50.26 −0.6%
B=1 4k 36.71 → 36.29 −1.2%

TTFT and PP are flat. SA1 is bit-exact 8/8, and its must-fail twin diverged.

Record: bench/runs/perf-loop-c73-SA1-screen-verdict-20260927T2030Z.jsonl.

Next: SA1 is stacked on c72 T2 as prod-g2-c78-T2SA1, gated as a combination (equiv, gsm8k, retrieval), with a full-cell sweep queued.

SA1 screen (c73) vs the c70 band (2 reps: makespan 0.30%, TG 0.04%). All 3 cells are outside the band. | cell | TG ms/token | makespan | |---|---|---| | B=8 4k | 40.74 → 40.17 | −1.0% | | B=8 32k | 50.84 → 50.26 | −0.6% | | B=1 4k | 36.71 → 36.29 | −1.2% | TTFT and PP are flat. SA1 is bit-exact 8/8, and its must-fail twin diverged. Record: bench/runs/perf-loop-c73-SA1-screen-verdict-20260927T2030Z.jsonl. Next: SA1 is stacked on c72 T2 as `prod-g2-c78-T2SA1`, gated as a combination (equiv, gsm8k, retrieval), with a full-cell sweep queued.
Member

Superseded by shipped successors: SA2 item 1 = GDN_DECODE_CHAIN=direct (R-2026-10-03-gdc-cpk), the post-SDPA chain ~18→5 programs = pfold, kvfold (R-2026-10-06-kvfold), GDN_AB_PAD (c86). The one live fragment (B=1 STATE_ROWS in-place) stays tracked under #160 step 4. CHAIN=direct banner verified in ship-cdr8g.toml 2026-11-18.

Superseded by shipped successors: SA2 item 1 = GDN_DECODE_CHAIN=direct (R-2026-10-03-gdc-cpk), the post-SDPA chain ~18→5 programs = pfold, kvfold (R-2026-10-06-kvfold), GDN_AB_PAD (c86). The one live fragment (B=1 STATE_ROWS in-place) stays tracked under #160 step 4. CHAIN=direct banner verified in ship-cdr8g.toml 2026-11-18.
Author
Owner

agent-gateway closeout (closed): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (closed): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack#104
No description provided.