prefill unlocks U2/U3/U6/U7: norm 2D grid, mixed chunk plan, SDPA k_chunk refusal, #56023 NoC MID skip (6-arm screen on -dx-w2t) #201

Closed
Grok wants to merge 7 commits from lever/prefill-unlocks-u2-u3-u6-u7 into master
Owner

Code unlocks U2, U3, U6 and U7 from docs/analysis/lever-reeval-prefill-20261006.md §4, each with a flag, a banner, an in-boot self-test with a wrong-input rung, a ttsim gate and a switch class. Six arms for the combination screen, all derived from CONTROL …-kvfold-dx-w2t (master moved to w2t while this was being built). No card time was used: every speed number below is an estimate.

Levers

id flag what ttsim (correctness only) class
U7 TT_NOC_MID_SKIP=1 + overlay pk3r+0033+0034+0035+0041+0047 backport of tt-metal #56023 (BH NoC MID-address skip) as patches/tt-metal/0047; device code only (hw/inc, dispatch kernels), JIT at device open. The host check refuses a boot whose JIT roots lack the patch u7-nocmid-sim-20261006.jsonl line 2: all_ok, 14 cells bitwise incl. fast dispatch; in-image check u7-nocmid-imagecheck-20261006.jsonl reboot
U2 QWEN36_PREFILL_NORM_2D=1 prefill norm post-all-gather as one generic_op on 110 cores (22x5 at S=2048) instead of 64. Not ttnn's use_2d_core_grid: #56908 is in our pin and upstream main, the fix #57084 was closed unmerged, and ttsim reproduces the bug on our shapes. The pre op stays 1D (a 2D pre cannot be bitwise) u2-norm2d-sim-20261007T094556Z.jsonl: all_ok, 21 cells, S=128..2304, bf16/bf8 reboot
U3 QWEN36_PREFILL_CHUNK_PLAN=mixed (needs chunk 2304) second parked chunk trace at 2048; 4096 runs as 2048+2048 (the control's numerics), 32k stays on 2304 chunks. Plan weight 0.95 per 2304 token (an estimate fitted from #7175) u3-chunkmix-sim-20261007T102337Z.jsonl: last line all_ok; plan unit tests checked against brute force over 21,816 lengths reboot
U6 QWEN36_SDPA_PREFILL_KCHUNK=<k> prefill SDPA k_chunk; refuses k<128 at parse (k=32 corrupts, packed-verify.jsonl; k=64 with q=256 hangs in ttsim) u6-sdkc-sim-20261007T*.jsonl: no k passes the 1.05x fp64-error gate in every cell (k=512: 1.09x at cs 0, 1.37x at 2048, 0.60x at 30720) reboot

U5 was dropped: #192 built it as QWEN36_PREFILL_W2_T11, which has since shipped.

Arms (CONTROL …-dx-w2t)

suffix levers
-nocmid U7
-norm2d U2
-g9c2304-mix U3 + chunk 2304 + QWEN36_AGMM_GRID9=all
-nocmid-norm2d U7 + U2
-g9c2304-mix-nocmid U7 + U3 + g9
-g9c2304-mix-nocmid-norm2d U7 + U3 + g9 + U2
  • Left out: plain g9c2304. LEVERS records it as a LOSS as screened (#189). U3 is the variant that keeps the 4k plan on the control's numerics. At 32k it is still 2304 chunks, so the acceptance shift §1a describes can still appear there. Read TG per row-step.
  • Left out: a U6 arm. Its own boot self-test would refuse it.
  • Lint and tests: ttx lint is OK at B=8,4,1 for all six arms. The ttx unit tests pass (500 OK), and the new lever tests pass (27).

Estimates (not measured)

  • U7: −0.5…−1.5% prefill. Upstream's table shows the gain only for pages ≤1 KiB (bfp8/bfp4 tiles), not bf16.
  • U2: ≤ −8 ms/chunk at 30k. The doc's knockout rung (kill below 5 ms/chunk) is still open.
  • U3: recovers the 4k loss of g9c2304 (−2.5…−5.5%) and keeps its 32k gain (+3.2…+4.2%).

Proven only by a card boot

  • JIT and the patch. 0047 has to JIT-compile on the pk3r tree, including the dispatch and firmware kernels, and real PCIe traffic has to work with it.
  • U2's new kernels have to compile, and must behave under trace capture.
  • U3's two traces sharing buffers. The bitwise trace-vs-eager check in its self-test is an assumption until a card runs it. The trace bytes are estimated at about 340 MiB free of 1280 MiB.
  • The served q=256 GQA-mcast SDPA fork is not in the Nix ttsim tree.
  • Speed and quality. Every speed number above, plus equiv, gsm8k and retrieval for the winner.

🤖 Generated with Claude Code

Code unlocks U2, U3, U6 and U7 from `docs/analysis/lever-reeval-prefill-20261006.md` §4, each with a flag, a banner, an in-boot self-test with a wrong-input rung, a ttsim gate and a switch class. Six arms for the combination screen, all derived from CONTROL `…-kvfold-dx-w2t` (master moved to w2t while this was being built). No card time was used: every speed number below is an estimate. ## Levers | id | flag | what | ttsim (correctness only) | class | |---|---|---|---|---| | U7 | `TT_NOC_MID_SKIP=1` + overlay `pk3r+0033+0034+0035+0041+0047` | backport of tt-metal #56023 (BH NoC MID-address skip) as `patches/tt-metal/0047`; device code only (hw/inc, dispatch kernels), JIT at device open. The host check refuses a boot whose JIT roots lack the patch | `u7-nocmid-sim-20261006.jsonl` line 2: all_ok, 14 cells bitwise incl. fast dispatch; in-image check `u7-nocmid-imagecheck-20261006.jsonl` | reboot | | U2 | `QWEN36_PREFILL_NORM_2D=1` | prefill norm post-all-gather as one generic_op on 110 cores (22x5 at S=2048) instead of 64. Not ttnn's `use_2d_core_grid`: #56908 is in our pin and upstream main, the fix #57084 was closed unmerged, and ttsim reproduces the bug on our shapes. The pre op stays 1D (a 2D pre cannot be bitwise) | `u2-norm2d-sim-20261007T094556Z.jsonl`: all_ok, 21 cells, S=128..2304, bf16/bf8 | reboot | | U3 | `QWEN36_PREFILL_CHUNK_PLAN=mixed` (needs chunk 2304) | second parked chunk trace at 2048; 4096 runs as 2048+2048 (the control's numerics), 32k stays on 2304 chunks. Plan weight 0.95 per 2304 token (an estimate fitted from #7175) | `u3-chunkmix-sim-20261007T102337Z.jsonl`: last line all_ok; plan unit tests checked against brute force over 21,816 lengths | reboot | | U6 | `QWEN36_SDPA_PREFILL_KCHUNK=<k>` | prefill SDPA k_chunk; refuses k<128 at parse (k=32 corrupts, packed-verify.jsonl; **k=64 with q=256 hangs in ttsim**) | `u6-sdkc-sim-20261007T*.jsonl`: **no k passes** the 1.05x fp64-error gate in every cell (k=512: 1.09x at cs 0, 1.37x at 2048, 0.60x at 30720) | reboot | U5 was dropped: #192 built it as `QWEN36_PREFILL_W2_T11`, which has since shipped. ## Arms (CONTROL `…-dx-w2t`) | suffix | levers | |---|---| | `-nocmid` | U7 | | `-norm2d` | U2 | | `-g9c2304-mix` | U3 + chunk 2304 + `QWEN36_AGMM_GRID9=all` | | `-nocmid-norm2d` | U7 + U2 | | `-g9c2304-mix-nocmid` | U7 + U3 + g9 | | `-g9c2304-mix-nocmid-norm2d` | U7 + U3 + g9 + U2 | - **Left out: plain g9c2304.** LEVERS records it as a LOSS as screened (#189). U3 is the variant that keeps the 4k plan on the control's numerics. At 32k it is still 2304 chunks, so the acceptance shift §1a describes can still appear there. Read TG per row-step. - **Left out: a U6 arm.** Its own boot self-test would refuse it. - **Lint and tests:** `ttx lint` is OK at B=8,4,1 for all six arms. The ttx unit tests pass (500 OK), and the new lever tests pass (27). ## Estimates (not measured) - **U7:** −0.5…−1.5% prefill. Upstream's table shows the gain only for pages ≤1 KiB (bfp8/bfp4 tiles), not bf16. - **U2:** ≤ −8 ms/chunk at 30k. The doc's knockout rung (kill below 5 ms/chunk) is still open. - **U3:** recovers the 4k loss of g9c2304 (−2.5…−5.5%) and keeps its 32k gain (+3.2…+4.2%). ## Proven only by a card boot - **JIT and the patch.** 0047 has to JIT-compile on the pk3r tree, including the dispatch and firmware kernels, and real PCIe traffic has to work with it. - **U2's new kernels** have to compile, and must behave under trace capture. - **U3's two traces sharing buffers.** The bitwise trace-vs-eager check in its self-test is an assumption until a card runs it. The trace bytes are estimated at about 340 MiB free of 1280 MiB. - **The served q=256 GQA-mcast SDPA fork** is not in the Nix ttsim tree. - **Speed and quality.** Every speed number above, plus equiv, gsm8k and retrieval for the winner. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Believed before: the #56023 gain (on-chip noc_async_read/write issue ~5.5% faster, pages <= 1 KiB) needed a pin
bump. It does not: the PR is device code only (hw/inc NoC headers, the cq_* dispatch kernels, two PCIe kernels),
applies to the pk3r image tree with three context-drift hunks hand-ported (noc_init loop vs upstream's
noc_init_one; cq_noc_set_ret_addr_mid placement), and changes no host library: the Path-I build compiled 0 TUs
and the overlay's _ttnncpp.so/_ttnn.so are the CONTROL store paths. The new manifest is a strict superset of
CONTROL's (+ 0047's JIT files in both JIT roots).

- patches/tt-metal/0047: the production half of #56023 (tests/, deepseek models/ and .github dropped; drisc_relay
  absent at our pin). No revert/fix of #56023 upstream as of 10-06; #57238 is watcher ASSERTs only.
