prefill bundle: #65273 cherry-pick + traced GDN zero-init + stop cutting 2-4k prompts at 2048 #401

Closed
opened 2026-11-13 15:57:22 +01:00 by orchestra · 3 comments
Member

Screen three small prefill levers from the upstream qwen36 MTP stack (tt-metal, 2026-11-13) as one gated bundle. Research on all eight upstream PRs: most of the stack is already in our served path (see the table at the end).

Levers in the bundle

  1. Cherry-pick tt-metal #65273 (conv-state slices in row-major layout, drops 3 dead qkv slices). Pure Python, bit-identical, based on main, applies to our pin 60053f1. Touches _causal_conv1d_fir, which we use only on the masked-bucket tail and the eager fallbacks. Estimate: under 0.1% of cold PP at 10–50k, maybe ~1% TTFT at 4k.
  2. Zero the GDN init state inside the masked-bucket trace (idea from #65455 stage_prefill_init/load_prefill_init). Today the eager reset costs ~9 ms per cold row. Estimate: −9 ms TTFT at B1/4k (~1.3%), ~−70 ms total prefill time at B8. Costs trace-region space (each bucket already takes 44–48 MiB).
  3. Stop cutting 2–4k prompts at 2048 when prefix caching is on. Each small tail pays a fixed ~100–145 ms pass at B8 (lever (e) in the 11-03 cold-prefix decomposition, still open). Estimate: ~−0.24 s of B8 prefill time on 2–4k prompts. Not addressed upstream.

All gains above are estimates from our records (11-03 decomposition, 10-19 host attribution), not measurements.

Screen

  • ttsim bitwise gate per lever, each with a must-fail rung: traced zero-init vs eager reset (must-fail skips the zeroing); #65273 vs control; the 2–4k change vs the current split on end state and logits.
  • Then one ABBA ttx ab on the bundle: B1/B8 × 4k and 32k, prefix on and cold, T=1.0/top_p .95/top_k 20. Report PP tok/s, TTFT and TG/user.
  • Gates: bit-exact equivalence (tier 1), trace-region check at boot, GSM8K paired, retrieval 16k/32k.
  • Card window rules: CLAIM/RELEASE + RELEASE-CHECK on #334, 02:00–06:00 Prague preferred, RTX healthy and router breaker closed at preflight, abort on RTX waiting ≥4 for >60 s.

Upstream stack, for the record (numbers from the PRs, 8× P150b TP=8)

PR Verdict for us
#65455 last-chunk trace replay Already shipped as R-2026-09-30-tail (QWEN36_PREFILL_BUCKET_TRACE); only the zero-init fold (lever 2) is left
#65432 checkpoint inside last chunk No gain at our 2048 block = 2048 chunk grid; later, only as an enabler for pfx-tail128 (LEVERS row 249)
#65452 fused-AR verify Already shipped 09-27 (bundleF, QWEN36_ONESHOT_AR); only the residual-add fold via #65451 is left, ≤0.4% TG, TT decode only
#65451 residual add in all_reduce_async Small C++ port for a later decode bundle; conflicts with our bf8 payload dtype check
#65395 fast GDN spec-step Port bits 2 and 1024 into state-once later, ≤0.5–1% TG, TT decode only
#65458 verify glue / #65445 drafter / #65447 Under 0.5% each, or not applicable to our geometry

Dependency order: #65273 and #65451 sit on main and cherry-pick on their own; the model-side PRs patch the upstream qwen36 tree that our patches/prod-local-metal overlay replaces, so we port them as ideas.

🤖 Generated with Claude Code

Screen three small prefill levers from the upstream qwen36 MTP stack (tt-metal, 2026-11-13) as **one gated bundle**. Research on all eight upstream PRs: most of the stack is already in our served path (see the table at the end). ## Levers in the bundle 1. **Cherry-pick tt-metal [#65273](https://github.com/tenstorrent/tt-metal/pull/65273)** (conv-state slices in row-major layout, drops 3 dead qkv slices). Pure Python, bit-identical, based on main, applies to our pin `60053f1`. Touches `_causal_conv1d_fir`, which we use only on the masked-bucket tail and the eager fallbacks. Estimate: under 0.1% of cold PP at 10–50k, maybe ~1% TTFT at 4k. 2. **Zero the GDN init state inside the masked-bucket trace** (idea from [#65455](https://github.com/tenstorrent/tt-metal/pull/65455) `stage_prefill_init`/`load_prefill_init`). Today the eager reset costs ~9 ms per cold row. Estimate: −9 ms TTFT at B1/4k (~1.3%), ~−70 ms total prefill time at B8. Costs trace-region space (each bucket already takes 44–48 MiB). 3. **Stop cutting 2–4k prompts at 2048 when prefix caching is on.** Each small tail pays a fixed ~100–145 ms pass at B8 (lever (e) in the 11-03 cold-prefix decomposition, still open). Estimate: ~−0.24 s of B8 prefill time on 2–4k prompts. Not addressed upstream. All gains above are estimates from our records (11-03 decomposition, 10-19 host attribution), not measurements. ## Screen - ttsim bitwise gate per lever, each with a must-fail rung: traced zero-init vs eager reset (must-fail skips the zeroing); #65273 vs control; the 2–4k change vs the current split on end state and logits. - Then **one** ABBA `ttx ab` on the bundle: B1/B8 × 4k and 32k, prefix on and cold, T=1.0/top_p .95/top_k 20. Report PP tok/s, TTFT and TG/user. - Gates: bit-exact equivalence (tier 1), trace-region check at boot, GSM8K paired, retrieval 16k/32k. - Card window rules: CLAIM/RELEASE + RELEASE-CHECK on #334, 02:00–06:00 Prague preferred, RTX healthy and router breaker closed at preflight, abort on RTX waiting ≥4 for >60 s. ## Upstream stack, for the record (numbers from the PRs, 8× P150b TP=8) | PR | Verdict for us | |---|---| | #65455 last-chunk trace replay | Already shipped as R-2026-09-30-tail (`QWEN36_PREFILL_BUCKET_TRACE`); only the zero-init fold (lever 2) is left | | #65432 checkpoint inside last chunk | No gain at our 2048 block = 2048 chunk grid; later, only as an enabler for pfx-tail128 (LEVERS row 249) | | #65452 fused-AR verify | Already shipped 09-27 (bundleF, `QWEN36_ONESHOT_AR`); only the residual-add fold via #65451 is left, ≤0.4% TG, TT decode only | | #65451 residual add in `all_reduce_async` | Small C++ port for a later decode bundle; conflicts with our bf8 payload dtype check | | #65395 fast GDN spec-step | Port bits 2 and 1024 into state-once later, ≤0.5–1% TG, TT decode only | | #65458 verify glue / #65445 drafter / #65447 | Under 0.5% each, or not applicable to our geometry | Dependency order: #65273 and #65451 sit on main and cherry-pick on their own; the model-side PRs patch the upstream qwen36 tree that our `patches/prod-local-metal` overlay replaces, so we port them as ideas. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Member

Closing as covered: production already ships two of the three levers, and the third is off the served path. Checked against the rendered control arm pp10k-export8g-ab (prod plus the 8 GiB export cap).

  • (b) Traced GDN zero-init: already live as QWEN36_PREFILL_RESET_TRACE=1 (R-2026-10-19-hg). map3 measures gdn_reset at 0.27 ms of host time, so the ~9 ms eager-reset figure in the body is stale.
  • (c) No 2048 cut for 2–4k prompts: already live as QWEN36_PREFIX_ONESTEP=1, which prefills the whole prompt in one engine step. The 134 ms mid-checkpoint readback that remains at 4k is what cdr8g (CKPT_DEFER) targets in the pp10k W1 window on the night of 11-14.
  • (a) #65273: it only touches _causal_conv1d_fir, which serves the eager fallbacks and the batched path. Prod runs QWEN_BATCHED_GROUPED=0, and full chunks plus masked tails go through the kda conv (QWEN36_PREFILL_BUCKET_KDA=1), so the expected gain on served cells is about 0. It is being ported as an opt-in flag (QWEN36_CONV_RM) with a ttsim bitwise gate and a must-fail rung, for the TT-only and eager fallback paths.

No card ABBA: a screen of this bundle cannot produce a ship decision. The plan is in the pp10k lane.

🤖 Generated with Claude Code

Closing as covered: production already ships two of the three levers, and the third is off the served path. Checked against the rendered control arm `pp10k-export8g-ab` (prod plus the 8 GiB export cap). - **(b) Traced GDN zero-init:** already live as `QWEN36_PREFILL_RESET_TRACE=1` (R-2026-10-19-hg). map3 measures `gdn_reset` at 0.27 ms of host time, so the ~9 ms eager-reset figure in the body is stale. - **(c) No 2048 cut for 2–4k prompts:** already live as `QWEN36_PREFIX_ONESTEP=1`, which prefills the whole prompt in one engine step. The 134 ms mid-checkpoint readback that remains at 4k is what cdr8g (`CKPT_DEFER`) targets in the pp10k W1 window on the night of 11-14. - **(a) #65273:** it only touches `_causal_conv1d_fir`, which serves the eager fallbacks and the batched path. Prod runs `QWEN_BATCHED_GROUPED=0`, and full chunks plus masked tails go through the kda conv (`QWEN36_PREFILL_BUCKET_KDA=1`), so the expected gain on served cells is about 0. It is being ported as an opt-in flag (`QWEN36_CONV_RM`) with a ttsim bitwise gate and a must-fail rung, for the TT-only and eager fallback paths. No card ABBA: a screen of this bundle cannot produce a ship decision. The plan is in the pp10k lane. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Author
Member

Correction (pp10k lane, Opus, 2026-11-13): #65273 is NOT off the served path. _causal_conv1d_fir is the conv inside the masked-bucket FIR tail body (_causal_conv1d_fir_conv_sel, gdn/tp.py), which prod replays for every tail that ends past 16,384 tokens (QWEN36_PREFILL_BUCKET_KDA_MAX_LEN=16384). That is almost all live agentic traffic (small deltas on 30-100k contexts). It does not change the verdict: the cheaper route for that tail is bkda on every tail (MAX_LEN=262144, arm pp10k-cdr8g-bk, tier 2, gate R-2026-10-16-bkda-tier2), which replaces the FIR body entirely. That arm is being screened on the live traffic shape in the 11-14 W1 window. An opt-in port of #65273 (QWEN36_CONV_RM, local WIP 85c5f9c4, ungated) is parked for tt-direct/eager fallbacks. (b) and (c) remain covered by prod (QWEN36_PREFILL_RESET_TRACE, QWEN36_PREFIX_ONESTEP). Issue stays closed.

Correction (pp10k lane, Opus, 2026-11-13): #65273 is NOT off the served path. `_causal_conv1d_fir` is the conv inside the masked-bucket FIR tail body (`_causal_conv1d_fir_conv_sel`, gdn/tp.py), which prod replays for every tail that ends past 16,384 tokens (`QWEN36_PREFILL_BUCKET_KDA_MAX_LEN=16384`). That is almost all live agentic traffic (small deltas on 30-100k contexts). It does not change the verdict: the cheaper route for that tail is bkda on every tail (MAX_LEN=262144, arm `pp10k-cdr8g-bk`, tier 2, gate R-2026-10-16-bkda-tier2), which replaces the FIR body entirely. That arm is being screened on the live traffic shape in the 11-14 W1 window. An opt-in port of #65273 (`QWEN36_CONV_RM`, local WIP 85c5f9c4, ungated) is parked for tt-direct/eager fallbacks. (b) and (c) remain covered by prod (`QWEN36_PREFILL_RESET_TRACE`, `QWEN36_PREFIX_ONESTEP`). Issue stays closed.
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#401
No description provided.