Perf loop c27–59: bit-exact stack −16…−18% B=8 makespan, EFMG −23% (escalated), MTP-batch (off), ttx gates/lint #102

Merged
Grok merged 60 commits from serving-throughput into master 2026-09-27 11:49:41 +02:00
Owner

Perf loop, cycles 27–59, plus harness, MTP-batch and research. Every lever is off by default and gated by its own QWEN36_* flag. Production serving is unchanged until the owner redeploys with flags set.

Merge gate (on hardware)

  • With every new lever off, this tree serves greedy output 8/8 bit-identical to master's production sources. Master's own self-check is 8/8. Setup: B=8, 8 × 4k prompts, 128 tokens, thinking on. Record: bench/runs/merge-gate-serving-throughput-20260927T0950Z.jsonl.
  • test_prod_matches_nix passes. The Nix unit now mounts mtp_batch.py and mtp_batch_host.py: qwen36_vllm.py imports mtp_batch_host unconditionally, so a deploy without these mounts would fail at import.
  • ttx unit tests: 119 pass. check-cited-records.py passes.

Confirmed improvements (LEDGER, TP=2, G2 bfp4, bf8 KV)

stack B=8 makespan 4k / 16k / 32k vs loop control greedy LEDGER
bit-exact best prod-g2-EF-gdnfused-sdpa (image k2-mr-pk2) −16.2 / −17.1 / −17.6% 8/8 bit-exact R-2026-09-27-stack-bitexact-sdpa
prod-g2-EFMG (image k2-mr-pk) −24.3 / −22.8 / −22.8% near-ties ≤ 0.75 (escalated, #93) R-2026-09-27-stack-EFMG

B=1 on the bit-exact stack: TG 37.9 ms/token (loop start 50.8), PP about 3.9–4.1k tok/s. EFMG at B=1: TG 32.6 ms/token.

Bundles E and F, fused GDN, and SDPA GQA multicast at q=128 are all bit-exact, each with its own LEDGER entry and records.

Included but NOT yet proven on hardware (default off)

  • QWEN36_MTP_BATCH (batched MTP, docs/MTP-BATCH.md). It passes its host tests and the ttsim mechanics probe. Its B=8 greedy check has not run yet (the c58 attempt was void because of a harness bug, since fixed).
  • The decode host/device split probe (queued), and the multi-reader lm_head lever (killed at op level, perf-loop-c54).

Tooling and docs

  • ttx: lint before every boot; batched_only banners; equiv, gsm8k and retrieval suites; a discarded warm cell; card_s and outcome in every record.
  • Docs: docs/PROCESS-REVIEW-2026-09-27.md, docs/RESEARCH-KERNEL-WORKBENCH.md, and the tt-bundle-loop skill updates.

Deploying either stack is the owner's call. It needs the k2-mr-pk2 (or k2-mr-pk) image plus the arm's env.

🤖 Generated with Claude Code

Perf loop, cycles 27–59, plus harness, MTP-batch and research. Every lever is **off by default** and gated by its own `QWEN36_*` flag. Production serving is unchanged until the owner redeploys with flags set. ## Merge gate (on hardware) - With every new lever off, this tree serves greedy output **8/8 bit-identical** to master's production sources. Master's own self-check is 8/8. Setup: B=8, 8 × 4k prompts, 128 tokens, thinking on. Record: `bench/runs/merge-gate-serving-throughput-20260927T0950Z.jsonl`. - `test_prod_matches_nix` passes. The Nix unit now mounts `mtp_batch.py` and `mtp_batch_host.py`: `qwen36_vllm.py` imports `mtp_batch_host` unconditionally, so a deploy without these mounts would fail at import. - ttx unit tests: 119 pass. `check-cited-records.py` passes. ## Confirmed improvements (LEDGER, TP=2, G2 bfp4, bf8 KV) | stack | B=8 makespan 4k / 16k / 32k vs loop control | greedy | LEDGER | |---|---|---|---| | bit-exact best `prod-g2-EF-gdnfused-sdpa` (image k2-mr-pk2) | −16.2 / −17.1 / −17.6% | 8/8 bit-exact | `R-2026-09-27-stack-bitexact-sdpa` | | `prod-g2-EFMG` (image k2-mr-pk) | −24.3 / −22.8 / −22.8% | near-ties ≤ 0.75 (escalated, #93) | `R-2026-09-27-stack-EFMG` | B=1 on the bit-exact stack: TG 37.9 ms/token (loop start 50.8), PP about 3.9–4.1k tok/s. EFMG at B=1: TG 32.6 ms/token. Bundles E and F, fused GDN, and SDPA GQA multicast at q=128 are all bit-exact, each with its own LEDGER entry and records. ## Included but NOT yet proven on hardware (default off) - `QWEN36_MTP_BATCH` (batched MTP, docs/MTP-BATCH.md). It passes its host tests and the ttsim mechanics probe. Its B=8 greedy check has not run yet (the c58 attempt was void because of a harness bug, since fixed). - The decode host/device split probe (queued), and the multi-reader lm_head lever (killed at op level, `perf-loop-c54`). ## Tooling and docs - **ttx:** lint before every boot; `batched_only` banners; `equiv`, `gsm8k` and `retrieval` suites; a discarded warm cell; `card_s` and `outcome` in every record. - **Docs:** `docs/PROCESS-REVIEW-2026-09-27.md`, `docs/RESEARCH-KERNEL-WORKBENCH.md`, and the tt-bundle-loop skill updates. Deploying either stack is the owner's call. It needs the k2-mr-pk2 (or k2-mr-pk) image plus the arm's env. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Grok added 60 commits 2026-09-27 11:49:34 +02:00
Before: prefill fixed-cost levers from QB2 were untested on our TP=2 base, and our only
DRAM-sharded number (2-3x slower) predated multi-reader support. c40 shows bundle E outside the
apf control band on every cell; c41p shows the QB2 reader policy beats our 1D decode matmul on
every shape, so the #55922 image rebuild is justified. Gate + LOO queued (c42).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before: the QB2 plan listed N2-N5 as python-overlay-only decode levers and none was coded. c38 showed
the replicated seam alone (QWEN36_ONESHOT_AR, AG+fast_reduce_nc) is neutral because halving the CCL
count doubled each payload; QB2 instead ships a single-op all_reduce_async with a persistent L1
workspace and carries the residual in L1. This adds those, env-gated and default off, each with an
"<FLAG> engaged" banner:

- QWEN36_AR_ASYNC (N2, needs ONESHOT_AR): the out-proj all-reduce is ONE all_reduce_async (the
  buffer_tensor overload, present in v0.79.0-dev20260903) on cluster_axis 1, Linear, bf16, with one
  width-sharded L1 workspace allocated in Qwen36Model.__init__ (before warmup/trace capture) and shared
  by every layer, so its address is fixed for every captured trace. Workspace/grid = the decode norm
  input shard layout (32 cores), barrier semaphores from the axis-1 pool.
- QWEN36_RESID_L1 (N5, needs ONESHOT_AR): the replicated residual stays in that same width-sharded L1
  layout; both residual adds run sharded and the norms' reshard is a no-op. The fused residual-add
  rms_norm is not used: it returns only norm(x+r) and the residual is still needed.
- QWEN36_RS_CFG / QWEN36_NORM_AG_CFG (N4, #56119 names, "links,chunks,workers"): decode reduce-scatter
  kwargs at the three decode tt_all_reduce sites, and the pre-norm all-gather reissued in layer.py
  (the image DistributedNorm's model_config branch compares Mode to "decode" and is dead).
- QWEN36_FABRIC_PAYLOAD (N3): model_runner.py wraps ttnn.set_fabric_config to add a
  FabricRouterConfig payload, so no image worker.py has to be vendored.

ttsim (correctness only, 9B dims, 1x2): AR_ASYNC and AR_ASYNC+RESID_L1 over two chained decoder layers
are BIT-EQUAL to the production fractured RS+AG path at B=32 and B=8; RS/AG knobs bit-equal to
defaults. fp32 partials (GDN) lose bf16 rounding in AR_ASYNC (PCC 0.9999972 vs fp32 RS), the same as
the one-shot path. Trace capture is unsupported under ttsim slow dispatch, so trace safety is argued,
not simulated. No speed number: nothing ran on cfx-llm2.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The levers committed in d948d16 needed evidence that they compute the same thing as production before
any card time is spent. On the committed tree (clean), 1x2 ttsim, 9B dims, random weights:
- two chained decoder layers, B=32 and B=8: ONESHOT+AR_ASYNC and ONESHOT+AR_ASYNC+RESID_L1 are
  bit-equal to the production fractured RS+AG path (PCC 1.0, max_abs 0); RESID_L1 is bit-equal to the
  one-shot path it rides on; RS_CFG=2,1,1 + NORM_AG_CFG=2,4,1 bit-equal to default knobs;
- the same holds on an 8 KB fabric set through the model_runner set_fabric_config wrapper;
- fp32 partials under AR_ASYNC round to bf16 first (PCC 0.9999972 vs fp32 RS, like the one-shot path).
Trace capture cannot run on ttsim (slow dispatch), so it is recorded as not validated. Every lever arm
now cites its record; QB2 plan section 3 lists what was implemented.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before: the c41p one-card probe showed num_workers_per_dram_bank 2-3 cuts the decode
projections 12-28%, but on the TP=2 mesh every readers>1 matmul TT_FATALs in
get_worker_noc_hop_distance ("only supported on unit MeshDevice"), so D1 could not be
tried at TP=2 at all. #55922 (merged 09-11, not in our base) makes the reader placement
mesh-aware; its only host change is in ttnn and the MeshDevice overload it calls is
already exported by our libtt_metal.so, so a .so overlay on k2 is enough.

0024 carries the two ttnn hunks (placement + the k-row burst bound in the JIT reader),
not the unrelated CB-stats hunks. Built on nixos by docker/build-k2-mr.sh (clean
builder container, K ops re-grafted from k2, incremental ninja), verified in-build
(mesh overload imported, op surface == k2, bind-now import OK) and loaded on cfx-llm2
(62/68 layers deduped, no image removed). No device run; no speed number.
Record: bench/runs/k2-mr-build-20260927T0000Z.jsonl.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
What we believed: a DRAM-sharded decode path needs a second, width-sharded copy of every
projection weight (the old .dramshard caches), which the TP=2 DRAM budget may not hold.
What ttsim showed (n6 probe, correctness only): the interleaved weight can be re-laid out
on device losslessly (uneven last shard included, so no padding and no cache change), and
the in-proj AGMM / minimal_matmul read the relaid weight bit-identically -- but the 2D
mcast prefill matmul reads a DRAM width-sharded weight WRONG with no error (PCC ~0.1).

So per role: w1/w3 (decode-only; prefill uses w_gate_up) and qkvzab / attn_qkv are relaid
out in place (0 extra DRAM); w2 and attn wo / GDN out get a decode-only sharded copy
(ESTIMATE ~2.2 GiB/chip), relayout refused. Readers/in0 default to the c41p winners and are
env-overridable (QWEN36_DECODE_MR_{ROLES,READERS,IN0,LAYOUT}). Banner lists the per-role
config; one counted QWEN36_DECODE_MR_LAYER line per converted layer; bad configs raise,
no fallback to 1D. Config is built from ModelArgs in tp_common, not model_config.py, so no
ttx tensor-cache key moves. The MLP half is in decode-levers/mlp.py (prod mounts the
image's mlp.py). Flag unset: every branch is inert.

Validated: tests/test_decode_mr_lever.py (7 tests, inside vllm-tt:k2-mr, no device).
Not validated: any model run, trace capture, L1 fit in-model, speed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ttx already selects an image per arm (top-level `image`, inherited, --image overrides);
nothing pinned that down, and this arm depends on it, so test_arm_image covers it. The arm
also keys the JIT cache by image id: k2-mr ships a changed matmul reader kernel, and its
binaries must not land in production's shared /var/lib/models/tt-cache/metal (which every
prod-derived arm inherits). Mounts decode-levers for the MLP half; its other flags unset.
Expects the full per-role banner and counts 64/48/16 MR layer lines so a half-applied
overlay is refused.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The record behind the QWEN36_DECODE_DRAM_SHARDED_MR layout split (relayout w13/qkvzab/
attn_qkv, copy w2/out). Correctness only, sim tree not the production fork, no speed
number. D1 in the QB2 plan now points at the image, lever, arm and both records.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before this, the lift audit had skipped the SDPA GQA K/V multicast as "TP=4 only". It had also
counted GDN prefill as only reachable via the scan multicast. Reading the code showed that both
multicasts run between cores on one chip. At BH=24 on 11x10 the scan multicast never engages, and
the fused prep->scan prim (#57440) is the upstream kernel that removes the DRAM intermediates. So
both go into one C++ patch on top of k2-mr.

The image must serve the control unchanged, so every change is opt-in:
- gqa_kv_mcast is a new SDPAProgramConfig field, default False. A request the op cannot take is
  TT_FATAL; it never falls back silently.
- The fused prim is reached only through an explicit ChunkGdnFusedProgramConfig. The phased files
  and kernels/ are restored to the tag. verify-k2-mr-pk.py checks the kernels/ sha256 against k2's.

Built on nixos; shipped to cfx-llm2 (docker load, nothing removed).
No new speed number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Overlay wiring for the 0025 image. Each lever raises at engagement on an image without the op
surface and logs its banner once. SDPA picks q=k=256 when 12 heads x S/q fit on 110 cores;
otherwise it logs and keeps the default schedule. GDN wraps the op once and passes the fused config
only at BH <= 32, so batched BH=48 stays phased.

ttsim was run inside the image itself, not the nix/sim tree, which lacks 0025. At S=2048 with
chunk_start 0 and 2048, the SDPA mcast is bit-exact against the default schedule at the same chunk
size, and the op log shows the mcast ENABLED. The fused GDN cannot run on ttsim 1.9.9 because of an
unimplemented NoC atomic, so its correctness is upstream's claim until a card run.

Arms: a control on the same image, one arm per lever, and bundle G. All inherit bundle E with the
image-keyed metal cache. There is a ttx test for them.
No new speed number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
What we believed: D1 (QWEN36_DECODE_DRAM_SHARDED_MR) covered the decode weight reads, and the lm_head
was a bf4 tail item. What the code says: the lm_head is ONE bf8 [5120, 124160] tensor per chip
(675 MB per decode step, the largest single weight read) on ttnn-auto HiFi2, untouched by D1. A single
DRAM-sharded op cannot hold it: the kernel's in1 CB is reader_width x in0_block_w tiles triple-buffered,
3.2 MB per core at 2 readers vs 1.5 MB of L1. So, as QB2 #57914 does, it runs as 8 chunk matmuls
(485 tiles each; 31 tiles = 33.7 KB per reader k-row, i.e. exactly the >16 KB read the #55922 burst
bound in vllm-tt:k2-mr exists for).

Design: chunks are sliced from the interleaved head ON DEVICE and re-laid out DRAM width-sharded (no
tensor-cache change); the interleaved head stays for prefill (x_last, PREFILL_LOGITS_FAST, bucket path),
since the prefill 2D matmul misreads a sharded in1 (n6). Cost +659 MiB/chip at the defaults. One
activation reshard, 8 matmuls at the auto path's HiFi2/no-fp32/L1-acc, each result to DRAM, one
concat: the same [1,1,B,124160] bf16 TILE DRAM tensor, so the device argmax and the gather modes run
unchanged. Routed only from the traced decode step (_lm_head_matmul(decode=True)).

Fail closed: flag set without D1, at TP=1, with a replicated head, or together with
QWEN36_1D_GRID_LM_HEAD raises at boot; a bad chunks/readers/in0 or an estimated L1 overflow raises at
boot; a config the device rejects raises at warmup. Unset = inert (no copy, no routing change).
Banner: "QWEN36_DECODE_MR_LMHEAD engaged: <config, copy MiB, L1 estimate>". Knobs
QWEN36_DECODE_MR_LMHEAD_{CHUNKS,READERS,IN0} default 8/2/40, placeholders until the n5 lm_head probe.

Found on the way (n5 smoke on ttsim): a full-range ttnn.slice returns the input's buffer, so chunks=1
would have deallocated the prefill head; chunks=1 now relays out without slicing.

Validated: tests/test_decode_mr_lmhead.py (12 tests: config/env/fail-closed/banner in the ttsim nix
shell, model.py routing via AST lift anywhere); test_decode_mr_lever.py still 7/7.
Not validated: any card run, trace capture, in-model L1 fit, speed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
What we believed: n5's lm_head_chunk shape (5120x16384, bf4, LoFi/fp32) was the D2 probe. What the
model says: our head is bf8 [5120, 124160] per chip on ttnn-auto (HiFi2, no fp32 acc, L1 acc), and a
standalone chunk time omits the reshard, the to-DRAM moves and the concat the decode step pays. So
`--shapes lm_head` now times the FULL per-chip head: auto (prod), explicit 1D (QWEN36_1D_GRID_LM_HEAD),
and the lever's own chain (tp_common code, not a re-derivation) over chunks x readers x in0, with PCC
and argmax mismatch vs auto; the L1 guard is bypassed there so the device calibrates the estimate
(l1_guard_refuses is logged). lm_head_chunk8 (our 485-tile chunk) joins the per-shape loop at the
lm_head compute config. A reader k-row is 33.7 KB at 8 chunks / 2 readers, over the 16 KB burst the
#55922 kernel fix bounds, so the run must use vllm-tt:k2-mr: run-card-image.sh takes ONE card through
the ttx slot, runs the probe in the image with the repo's tp_common.py shipped beside it, and stops
the container gracefully before releasing the slot. NOT run on a card.

n7 (ttsim, 1 and 2 chips, record n7-mr-lmhead-ttsim-20260927T0600Z.jsonl): chunks sliced on device
are bit-equal to their slices and the interleaved head survives; the chain returns the auto path's
tensor contract; PCC vs torch 0.99994 (auto 0.99993); 12/128 argmax flips vs auto on random logits,
all near-ties (<= 3 bf16 ulps; MR disagrees with torch on 6 rows, auto on 7), 0/32 with a clear
winner. No ttsim number is a performance number; greedy equivalence on the model is still owed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The first arm that can show whether the lm_head (675 MB/chip/step of bf8, untouched by D1) moves TG
when it runs on the multi-reader DRAM-sharded kernel. Inherits EFM unchanged (image k2-mr, the D1 layer
counts) and adds the lm_head banner with its config prefix, plus QWEN36_1D_GRID_LM_HEAD as an absent
banner since the lever refuses to share the decode head with it. Not booted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before: the #56119 GQA K/V multicast (0025) only engaged when every (head, q_chunk) unit got its
own core (units <= cores), so for 12 q heads x 2048 tokens per card it needed q=k=256 (96 units)
instead of production's 128 (192 units > 110 cores). c52 showed the 256 arm is not bit-exact
(6 wrong-token + 2 tie divergences of 8) while ttsim had it bit-exact vs the default schedule at the
same 256 chunk: the drift is the chunk-size change, not the multicast.

Change: SDPAProgramConfig.gqa_kv_mcast_pairs. When units exceed cores but the default schedule
gives every busy core exactly one causal zigzag pair (even q_num_chunks, total_pairs <= cores:
q=128 -> 96 pairs), the op keeps that per-core work unchanged -- same global_q_start/count, same
zigzag remap, same Q double buffer -- and only re-places the cores so the 6 q heads of a kv head
holding the same pair {p, N-1-p} sit on one tight rectangle and share one K/V stream (their causal
k-loops are identical). 16 groups of 6, the same rectangles the 256 mode already ran on cards.
Host code only (sdpa_program_factory.cpp, config field + nanobind); the reader kernel is 0025's.
Unfittable pairs requests TT_FATAL (no silent fallback). With the field unset nothing changes.

Image vllm-tt:k2-mr-pk2 68923445a379 (nixos): FROM k2-mr-pk + the rebuilt .so pair, both
build-time verifiers pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
QWEN36_SDPA_GQA_MCAST rewrites qk_chunk to 256, which is what broke greedy equivalence in c52.
The new lever leaves qk_chunk exactly as the control computes it (128 at S>=2048, 64 for tails)
and only adds gqa_kv_mcast + gqa_kv_mcast_pairs when the op can take the call (one-unit or pair
mode, mirrored in tp_common.sdpa_gqa_mcast_q128_kwargs); other calls keep the default schedule at
the same chunk and log once per shape. Banner "QWEN36_SDPA_GQA_MCAST_Q128 engaged"; fails closed
on an image without gqa_kv_mcast_pairs (k2-mr-pk and older) and refuses to run together with
QWEN36_SDPA_GQA_MCAST (they pick different chunks).

Arms: prod-g2-E-pk-sdpa-q128 (bundle E + lever), prod-g2-EF-gdnfused-sdpa (the c52 bit-exact
stack + lever), prod-g2-E-pk2-control (same image, lever off). Unit tests pass in k2-mr-pk2 (13)
and in k2-mr-pk (Q128 lever refuses). Probe bench/probes/pk/pk_q128_ttsim_equiv.py compares the
lever against the default schedule at the same q=k bitwise on ttsim.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The claim to test was that the c52 drift of the 256 lever came from the chunk change and that
multicast at q=k=128 with the default's per-core work would be exact. On ttsim (one chip, 12 q /
2 kv heads, hd 256, bf8, streaming compute, grid 11x10), gqa_kv_mcast_pairs vs the default
schedule at the same q=k gives torch.equal outputs (0 differing elements) at chunk_start
0/2048/16384/30720 on both the int and the flexible/traced chunk_start paths, plus the q=64 tails
(S=1024 pair mode, S=512 one-unit mode). The op log confirms pair mode engaged (groups=16,
units_per_core=2). An unfittable pairs request TT_FATALs. No speed number: ttsim has no timing,
and nothing is closed until the 8/8 greedy gate runs on cards.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
B=1 boots were refused because LOGITS_FAST / GDN_SLOT_DEVICE_COPY banners only print in
prefill_paged_slots, which runs only at max_num_seqs>1. They were believed to be always-on
banners; at B=1 the levers are inert. ttx now checks [expect] batched_only only when batched.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before: MTP on TT was B=1 by construction (upstream PR #55548 / mtp-thinkingcap, K=3,
27.1 ms/token), and the belief was that batching it needed new kernels for per-row
commits. The design in docs/MTP-BATCH.md shows every per-row commit can be expressed
with the kernels already in the image: GDN verify as T sequential sub-steps of the
production decode kernels (inplace_state=False, per-depth history kept) plus a
where-chain select; attention KV via grouped paged_update_cache + grouped paged SDPA at
the plain-decode width; verify at M = B*(K+1) <= 32 so every decode config stays valid.
So no C++/image change is required for correctness; the C++ items (per-row state-index
GDN commit, packed multi-position SDPA, on-device accept) are efficiency follow-ups.

The path is inert when unset, fails closed on an unsupported stack (resident/async on,
prefix caching, no mtp.* weights, a commit select that is not exact at warmup), and
prints banners for the model, scheduler and runner. The scheduler reserves K lookahead
slots and advances num_computed_tokens on multi-token commits; the runner takes ragged
outputs through take_mtp_extra_tokens(). Buckets 1/2, host sampling and any uncaptured
shape fall back to plain decode.

Not run on the cards: no new speed number (PP tok/s, TG ms/token unchanged). The
13 host tests pass, including a toy-LM spec-vs-plain token equivalence under joins,
leaves, condense, remap and fallback buckets.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The device ops the batched path leans on were unproven on ttnn: grouped paged SDPA per
depth, grouped KV updates with -1 skips, where/blend per-row select, the anchor gather.
The ttsim probe shows each bitwise equal to its plain reference (correctness only; no
ttsim number is a performance number). It also caught that paged SDPA refuses an
interleaved-L1 q, fixed in the previous commit by slicing q into DRAM.

Arms: prod-g2-EF-gdnfused-mtp (bit-exact base) and prod-g2-EFM-mtp inherit their base
arms and add QWEN36_MTP_BATCH=1, QWEN36_DEVICE_RESIDENT=0 (the step is host-mediated,
so async must be off) and the mtp.* source checkpoint (packed-G2 may lack the head;
ThinkingCap's mtp.* is byte-for-byte Qwen's). The banners require the model, scheduler
and runner engage lines, the commit-select self-test and the captured traces; the
resident/async banners are listed as absent, so a mis-set arm fails its identity check.

bench/ab/mtp-batch-equiv.sh: control capture (B=8, 8 x 128 tokens, logprobs 5), control
self-check, then the MTP arm compared under the near-tie rule (gap <= 1.94, thinking
off). An MTP arm that logged no speculative steps is marked VOID, not passed. It has not
been run: no new speed number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The base arms moved QWEN36_PREFILL_LOGITS_FAST and QWEN36_GDN_SLOT_DEVICE_COPY to
batched_only (they print only when max_num_seqs > 1); the MTP arms listed them as
unconditional banners, which would refuse a --max-num-seqs 1 boot for no reason.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Cycle 3 believed the per-op Tracy table was the only way to itemise the derived 20.7 ms
fixed decode cost, and that it was dead because op names are blank on vllm-tt:k2-tracy.
Re-reading the on-disk reports changed two things. Names are not needed: runtime ids recur
per replay, so steps can be segmented and per-card kernel time summed without them. And the
2026-09-24 captures failed for a different reason than names: one drain at step 252 read a
wrapped buffer (every runtime id unique, no complete step), while P0, draining per replay,
got 12/12 complete 2,251-program steps.

So the probe drains once per decode step inside a short file-triggered window
(derive_profiling_model.py --hook window). It opens the window after every stream has
prefilled, and it indexes and then truncates the raw per-core log on each drain so the SATA
budget holds. The wall step comes from a profiler-OFF control boot plus a no-window bench in
the profiled boot.

The analysis parser reproduces P0 exactly by replay session and by id-repeat/gap
segmentation (kernel 25.34 ms/device), and it refuses the 09-24 captures. Its core-grid join
matches CORE COUNT on 5,962/5,962 programs.

TP=1 is not covered: the 0.79/k2 tree has no TP=1 path, and the driver refuses it with the
reason. No hardware run, no new speed number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed: q256 SDPA mcast's gain required the chunk change that broke bit-exactness. Evidence:
the q128 variant keeps greedy identical and keeps about half the 32k gain. Confirm queued.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
qwen36_vllm.py imports mtp_batch_host unconditionally since the mtp-batch merge; the nix unit
did not mount it, so a deploy from this tree would have failed at import. test_prod_matches_nix
caught the file-set drift. prod-g2-master-tree is the merge-gate reference arm.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before: every perf experiment paid a ~280 s boot, and "weights" was assumed to be most of it.
The server logs (54 warm boots) show weights are 110 s. There is also ~65 s of host-side
bf8 KV zero-fill (ttnn::full packs on the host), 29 s of a multi-modal warm-up on a text-only
server, and ~33 s of process start-up. The existing warm server (25-36 s cycles) measures the
text-demo path at 50.8 ms/token against the served 32.6 ms, so it is not yet a perf
instrument.

Recommends evolving warm_server.py into a workbench built on the vLLM entry points, with a
±3% gate against served TG, per-program timing via the realtime profiler, and the
kernel-edit reload order (device kernels JIT from disk; host C++ forces a new process).
Adds a Nix inner loop: a dev-shell incremental Ninja build, per-.so store paths, and nix copy.
No hardware was run; no new speed number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
New bit-exact best prod-g2-EF-gdnfused-sdpa: -16.2/-17.1/-17.6% B=8 vs loop control.
The c57 B=4 4k +2.9% did not reproduce.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The 2026-09-27 process review (docs/PROCESS-REVIEW-2026-09-27.md) counted ~13 gate boots
lost to the harness, not to arms: identity refusals discovered only after a full boot (6,
~35 min), c47's missing fixtures, c58's default-model 404, and a first 4k cell that carries
the boot's cold JIT. We believed the identity check and the ad-hoc gate scripts were cheap
safety; the evidence says they cost more card time than several levers. No hardware was
used for this change; every test runs offline.

- `ttx lint <arm> [--seqs N...]`: every [expect] banner / batched_only / min_counts string
  must be a substring of some expansion of a format string in the STAGED overlay (f-string
  fields, %-codes, {} fields are wildcards); image-only sources (patches/**/*.patch,
  $TTX_IMAGE_SRC) warn; batched_only is checked per B (c56); the verifier's env flags are
  read from scripts/verify-arm-banners.sh itself. `ttx run`, `ttx up` and `ttx ab` lint
  first and refuse on an error (--no-lint skips). All current arms pass except
  decode-split-tp2-prof without its driver's --mount, which is exactly the refusal its
  comment promises.
- `--suite equiv | gsm8k | retrieval`: bench/batch-equiv-bench.py, bench/gsm8k.py and
  bench/kv-accuracy.py on the box against the session's port and served name, scripts,
  fixtures, references and the GSM8K dataset staged; a local preflight (--dry-prompts, ref
  width/tokens/prompt shas, sizes vs max_model_len) runs before any slot. equiv records
  n_exact, tie classes, gaps and a near-tie verdict (1.94, D-2026-09-25-identity-rule);
  captures land in bench/runs/equiv-ref-NAME.json and are never overwritten.
- sweep32k: a discarded 4k B=max warm cell (default on, own prompt salt), kept under
  `warm_cell`, never in metrics.
- Every record carries card_s and outcome (MEASURED/REFUSED/FAILED/VOID); a boot refused
  late still reports its card time; INDEX.tsv gains outcome and card_s columns.
- batch-equiv-bench.py --long-prompts N (default off): ~32k-token prose prompts on disjoint
  slices, run as a second batch, so a gate covers the chunked prefill path; a reference
  must match on them.
- tt-bundle-loop skill: the new commands, the confirm-boot rule (< 3x band, else a new
  axis) and re-running the loop control after each reboot or image change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merge gate: branch tree with levers off is 8/8 bit-identical to master's production sources
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 13s
tt-stack-ci / Build simulators and check the host module (push) Failing after 45s
tt-stack-ci / Report upstream drift (push) Successful in 9s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 5m54s
c93b248701
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Grok merged commit c93b248701 into master 2026-09-27 11:49:41 +02:00
Author
Owner

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

agent-gateway closeout (merged): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!102
No description provided.