- tools/ttnn-incr package: dispatch kernel .cpp files also land in the wheel's copy of tt_metal/, so a patched
  cq_common.hpp never pairs with a stale cq_dispatch.cpp.
- tp_common.noc_mid_skip_check_image (called first in Qwen36Model.__init__): TT_NOC_MID_SKIP=1 requires every JIT
  root to carry 0047's markers, else "TT_NOC_MID_SKIP REFUSED"; runs a wrong-marker self-test each boot;
  TT_NOC_MID_SKIP_MUSTFAIL=1 must refuse. Unset = no file read.
- bench/probes/sim_nocmid.py (ttsim bitwise gate) and nocmid_image_check.py (the check inside k2-mr-pk3r).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed before: the prefill distributed RMSNorm could go 2D through ttnn's own
use_2d_core_grid. The audit says no: the #56908 row-stride bug is in our pin and
upstream main (the fix #57084 was closed unmerged) and hits every shape over 10 tile
rows, i.e. every chunk; ttsim reproduces it (2D post differs from 1D at S=2048).
So the post op runs as one generic_op over row groups x width slices with a
reader/writer that stride by the full row width and the image's own compute
kernel. The pre op stays 1D: a 2D pre op cannot be bitwise (split sum of squares).
Today 64 of 110 cores, ~46% of DRAM roofline (c127, 16.1 ms/chunk).

Off = module never imported. Warmup self-test (first engaged prefill norm, the
eager pass before trace capture) is bitwise vs the stock op from device tensors,
runs a one-row-off wrong-input rung every boot, and refuses under _MUSTFAIL.
ttsim bench/runs/u2-norm2d-sim-20261007T094556Z.jsonl: all_ok, 21 cells (S=128..2304,
bf16/bf8). norm2d.py gets its bind mount. No speed number yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Line 1 of the sim record is a run that died on a full /tmp; line 2 (20261007T095430Z) is
the rerun, all_ok. The image check (k2-mr-pk3r, no card) engages with the 0047 overlay and
refuses on CONTROL files and under MUSTFAIL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed before: chunk 2304 + 11x9 AGMM (g9c2304) costs 2.5-5.5% PP at 4k because a
4096 prompt runs 2304 + a 1792 tail padded to the 2048 bucket (4352 tokens), CI #7175.
A second parked chunk trace at 2048 lets the plan pick 2048+2048 there and keep the
2304 chunks at 32k. The plan minimises estimated work (2304 tokens weighted 0.95,
fitted from #7175, an estimate), not raw tokens: the literal fewest-tokens rule
trades 2304 chunks for padding and gives back about half the 32k gain.

Needs QWEN36_PREFILL_CHUNK=2304; refuses prefix caching and single device. Off =
same buffers and calls. Boot self-test after every prefill trace is parked: 4096 and
4352 token prompts through the served entry vs eager references, bitwise, plus a
stale chunk-start rung that must differ; _MUSTFAIL serves the stale offset.
ttsim bench/runs/u3-chunkmix-sim-20261007T102337Z.jsonl: last line all_ok (an earlier
line failed an absolute PCC floor that the existing path also misses at that depth;
kept). Unit tests: 21,816 plans vs brute force.

model.py also carries U7's 4-line TT_NOC_MID_SKIP check in Qwen36Model.__init__,
which 756ec390 meant to include.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed before (lever-reeval-prefill §2): k_chunk 512 halves the online-softmax steps
for an est -0.2..-0.4 s at B8/32k, and only k=32 is dangerous (packed-verify.jsonl).
ttsim says more: q=256 with k=64 HANGS (34 min, k=128 took 104 s), so the floor is
128 and 32/64 and everything below are refused at env parse, before any op. Against
an fp64 reference no k stays within 1.05x the k=q=256 control's error in every
cell: k=512 fails at cs 0 (1.09x) and 2048 (1.37x), passes at 30720 (0.60x); k=128
passes at cs 0 and fails deeper. So no arm is derived; the knob lands so the
gate can be re-run on the served mcast fork (not in the Nix ttsim ttnn).

Unset = q_chunk as today, no self-test runs. Set: warmup self-test at two offsets on
seeded device activations in its own small paged K/V (live pool untouched), fp64
reference, wrong-offset rung must fail, _MUSTFAIL refuses. Records:
bench/runs/u6-sdkc-sim-20261007T*.jsonl (summary in ...T1230Z-summary).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
arms: U2/U3/U7 singles and combinations on the -dx-w2t CONTROL; switch classes for U2/U3/U6/U7
Some checks are pending
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 7m25s
tt-stack-ci / Report upstream drift (pull_request) Successful in 32s
tt-stack-ci / Serialized card gate (pull_request) Successful in 2h0m44s
cards-fresh cards: no verdict yet fp=c723f5a8fc928457
4763690488
CONTROL moved to -dx-w2t while these were built, so the arms derive from it (an arm
off the old -dx would lose w2t against the control). Six arms: nocmid (U7), norm2d
(U2), g9c2304-mix (U3 + chunk 2304 + 11x9 AGMM), nocmid-norm2d, g9c2304-mix-nocmid,
g9c2304-mix-nocmid-norm2d. No plain g9c2304 arm: LEVERS has it LOSS as screened (#189),
and U3 is its variant whose 4k plan keeps the control's numerics. No U6 arm: no
k_chunk passes its own fp64 gate in ttsim, so its boot self-test would refuse.

The nocmid arms carry the 0047 Path-I manifest (a strict superset of CONTROL's).
Every new flag is classed reboot: U3/U6/U7 are read at init or boot, and U2's
self-test reads back on its first engaged call, which only the eager warmup pass is
known to host. ttx lint OK at B=8,4,1 for all six; ttx unit tests 500 OK.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Member

Cards skipped

Could not take the mesh slot on cfx-llm2 for PR #201 4763690488a845ee7d12fdf80c47328ef2579a93 (busy or refused after --wait 7200). No boot. This skip is green.

## Cards skipped Could not take the mesh slot on `cfx-llm2` for PR #201 `4763690488a845ee7d12fdf80c47328ef2579a93` (busy or refused after --wait 7200). No boot. This skip is green.
Member

U2 self-test issue found while re-screening on CONTROL (#227, run 7551): both norm2d arms were refused at boot with {'live_S2048': {'exact': 0, 'mustfail': 0}}. The warmup chunk's input is torch.zeros(B, 2048) tokens, so all its rows are identical and the must-fail branch cannot differ. With live S == SELFTEST_ROWS the random case was skipped. The fix (random case always runs; live mustfail is informational) is on screen-201-joint db096a3, with details in #227. This branch carries the same code.

**U2 self-test issue found while re-screening on CONTROL** (#227, run 7551): both norm2d arms were refused at boot with `{'live_S2048': {'exact': 0, 'mustfail': 0}}`. The warmup chunk's input is `torch.zeros(B, 2048)` tokens, so all its rows are identical and the must-fail branch cannot differ. With live S == `SELFTEST_ROWS` the random case was skipped. The fix (random case always runs; live mustfail is informational) is on `screen-201-joint` db096a3, with details in https://git.bitp.cz/bitpartner/tt-stack/pulls/227. This branch carries the same code.
Author
Owner

Status: this 6-arm screen sits on stale -dx-w2t CONTROL and its U2 arms refuse boots (fix lives on #227 db096a3). #227 covers U2/U3/U7 on the newer joint CONTROL. Unique U6 content (k_chunk refusal + sim/test) stays here until #227's rebase decides its fate — then this closes as superseded. No card run on this branch (would waste boots).

Status: this 6-arm screen sits on stale -dx-w2t CONTROL and its U2 arms refuse boots (fix lives on #227 db096a3). #227 covers U2/U3/U7 on the newer joint CONTROL. Unique U6 content (k_chunk refusal + sim/test) stays here until #227's rebase decides its fate — then this closes as superseded. No card run on this branch (would waste boots).
Author
Owner

Superseded by #227 (rebased onto CONTROL E 2026-10-10: 4 arms re-derived via arm-derive.py, U2 self-test fix preserved, cards:go firing). U6 k_chunk content stays on this branch history; the screen moves to #227.

Superseded by #227 (rebased onto CONTROL E 2026-10-10: 4 arms re-derived via arm-derive.py, U2 self-test fix preserved, cards:go firing). U6 k_chunk content stays on this branch history; the screen moves to #227.
Grok closed this pull request 2026-10-10 03:29:14 +02:00
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.
Some checks are pending
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 7m25s
tt-stack-ci / Report upstream drift (pull_request) Successful in 32s
tt-stack-ci / Serialized card gate (pull_request) Successful in 2h0m44s
cards-fresh cards: no verdict yet fp=c723f5a8fc928457

Pull request closed

Sign in to join this conversation.
No reviewers
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!201
No description provided.