tail: traced prefill tail + slot copy, -2.7% B8/32k, -6% B8/4k, BIT_EXACT (LEDGER R-2026-09-30-tail) #132

Merged
Grok merged 12 commits from serving-throughput into master 2026-09-30 06:22:14 +02:00
Owner

Adds LEDGER R-2026-09-30-tail and sets the new best arm, prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail. The tail bundle has three parts:

  • traced masked-bucket prefill tails for 128–2048 (a #50 port);
  • a traced GDN slot copy;
  • conv finalize folded into the slot-copy trace.

trace_region_size is raised to 1 GiB.

Measured as a bundle on d8k16, ABAB with 3 controls against 2 tail runs, band 0.1–0.25%: B8/4k −6.26%, B8/32k −2.56%, B4/4k −2.44%, B4/32k −1.87%. TTFT drops by 1.1–2.5 s and TG is flat.

The shipping combination nhp-tail against nhp:

cell makespan vs nhp TTFT PP tok/s TG ms/token
B8/32k 84.22 s −2.70% 44.90 s 5,839 38.01
B4/32k 55.30 s −1.70% 22.44 s 5,840 31.93
B8/4k 36.91 s −5.97% 6.42 s 5,106 29.42
B4/4k 31.82 s −2.15% 3.20 s 5,117 27.75

Correctness:

  • greedy output BIT_EXACT against both d8k16 and nhp;
  • the must-fail arm fails equiv, as required;
  • retrieval 1.0 at 16k and 32k, early and late halves.

The tail bundle does not apply at B=1: with no batched buffers the identity check refuses the arm, so B=1 stays on nhp. This PR does not redeploy production. That is the owner's call.

🤖 Generated with Claude Code

Adds LEDGER `R-2026-09-30-tail` and sets the new best arm, `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail`. The tail bundle has three parts: - traced masked-bucket prefill tails for 128–2048 (a #50 port); - a traced GDN slot copy; - conv finalize folded into the slot-copy trace. `trace_region_size` is raised to 1 GiB. Measured as a bundle on d8k16, ABAB with 3 controls against 2 tail runs, band 0.1–0.25%: B8/4k −6.26%, B8/32k −2.56%, B4/4k −2.44%, B4/32k −1.87%. TTFT drops by 1.1–2.5 s and TG is flat. The shipping combination nhp-tail against nhp: | cell | makespan | vs nhp | TTFT | PP tok/s | TG ms/token | |---|---|---|---|---|---| | B8/32k | 84.22 s | −2.70% | 44.90 s | 5,839 | 38.01 | | B4/32k | 55.30 s | −1.70% | 22.44 s | 5,840 | 31.93 | | B8/4k | 36.91 s | −5.97% | 6.42 s | 5,106 | 29.42 | | B4/4k | 31.82 s | −2.15% | 3.20 s | 5,117 | 27.75 | Correctness: - greedy output BIT_EXACT against both d8k16 and nhp; - the must-fail arm fails equiv, as required; - retrieval 1.0 at 16k and 32k, early and late halves. The tail bundle does not apply at B=1: with no batched buffers the identity check refuses the arm, so B=1 stays on nhp. This PR does not redeploy production. That is the owner's call. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Grok added 12 commits 2026-09-30 06:22:08 +02:00
Believed before: each served B8/32k request carries a ~0.55 s fixed cost after its last chunk whatever
the tail length (analyst read of c110 log timestamps, docs/analysis/tp2-levers-20260929/p4-interleave.md),
attributed to host-bound eager dispatch of the masked tail bucket -- an estimate, since nothing timed
the phases between the 16/16 chunk line and the return. #50's traced tail (a83cace) was measured only
at bucket 2048 (c29, neutral) and never at 128-1024, where 6 of 8 sweep tails land.

What this adds (all inert when unset; no device op differs):
- QWEN36_PREFILL_PHASE_TIMING=1, read per request: host wall clock with synchronize_device per phase
  (rope_stage, chunk_setup, chunks, tail_reset, tail_prep, tail_dispatch = host enqueue of the eager
  tail, tail_device = the drain after it, tail_dma/tail_replay on the traced tail, tail_logits,
  last_logits, conv_finalize, logits_read, slot_copy/slot_snapshot, rest) and ONE
  "QWEN36_PREFILL_PHASE_TIMING engaged: len= chunks= tail= bucket= path= total_ms= | ..." line per
  request. Registered as a prefill wb knob, with QWEN36_PREFILL_LOGITS_FAST (read per call) for the
  must-fail rung. Timer = masked_bucket_trace.PrefillPhaseTimer (pure, unit-tested).
- QWEN36_PREFILL_BUCKET_TRACE=<buckets> (boot time): a83cace's model.py wiring and gdn/tp.py gdn_masks,
  ported onto the current tree with four changes: the masks reach GDN via TPGatedDeltaNet._mb_gdn_masks
  (no layer.py mount; layer.py is overlay-owned); buffers are allocated and the traced body compiled
  BEFORE the chunk trace parks (a83cace compiled after it, the #48536 clobber class); the capture bakes
  the QWEN36_GDN_CONV_WINDOW_ONCE defer state and a replay whose state differs falls back to eager;
  the fill page table's pad entries always point at the scratch block (mapped_pad=False), never at a
  block-table entry past the request's real blocks. Every input is rewritten on every replay (#52).
  QWEN36_PREFILL_BUCKET_TRACE_MUSTFAIL=stale skips the value-input rewrite (tokens, rope, masks, conv
  one-hot; address inputs still rewritten) so an equiv gate must FAIL on it.
- wb_backend releases the bucket traces on set/reload; verify-arm-banners checks both halves.

No hardware run, no speed number. Offline: py_compile, masked-bucket helper tests 22/22 (nix python
with torch), ttx tests pass except the pre-existing pytest-less test_seed_symlink import.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed before: the tail fixed cost is host dispatch (estimate) and lever A (trace buckets 128-1024)
would take B8/32k -3% (analyst estimate, not a number). The first experiment splits the cost before any
served run spends card time on it.
- bench/probes/prefill_tail/run.sh: one dn workbench, rungs off / pt / mf-lf0 / pt2 at ctx 55, 2049,
  2176, 3072, 4095, 4096 (each wb prefill times L and L+2048 through prefill_forward ->
  prefill_paged_slots at max_batch 8, i.e. the served masked-tail path: tails 55/1/128/1024/2047/none
  on 0-3 chunks). mf-lf0 = QWEN36_PREFILL_LOGITS_FAST=0: logits_read must grow at every length, else
  the timer is not seeing the phase it names. summarize.py applies the analyst's kill/promote rule.
- dn-tt = dn + QWEN36_PREFILL_BUCKET_TRACE=128,256,512,1024 (banners/absent copied: lists replace).
  dn-tt-mf = + QWEN36_PREFILL_BUCKET_TRACE_MUSTFAIL=stale; its equiv MUST FAIL.
- bench/queues/c117-tail.txt: the probe, dn/dn-tt/dn/dn-tt sweep32k screens, equiv vs colpar2 on
  dn-tt and dn-tt-mf, reboot_if_leak between. Cache key unchanged (044f5c82). Nothing run yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed before: once QWEN36_GDN_SLOT_DEVICE_COPY moved the per-request GDN state hand-off onto the
device, what was left after the last prefill chunk was the tail forward itself. c117
(bench/runs/c117-prefill-tail-phases-20260929T231714Z.jsonl, served TP=2 path) split it and showed
two fixed costs that do not depend on prompt length and are almost pure host op dispatch: slot_copy
112-115 ms (_write_gdn_slot_from_scratch: 48 layers x clone + slice/concat/copy) and conv_finalize
31 ms (48 x finalize_conv_window), about 145 ms per request.

QWEN36_GDN_SLOT_COPY_TRACE=1 (boot time, requires QWEN36_GDN_SLOT_DEVICE_COPY=1, refuses to boot
otherwise) warms, before the chunk trace parks, and captures, after the chunk + bucket traces, ONE
trace per decode slot that writes the bound B=1 scratch into that row of the batched decode
buffers. With QWEN36_GDN_CONV_WINDOW_ONCE on, the conv finalize is folded in (the window is written
from conv_carry straight into the row) and prefill_paged_slots, only there, tells
prefill_traced_chunked to skip its eager finalize. Request time is one non-blocking execute_trace.
The body reads the scratch in place (no clone; TPGatedDeltaNet._write_index_keep is a
non-consuming _write_index), frees every temporary it makes, and the replay checks by identity that
the scratch and batched tensors are the ones the traces baked. Banner
"QWEN36_GDN_SLOT_COPY_TRACE engaged: <n> slot traces, conv_finalize=<folded|eager> (... TRACE region
+X MiB)"; falsifier QWEN36_GDN_SLOT_COPY_TRACE_MUSTFAIL=wrongslot replays slot (s+1)%B.

Arms: d8k16-tail, d8k16-tail-mf (bucket stale + wrongslot, equiv must FAIL), d8k16-nhp-tail, all
with QWEN36_PREFILL_BUCKET_TRACE=128,256,512,1024,2048. ttx lint OK. Host-only test
tests/test_gdn_slot_copy_trace.py (fake torch-backed ttnn) proves the traced body leaves the batched
buffers equal to finalize + clone + write_slot for every slot, fold on/off, fp32/bf16 targets.
No hardware run: no new speed number. Trace-region footprint at 512 MiB is unmeasured.

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>
Believed before: #50 bucket traces were neutral (c29 traced only bucket 2048), so tail tracing was ranked low. c117 put
~0.5 s/request in host dispatch after the last chunk; tracing the small buckets plus the 48-layer slot copy recovers
most of it, and it scales with the requests admitted per step, hence B8/4k.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
LEDGER R-2026-09-30-tail: traced prefill tail bundle (bucket traces 128-2048 + slot-copy trace + folded conv finalize); nhp-tail best: B8/32k 84.22 s, B8/4k 36.91 s, BIT_EXACT, must-fail fails, retrieval 1.0
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 1m13s
tt-stack-ci / Build simulators and check the host module (push) Failing after 1m4s
tt-stack-ci / Report upstream drift (push) Successful in 9s
9fd6100423
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Grok merged commit 9fd6100423 into master 2026-09-30 06:22:14 +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!132
No description provided.