mtp: MTP on TT, the TP=1 single-card path, the GDN decay-gate fix and the gates #82

Merged
Grok merged 72 commits from mtp-thinkingcap into master 2026-09-25 23:13:41 +02:00
Owner

MTP on the TT cards, the TP=1 single-card path, the L1-fit fix, the gates, and the skills — 71
commits from the mtp-thinkingcap branch.

Results, all recorded in docs/LEDGER.md (R-2026-09-24-mtp, R-2026-09-25-mtp-g2,
R-2026-09-25-mtp-tp1, R-2026-09-25-mtp-tp1-b, R-2026-09-25-gdn-gate-fp32, plus
D-2026-09-25-mtp-tp1 and D-2026-09-25-identity-rule):

  • MTP measured on our cards at ×1.4–1.6 at B=1, and on G2 it accepts at least as well as on P.
  • G2 + MTP runs on ONE P150a at TP=1, with acceptance matching TP=2. Gate (a) passed under the
    new identity rule; there is no TP=1 bug.
  • The GDN prefill error was localised to the decay gate's precision — it needs fp32, not just
    8-bit a/b (QWEN36_GDN_G_FP32, QWEN36_GDN_AB_BF8) — and the fix is free. The earlier tail-pad
    hypothesis is refuted at both TP=1 and TP=2.
  • Two full G2+MTP models side by side on the two cards, 38 + 26 arms, all OK.

Nothing under patches/prod-local-* or modules/ is touched: the work lives in
bench/mtp/ (drivers, arms, reducers, the overlay tree), bench/probes/, nix/mtp-pr55548/,
the mtp-tt skill, and the three docs pages.

One conflict, merged rather than overwritten: .claude/skills/tt-card-slot/SKILL.md existed
on both sides. The ttx version is the base — AGENTS.md makes it the only place slot rules live —
and this branch's unique material is folded in as a new section 8: the measured two-full-models
result (VmHWM ~9.3 GB per load, so loads must be staggered), CARD=mesh tp1-card.sh for TP=2
through the same wrapper, the legacy tp1-session.sh pair recipe, two-card-probe.sh,
guards.sh, the embed/lm_head upcast SIGKILL, and the pgrep -f over ssh trap. Nothing was
dropped from either side. docs/LEDGER.md merged without conflict and all pre-existing entries
are intact.

Verified after merging master in: docs/ still 11 files, no root CLAUDE.md, AGENTS.md is the
lean rewrite, QWEN36_PREFILLED_SLOTS_FIX still in qwen36_vllm.py, no PR #68 deletion
resurrected. Locally green: check-cited-records.py, nixfmt --check, nix flake check, and the
41 ttx unit tests.

🤖 Generated with Claude Code

MTP on the TT cards, the TP=1 single-card path, the L1-fit fix, the gates, and the skills — 71 commits from the `mtp-thinkingcap` branch. **Results, all recorded in `docs/LEDGER.md`** (`R-2026-09-24-mtp`, `R-2026-09-25-mtp-g2`, `R-2026-09-25-mtp-tp1`, `R-2026-09-25-mtp-tp1-b`, `R-2026-09-25-gdn-gate-fp32`, plus `D-2026-09-25-mtp-tp1` and `D-2026-09-25-identity-rule`): - MTP measured on our cards at **×1.4–1.6 at B=1**, and on G2 it accepts at least as well as on P. - **G2 + MTP runs on ONE P150a** at TP=1, with acceptance matching TP=2. Gate (a) passed under the new identity rule; there is **no TP=1 bug**. - The GDN prefill error was localised to the **decay gate's precision** — it needs fp32, not just 8-bit a/b (`QWEN36_GDN_G_FP32`, `QWEN36_GDN_AB_BF8`) — and the fix is free. The earlier tail-pad hypothesis is **refuted** at both TP=1 and TP=2. - Two full G2+MTP models side by side on the two cards, 38 + 26 arms, all OK. **Nothing under `patches/prod-local-*` or `modules/` is touched**: the work lives in `bench/mtp/` (drivers, arms, reducers, the overlay tree), `bench/probes/`, `nix/mtp-pr55548/`, the `mtp-tt` skill, and the three docs pages. **One conflict, merged rather than overwritten:** `.claude/skills/tt-card-slot/SKILL.md` existed on both sides. The ttx version is the base — AGENTS.md makes it the only place slot rules live — and this branch's unique material is folded in as a new section 8: the measured two-full-models result (VmHWM ~9.3 GB per load, so loads must be staggered), `CARD=mesh tp1-card.sh` for TP=2 through the same wrapper, the legacy `tp1-session.sh` pair recipe, `two-card-probe.sh`, `guards.sh`, the embed/lm_head upcast SIGKILL, and the `pgrep -f` over ssh trap. Nothing was dropped from either side. `docs/LEDGER.md` merged without conflict and all pre-existing entries are intact. Verified after merging master in: `docs/` still 11 files, no root `CLAUDE.md`, `AGENTS.md` is the lean rewrite, `QWEN36_PREFILLED_SLOTS_FIX` still in `qwen36_vllm.py`, no PR #68 deletion resurrected. Locally green: `check-cited-records.py`, `nixfmt --check`, `nix flake check`, and the 41 ttx unit tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Grok added 72 commits 2026-09-25 23:12:27 +02:00
Written for a successor agent picking up mid-benchmark. Carries the operational
rules, the numbers to quote, what is running right now and how to tell it is
alive, the levers that are measured vs merely committed, and the traps this
session already paid for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Believed: three host-RAM levers were all worth taking, and batching them would
save measurement time.

Measured, two arms, one rep each:
  hp-only  (pool 8->2)                        stage 3 PASS, reached stage 4
  bundle   (+ MALLOC_ARENA_MAX=2, swappiness=10)  stage 3 FAIL, 1 of 32

The hugepage cut stands: +5.9 GB of a 16 GB host (MemAvailable ~3.1 -> 9.0 GB
while serving), free=0 confirming UMD maps exactly one channel per card, and a
clean correctness gate.

MALLOC_ARENA_MAX=2 is dropped because it did the opposite of its purpose:
EngineCore RSS rose 1.97 -> 2.38 GB and VmHWM 4.70 -> 4.98 GB. The ~4.1 GB of
retained heap is real, but capping arenas is not what reclaims it. swappiness=10
is dropped with it -- not separable in this arm, and no measured benefit.

The bundle's 1-of-32 is NOT evidence against those two levers: one rep, and the
rate sits inside the intermittent band patch 0019 bounded at <=0.85%/request
rather than eliminated. They are dropped for buying nothing, not for being
convicted. This is exactly the attribution cost that batching trades for.

Still unproven: the aperture's effect on throughput. No hp=8 same-arm control
was run, and the hp-only figures are not comparable to the 328.5/88.9 baseline
(different arm, 0.0% vs 98.3% cached).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The in-flight benchmark landed while the handover was being written. Replaces
the 'in flight' section with the split verdict: keep the hugepage cut, drop the
arena cap and swap bias, and note that the aperture's throughput effect is still
unproven for want of a same-arm control.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It read the document and pushed back before accepting it. All four were right:

- Section 5 still listed MALLOC_ARENA_MAX and swappiness as levers to batch,
  contradicting section 2, which had just dropped them on evidence. Section 5 was
  written before the result landed and I never reconciled it.
- Section 2 carried stale in-flight bullets ('Arm 1 running >2h', 'Arm 2 chained
  to auto-start') sitting directly under the conclusion that both arms finished.
- 'PR #34 is merged - verify it deploys' gave no way to verify it. Merging is not
  deploying: the unit comes from the Nix closure via nixos-llm. Added the command
  and how to read either outcome.
- 'Ship device argmax + prefix caching' was ambiguous. The arm is NAMED prefix but
  vLLM prefix caching is off and blocked; the cached fraction is the benchmark
  reusing a prompt head. Renamed and warned.

Also recorded the batching lesson where it will be read: two levers were dropped
without being convicted because one arm could not attribute its own failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Short entry point that survives a TUI paste: the long handover lost characters
when sent into the terminal, so the successor gets a file path instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Believed:
Dropping fp32_dest_acc_en for chunked prefill SDPA to take the streaming
compute kernel (v2) on Blackhole might risk numerical drift below upstream's
PCC 0.984 gate on Qwen's TP=2, HD=256, bf8 paged KV shape.

Measured:
Standalone op probe on 2x p150a mesh across chunk positions n in [0, 15, 30, 62, 120]
(0 to 245,760 context tokens):
- PCC >= 0.9994 at every ladder point (0.999838 at n=0, 0.999447 at n=120).
- Max abs error <= 0.0039, zero NaNs/Infs. Accuracy gate PASSED.
- Op latency speedup: +1.8% at n=0 (0.54 -> 0.53 ms), +5.0% to +5.3% across all
  subsequent positions (e.g. n=62: 36.62 -> 34.71 ms, n=120: 70.30 -> 66.77 ms).
- Saves ~30.5 ms/chunk at 128k context and ~56.5 ms/chunk at 245k context across 16
  attention layers.

Probe script: bench/probes/sdpa_streaming_pcc_probe.py
Run record: bench/runs/sdpa-streaming-pcc-20260919T1129Z.jsonl
The PCC probe cleared correctness and measured ~5% at the op. That is not a
result yet: the 30.5 ms/chunk figure derived from it is arithmetic over 16
layers, and this repo has a documented history of prefill wins in that class
delivering 0 to -2% end to end.

Registers the prediction (1-3% makespan, TTFT slightly better, TG unchanged) and
the refutation (<0.5% is a negative result) before the measurement, plus the
banner and one-tree discipline the arm has to satisfy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The hugepages=8 control -- the ORIGINAL aperture, no arena cap, stock
swappiness -- failed stage 3 at 1 of 32 with the byte-identical assertion
("expected one of ['391']; got: '33'") that the RAM bundle failed on.

That settles it. The failure appears at both hugepage counts, with and without
the arena cap, with and without the swap change, and under both trace modes. It
is the intermittent defect patch 0019 bounded at <=0.85%/request rather than
eliminated, and it is not attributable to any host-RAM lever.

Retracts the suspicion that MALLOC_ARENA_MAX or swappiness hurt correctness. The
earlier record already declined to convict them on one rep; this is the direct
evidence that they were innocent. They stay dropped for buying nothing -- arena
capping measurably made RSS and VmHWM worse.

Two consequences worth carrying. This is a live production defect: about one in
32 concurrent requests returns a coherent-but-wrong answer that passes serially.
And methodologically, a single stage-3 rep cannot separate an arm's own defect
from this baseline rate, so any arm reporting exactly 1-of-32 needs repeats
before that failure is pinned on it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Predicted before measuring: makespan improves by less than 3%, TTFT improves
slightly, TG unchanged. All three held.

Measured at 93,739-token prompts, both arms stage 3 PASS, one source tree with
an env-only delta:

  conc  makespan        TTFT p50        TG (ITL)
  1     -1.56%          -2.11%          -0.19%
  4     -2.07%          -2.38%          -0.29%
  8     -2.15%          -2.42%          +0.58%

Prefill 2702.9 -> 2768.7 tok/s at conc-8.

The result that matters is TTFT. Both previously cleared optimizations -- bf8 KV
and device argmax -- left TTFT flat because both are decode-side, and TTFT is
what describes the wait at the target shapes, where the last agent waits 443 s at
8x128k and 609 s at 4x256k. This is the first lever to move it.

Makespan, TTFT and prefill tok/s all agree at ~2.1-2.4% and the effect grows with
concurrency, which is the mechanism behaving correctly: more concurrent prefill
means more SDPA. TG is flat within noise, confirming the arm touched prefill only.

The op probe measured ~5% on chunked SDPA; E2E delivers ~2.2%. That ratio is the
honest conversion and it is why the 30.5 ms/chunk arithmetic was not quoted as a
result. Upstream advertised 19-25% for this change.

One rep per cell, so a 2% delta has no error bar from this run -- the three-way
agreement across independent metrics is the support, not repetition.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
serve: integrate QWEN36_SDPA_STREAMING and prefilled slots fix into production
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 21s
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 32s
2d423b5b37
- Integrate cleared Patch 0020 (QWEN36_SDPA_STREAMING=1) into production inference:
  - Add sdpaStreaming option (default true) to modules/tenstorrent-serving.nix with fail-closed readiness probe check and mount assertion.
  - Bind-mount patched attention/tp.py from patches/prod-local-metal/.
  - Add QWEN36_SDPA_STREAMING=1 to nix/production-serving-recipe.nix and scripts/vllm-tt-serve.sh.
- Incorporate Patch 0019 (QWEN36_PREFILLED_SLOTS_FIX) in patches/prod-local-metal/models/demos/blackhole/qwen36/tt/qwen36_vllm.py.
- Record benchmark harness tomls and hugepages2 control run data.
The concurrency defect is real but rarer than predicted: 0 of 192 this run
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 4s
tt-stack-ci / Report upstream drift (pull_request) Successful in 6s
d1514f66f3
Predicted 1 to 2 of 6 reps failing, implying ~0.9%/request. Measured 0 of 6 --
192 consecutive requests, zero failures. The prediction is refuted.

Pooling every stage-3 run on a healthy arm (14 runs, 2 with a failure) puts the
per-request rate at ~0.48%, about half the earlier estimate. The defect is not
in doubt: it has been directly observed twice with a byte-identical assertion,
including once on the hugepages=8 control. It is simply rarer.

What this run cannot do is refute 0.9%: P(0 failures in 192 | p=0.9%) is 17.6%.
Nor can it separate "rarer than thought" from "the SDPA streaming arm changed
it", since this is the first multi-rep characterisation and it ran on that arm.

Research refutes the leading external candidate. Upstream 5b0b687f7f5 gates only
penalty-tracking buffers, which are read only when penalties are active; our
requests are greedy, and the change is warmup-time and deterministic, so it has
no per-request degree of freedom. No pin bump is justified for it.

The surviving candidate is verified in source: the async-ahead merge reads
per-bucket-width buffers (qwen36_vllm.py:352-357) via a bare position comparison
(generator.py:2145), while 0019's exclusion set is cleared every decode step
(generator.py:2158). One-step protection against many-step staleness. It is
concurrency-only and intermittent by construction, and being gated on
on_device_sampling it predicts the argmax asymmetry already in the data.

The practical consequence of a 0.48% rate is that the discriminating test
(TT_DECODE_BUCKETING=0) now needs 256+ requests to say anything, so the next
pass is expensive and should be budgeted as such.

Ran against the live serving container: zero boots, no lock, box up throughout.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The merge replay is blind to its own mechanism, so its zero means nothing
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 4s
tt-stack-ci / Report upstream drift (pull_request) Successful in 6s
8c02d00b21
E1 was meant to test the bucket-width staleness hypothesis offline: does the
async-ahead merge ever hand a slot a previous occupant's token? Predicted a
0.5-2%/request collision rate with bucket alternation and 0.000% without.

Measured 0 collisions across 5 arms and 64,000 replayed requests. That looked
like a clean refutation. It is not one.

Instrumenting the schedule rather than trusting the zero: over 19,200 steps,
steps with a non-contiguous live slot set = 0, steps with bucket < max_slots = 0.
With 32 requests, concurrency 16 and 8 slots, a freed slot is refilled from the
pending queue immediately, so num_active never leaves 8 and the bucket never
varies. The mechanism requires width alternation, so this model cannot produce a
collision whether or not the hypothesis is true.

This is the same failure this repo has built twice before -- an instrument
structurally unable to see the effect it measures. The difference is that it was
caught inside the probe, before a result was quoted. A zero from a blind
instrument is indistinguishable from a zero from a correct one.

The hypothesis stays OPEN. Its three code facts are independently verified:
bucket-keyed trace store (qwen36_vllm.py:352-357), bare position comparison
(generator.py:2145), unconditional per-step clear (generator.py:2158). What is
unproven is whether a stale entry's position can collide in practice.

E1 was chosen over E2 because it needed no hardware. Right on cost, wrong on
power. E2 (TT_DECODE_BUCKETING=0) remains the discriminator, and at the measured
0.48%/request base rate it needs 256+ requests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Log-only, inert unless QWEN36_MERGE_STALE_AUDIT=1.

The obvious instrument -- log every merge where dev_tok != host_tok -- is
useless, because that is the normal case the merge exists to perform. The
anomaly is staleness, and nothing records it. This stamps each (buffer, chunk)
with the step it was last used, which for a traced decode is also its last
write, and logs only a merge that consumes an entry more than one step old.

It also logs every bucket width change, which settles the question the offline
replay could not: whether the width varies at all under a real vLLM schedule.
That replay's hand-rolled scheduler pinned the bucket at 8 and was structurally
blind to the mechanism, so its zero carried no information.

Zero width changes under stage-3 concurrency kills the hypothesis. Stale merges
confirm it, and the fix shape is already known.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Caught the stale merge live: the device buffer outlives the batch that wrote it
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 13s
tt-stack-ci / Report upstream drift (pull_request) Successful in 13s
ffa88d8703
The audit found 5 stale merges in 96 requests, 2 of which substituted a
different token. The signature is unambiguous:

  dev_pos =[29, -1, -1, -1, -1, -1, -1, 28]
  host_pos=[22, 25, 27, 25, 22, 25, 27, 27]

Six slots inactive in the device buffer against eight active in the live batch:
that buffer belongs to an earlier request generation. Slot 7's stale position 28
equals the current host position plus one, so the bare comparison at
generator.py:2145 fires and takes a token from a request that is gone.

My predicted carrier is refuted. I expected decode-bucket-width alternation, and
there were ZERO width changes -- width was 8 throughout. The bucket store is not
the carrier here. The real one is simpler and worse: the merge block runs only on
reset_batch steps, so the buffer it reads can be many decode steps and a whole
generation old without any width change at all.

That also explains why 0019 bounded this without closing it. Its exclusion set is
cleared every decode step while the buffer persists across generations, so it can
only ever cover the step where a slot was prefilled.

Three of the five were benign -- width 1, device and host agreed, nothing
substituted. Stage 3 passed 3 of 3 even so, which fits a substituted token not
always producing a graded wrong answer, and matches the 0.48%/request rate.

Two caveats recorded in the run file: "gap" measures distance between merge
invocations rather than decode steps, so gap>1 is expected and is not itself the
anomaly; and the runner's banner guard reported not-engaged although the audit
plainly ran, so the evidence here is the WARNING output, not that guard.

The fix cannot live in the exclusion set. The buffer has to carry its own
validity -- a batch-composition or generation stamp checked before the merge.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
My teardown deleted the exec line and took serving down for 15 minutes
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 10s
tt-stack-ci / Report upstream drift (pull_request) Successful in 10s
2b4f0a25bf
The patch-0021 audit runner stripped its instrumentation with a line-pattern
delete. In this unit script the -v mounts share one physical line with the
"exec ... docker run --name vllmtt-prod" invocation, so the delete removed the
exec line itself. The service failed with "line 2: -v: command not found", then
hit the systemd start limit.

The setup half of that runner was guarded and fail-closed: it verified the mount
and the env var had landed before it would measure anything. The teardown half
had no guard and ran after the measurement, when nothing was watching. An
unexercised teardown is untested code pointed at production, and that asymmetry
is the real defect -- this is the second restore-path failure today.

Recovery rebuilt the override from the pristine nix store script and re-applied
the four deltas programmatically, checking every guard before restarting rather
than after: syntax, the exec line, the qwen3_xml parser, both patch mounts, the
SDPA env gate, and the absence of the audit. Serving is back with patches 0019
and 0020 confirmed live from their own banners.

The audit results are unaffected -- captured before the restore ran.

Standing rule: never mutate this start script by line-delete; rebuild from the
pristine source and re-apply, which is idempotent and cannot delete what it did
not add.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The stale merge is real, the guard is free, and it does not close the whole hole
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 6s
tt-stack-ci / Report upstream drift (pull_request) Successful in 8s
947872a7f6
Yesterday's audit caught the async-ahead merge consuming a device buffer that
outlived the batch that wrote it: dev_pos=[29,-1,-1,-1,-1,-1,-1,28] against an
eight-active host_pos, where slot 7's stale 28 satisfied host_pos+1 and
substituted a token from a finished request. The exclusion set cannot guard it
(cleared every decode step; the buffer outlives generations), so patch 0022
makes the BUFFER prove it belongs: its active-slot pattern must match the
batch's, or the merge falls back to host tokens through the branch the code
already takes on a shape mismatch.

Believed before: the fix might cost throughput, since it forgoes the
async-ahead token whenever it fires.

What the evidence changed. It is free. Against the current production baseline
on the same 93,739-token suite, every delta is inside +-0.5% -- makespan
-0.39/-0.21/-0.37% at conc 1/4/8, TTFT -0.48/-0.20/-0.29%, TG 86.2 -> 85.9
ms/token, prefill 2768.7 -> 2778.6 tok/s. These are single runs on separate
boots, so that is FLAT, not a win, and must not be quoted as one. Stage 3 PASS,
0 failing of 11. The guard fired 77 times and prevented 15 real token
substitutions; most rejects cost nothing but that step's async-ahead benefit.

Two things this does NOT establish. The guard keys on batch composition because
composition is the only thing that betrayed the confirmed incident, so a stale
buffer whose active pattern MATCHES the batch passes straight through -- audit
step=202 is exactly that, harmless only because its positions were far enough
apart that use_dev was False anyway. And dev_pos carries outright garbage
(1206993122, 1196966132) next to valid positions, so the buffer is not merely
stale, it can be uninitialized.

Attempt 1 reported GUARD_REJECTS=0 for a run where infbench never sent a
request: --stages takes a comma-separated list and the result grep swallowed
the argparse error. That zero was a harness failure, not a refutation, and the
runner now fails loudly when no result file appears. This project has now built
an instrument blind to its own mechanism four times.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The unaligned-resume gate dissolves: the path cannot be reached
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 4s
tt-stack-ci / Report upstream drift (pull_request) Successful in 8s
4f2cdc2671
Backlog lever 2 carried "unaligned-resume equivalence -- required before
prefix caching ships" as outstanding correctness work blocking the largest
makespan item in the project. It is not work. The condition it guards cannot
occur in any valid configuration.

Three enforced constraints compose. qwen36_prefix_cache.py:47 refuses a
block_size that is not a multiple of 2048. prefill_chunk_plan refuses a
block_size that does not divide chunk_size. model.py:2107 asserts the
2048-token chunk, and every call site passes 2048. Enumerating 64..32768,
exactly ONE block size satisfies both bounds: 2048. A resume start is a
prefix-cache hit length and so a whole number of blocks, therefore
start % chunk_size == 0 always and plan["lead"] is always None -- 0 of 1,400
enumerated (block_size, start, end) combinations reach it.

So the lead branch is defensive, not load-bearing, and must NOT be deleted:
it is the only thing between a future chunk_size change and a silent KV gap.
The trigger is explicit -- plan(2048, 9000, chunk_size=4096, block_size=2048)
returns lead=(2048, 2048), so raising the chunk above 2048 re-opens this lever
the same day.

Evidence that the offline instrument is not vacuous:
fixtures-prefix-chunk-plan-test.py passes 12 cases against the real prefix
model.py INCLUDING three unaligned shapes, and its negative control rejects
the unpatched logic on all 8 resume cases. The hardware reducer
bench/prefix_hit_equivalence.py passes 7/7 fixtures including the BLIND
detector.

One link is weaker than the other three and is recorded as such: that hit
lengths are whole blocks comes from the comment at qwen36_prefix_cache.py:28-30
plus vLLM's block-granular hit accounting, not from executing the hit path.

No hardware was used and no boot was spent. This also says nothing about
ALIGNED-resume numerical equivalence, which is the different question
cache-speed-16k-32k.sh's equiv_cold/equiv_warm/equiv_control phases exercise
and which has not been run on the current tree.

Process: I rewrote this offline test from scratch before finding the existing
fixture, which was strictly better. Grep bench/fixtures/ first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
serve: durable tool-calling, hugepage reclaim, merge batch guard & prefix caching
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 7s
tt-stack-ci / Report upstream drift (pull_request) Successful in 9s
369b48797c
Resolves and hardens across 4 key serving issues:
1. Issue #49: Fix tool-calling parser from hermes to qwen3_xml in
   tenstorrent-serving.nix so streamed tool calls populate properly;
   set default hugepagesPerCard=1 in tenstorrent-host.nix to reclaim +5.9 GB
   host RAM durably and prevent host memory exhaustion/OOM panics.
2. Issue #45: Enable QWEN36_MERGE_BATCH_GUARD=1 in generator.py and module
   environment to reject stale async-ahead device buffers whose active-slot
   patterns do not match the current batch, preventing stale token substitutions.
3. Issue #46: Add context window bounds check in generator.py to prevent
   uninitialized memory entries in the position buffer from leaking into
   position matching.
4. Issue #48: Add enablePrefixCaching configuration option and integration
   in modules/tenstorrent-serving.nix for prefix caching deployment.
Read-only comparison vs Thatch tip ci/qwen-hardware-correctness.
FIR (1->B) matches; #53314/#53319 fork vs PR-overlay delivery only.
No production patch changes.
serve: mesh/by-id gotchas, Thatch drift checklist, and upstream watch audit
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 4s
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
65c5cba994
Resolves and advances 4 key issues across serving, hardware, and upstream:
1. Issue #21: Codify Thatch mesh/by-id gotchas into scripts/vllm-tt-serve.sh
   (resolve_tt_devices, TT_DEVICE_BY_ID, MESH_PREFLIGHT), scripts/mesh-degree-preflight.sh,
   modules/tenstorrent-serving.nix (by-id guidance), and specs/p150x2/README.md.
2. Issue #20: Land docs/THATCH-FIR-DRIFT.md (read-only drift checklist vs Thatch tip).
3. Issue #36: Complete audit of vllm-tt-plugin #126 / #122; verified that our
   vendored model_runner.py already enforces prefill-first Phase 2 capture,
   protecting production from the batch-8 coherence bug without risking an
   incompatible tt-metal pin bump before #55343 merges to trymerge.
4. Issues #39 & #41: Complete audit of upstream BH SDPA stack (#56942-#56985)
   and AGMM GDN out-proj (#56759). Recorded status in docs/UPSTREAM-WATCH-PLUGIN-METAL.md:
   local 0020 remains ahead; AGMM out-proj held due to +764 MiB DRAM hazard on TP=2.
feat(serving): enable Phase 2a resident decode and live prefix caching
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 4s
tt-stack-ci / Report upstream drift (pull_request) Successful in 9s
f092aa37b1
- Add Patch 0023 for Phase 2a device-resident decode chain and on-device RoPE tables
- Wire dynamic supports_async_decode and supports_prefix_caching capabilities in qwen36_vllm.py
- Support deviceResident and enablePrefixCaching in modules/tenstorrent-serving.nix
- Update scripts/vllm-tt-serve.sh with DEVICE_RESIDENT and ENABLE_PREFIX_CACHING flags
feat(serving): complete unification of prefix caching and device resident decode
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 5s
tt-stack-ci / Report upstream drift (pull_request) Successful in 9s
d4199ce3a0
fix(resident): reshape tok_rm to tuple(tokens.shape) for ttnn.copy
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 3s
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
729a4ff5b3
bench(phase2a-prefix): stage 2/3 gates passed, B=1 decode drops to 48.5ms, makespan -87.5% at conc-8
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Failing after 5s
tt-stack-ci / Report upstream drift (pull_request) Successful in 9s
4e91d8708d
Claude Code now reads AGENTS.md natively, so the CLAUDE.md/AGENTS.md symlink
pair was a duplicate. The old file had grown to 656 lines, 479 of them a
newest-first ledger of owner directives and measured results that an agent had
to wade through before reaching the operating rules.

Split rather than trimmed: the ledger moves verbatim to
docs/DIRECTIVES-LEDGER.md with its 0aaa... labels intact, since ~30 docs cite
them as "CLAUDE.md precedence 0aaa" and that evidence must not be lost.
AGENTS.md is now 172 lines -- what the repo is, a pointer to the ledger plus a
six-bullet digest of what it currently says, the hard rules, the traps, and the
conventions. Added to the hard rules what recent sessions kept re-learning:
measure on hardware (extrapolation was wrong by +49% and +105%), arms must
self-identify from their own banners, build locally, always report PP/TG.
The owner directive of 2026-09-24 existed only as an uncommitted edit in the
serving-throughput checkout, so any agent reading git saw MTP as closed by
0aaaaa and AGENTS.md still listed it under 'closed by measurement'. It never
was closed by measurement (0aaaaa itself says the acceptance rate is unknown);
it was dropped on structural grounds, which the new entry reframes as problems
to solve for B=4/8.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
MTP was parked on 2026-09-12 with its acceptance rate never measured, and
the ledger now reopens it for ThinkingCap (#63). The parked harness could
not be pointed at a second checkpoint without two silent failures.

First, it hard-codes the shared /var/lib/models/tt-cache. That cache is
not keyed by checkpoint, and the new contract probe shows ThinkingCap has
the same base keys, shapes, FP8 scheme and config as our Qwen snapshot. So
a ThinkingCap run on it would load Qwen's weights and raise no error.
guards.sh now refuses that. It also refuses a checkpoint with missing
shards and a boot below 4 GB MemAvailable, and it stamps each tensor cache
with the checkpoint that built it.

Second, vllm-tt:mtp carries the eager FP8 loader, which needs ~54 GB of
host RAM on a 16 GB box. That is why the last attempt spent 1215 s in model
load. A cold cache build on top of it risks the host-OOM freeze. The
overlay mounts the lazy loader (a strict superset of the image's file),
plus one mtp.py hunk so it stops reading the whole checkpoint to find 13
tensors.

The contract also settles the loader question: ThinkingCap's 15 mtp.*
tensors are bf16 with no scale, and the spec tree's loader passes non-FP8
tensors through, so the head loads unchanged there. check_mtp_load.py
verifies this on the host and measures whether the head was retrained
(rel-L2 vs Qwen's). Only production's patch 0006, which drops mtp.*, needs
revisiting.

agentic_edit joins the prompt set because re-emission and free text differ
~10x in lookup acceptance and must never be averaged together.
reduce_accept.py turns one boot into acceptance, B=1 token-identical
equivalence against the fused-GDN plain arm, and verify_cost_ratio. It was
fixture-tested to pass, fail and refuse before seeing real data.

go_nogo_estimate.py is arithmetic, labelled ESTIMATE throughout. The B=1
and B=4 verdicts are GO. B=8 is a conditional go, because the 32-row
matmul tile caps K at 3 there. Acceptance on our workload and the per-row
verify cost are the two numbers that decide it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
We assumed a fine-tune that advertises MTP acceptance would carry a head
trained with it. It does not. The head's bf16 tensors are bit-identical to
Qwen's. Its FP8-in-Qwen tensors differ by a uniform 0.0265 rel-L2, which is
FP8 e4m3 rounding, not training. So the drafter predicts the base model's
next-next token. The base fine-tune is light: embeddings, lm_head, the
final norm and the FP8 scales are identical, and linear weights differ in
1-4% of FP8 bytes. That keeps the third-party 2.55/4 plausible for this
head, but acceptance stays an open measurement.

Header-level contract: PASS. Host loader check through the spec tree's
lazy loader: PASS, so no loader change is needed for bf16 mtp.* there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The first ThinkingCap B=1 run cleared every guard and finished a cold
model load with the MTP head on TP=2 in 550.6 s (the eager loader took
1215 s). The ThinkingCap tensor cache is now fully built. It was then
stopped from outside: a deploy-rs activation started
tenstorrent-serving.service, that failed on our held cards, and a
'systemctl stop' session SIGTERMed our container, which dockerd
force-killed after 60 s.

run-chain.sh reported that exit as 'SMOKE FAILED on a FRESH cache -> the
image is broken'. That would have re-filed the open 2026-09-12 JIT
question as settled, on a run that never reached decode. Exits 137, 143
and a guard refusal now say they are not an image verdict.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Since 2026-09-12 the open question was whether the JIT static assert came from a
stale shared kernel cache or the image. Attempt 2 ran the stock demo (SPEC=0, zero
custom code) on a FRESH kernel cache and hit the same assert
(compile_time_args.h:27 "Index out of range" building
writer_unary_stick_layout_wh_multicore): the ttnn 0.75 wheel's device headers do
not match the kernel sources baked into the image. The image is broken; the cache
is not. No acceptance, token-identity or speed number exists yet for any arm.

The run also exposed a harness bug that put someone else on live cards: the
build-error spam filled the `head -c` log cap, the SIGPIPE killed the docker
client (rc 141) but not the container, and release() freed /tmp/ttlock while the
container still held the cards. p150-autoresearch took the lock. Now release()
stops the container gracefully before it frees the lock, the log cap is an awk
filter that keeps reading instead of closing the pipe, and run-chain takes its
image verdict from the log rather than the exit code.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Attempt 2 showed the MTP image broken but not why at file level. Measured now:
the PR #55548 CI wheel is exactly 96f3f041 (4634/4634 files it shares with the
git archive of that commit are byte-identical), but /opt/tt-metal-src -- the tree
tt-metal JIT-compiles kernels from -- was left at the 0.79 production tree: 754
files differ and 1256 are missing, and the kernel that hit the static assert is
among them. The old Dockerfile swapped only the wheel and the qwen36 dir.

Dockerfile.onecommit rebuilds the tree from the 96f3f041 archive overlaid with
the wheel's own tt_metal/ and ttnn/cpp/, and verify_onecommit.py fails the build
unless archive, wheel and JIT tree agree. Nothing is compiled: it is a copy-only
layer on top of vllm-tt:mtp, so it is assembled on the box like k2-tracy was
rather than shipping a 17 GB docker save (the build host has 19 GB free and no
docker daemon). The same check run against vllm-tt:mtp is the negative control
and fails as it should.

The driver now builds the image and runs the 5 GB host load check inside the host
lock, so neither steals CPU or RAM from another agent's measurement.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The owner reads acceptance separately for agentic re-emission and free text, and
wants prefill tok/s and decode ms/token for both arms in every status. The
reducer pooled acceptance over prompts and reported no prefill figure at all.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
vllm-tt:mtp2 built and verified one-commit (0 mismatches), and the smoke now gets
past the JIT static assert: kernels compile, 64 layers load. It then dies in the
GDN conv1d while capturing the prefill trace: an L1 circular-buffer clash on a
[1,2051,1,5120] input. The PR hardcodes CHUNK=2048, validated on QB2 at TP=4; at
TP=2 each device carries twice the conv channels. The ttm-build tree already has
the QWEN36_PREFILL_CHUNK override for exactly this, so the overlay adopts it, with
512 as the default (the chunk found stable on the ornith tree).

The owner gave the next card slot to the ThinkingCap baseline agent, so
after-owner.sh holds our driver until that agent has taken and released the lock,
rather than grabbing it in the gap before they arrive.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner requirement: reusable knowledge lives as repo skills. mtp-tt captures the
MTP bring-up as it now stands (one-commit image + build-time check, per-checkpoint
tensor cache, harness, reducers, gates) and the five traps hit on 2026-09-24.
tt-card-slot is the generic cfx-llm2 slot protocol, including the lock released
under a live container and the head -c log cap that caused it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed after attempt 4: the conv1d L1 clash was the PR's 2048-token chunk. Measured:
the conv's static CB region ends at 1094720 whatever T is (2048 and 512), and
moving qkvzab to DRAM still leaves persistent L1 buffers ~260 KB below it. Replacing
the conv with the MAC FIR the masked buckets already use gets past it, and then the
device hangs later in the layer prefill, with the fused chunk op and with the seq
adapter alike. Async dispatch means the host blocks at the next queue wait, so the hung
op is not identified; TT_METAL_OPERATION_TIMEOUT_SECONDS converts it into a TIMEOUT
but names nothing, and triage needs ttexalens, which the image lacks.

Nothing after the GDN conv had ever executed at TP=2 before today: the PR was validated
at TP=4 only. The overlay keeps the env switches (default to the workarounds) and
EXTRA_ENV for diagnostics; the port onto the production tree is now the critical path.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The hang could not be attributed: async dispatch makes the host block at the next
queue wait (py-spy named two different innocent ops), the op timeout names nothing,
and tt-metal's own triage needs ttexalens. vllm-tt:mtp2-triage adds the triage deps
at the versions the 96f3f041 tree pins, as binary wheels, and re-runs the one-commit
check. opsync.py syncs after every ttnn op so the last unmatched marker is the hung
op. triage-hang.sh runs both in one card slot, holding the lock throughout, and
resets the cards after each hang.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed: the fused chunk_gated_delta_rule or a ttnn.copy hung, because that is
where py-spy found the host. Measured on a live hang, two ways that agree:
tools/triage reports the running op as MatmulReduceScatterAsyncDeviceOperation
([1,1,512,3072]fp32 x [3072,5120]bf8, both devices), with every reduce-scatter
reader/reduction core parked on a semaphore or CB wait and no matmul kernel left;
op-level sync leaves ttnn.experimental.matmul_reduce_scatter_async (layer 0 GDN
out-proj) as the last op that never completes. Production already gates this
fusion off for 2-device unit-dim meshes; PR #55548 was branched without the gate.
The overlay applies the same gate (QWEN36_GDN_OUT_MMRS=auto) and restores the
fused chunk op as default, which was innocent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Attempt 10 ran the eager chunked prefill through all 64 layers at TP=2 for the first
time, confirming the diagnosis. It then failed in the masked-bucket warmup because the
persistent vision-merge buffers are sized to the prefill chunk (our 512) while the
buckets reach 2048. The 512 override was only ever for the conv1d L1 clash, which the
FIR sidesteps and which never depended on the chunk, so the default returns to the
PR's 2048 and prefill numbers become representative again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With the MMRS gate, the FIR conv and the 2048 chunk, the stock demo passes at TP=2:
ttft 0.40 s on 128 tokens, plain decode 18.72 tok/s (53.4 ms/token, PR tree, not
production). The MTP matrix is now running.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The first spec arm after the smoke passed died in the verify trace capture:
paged_sdpa_decode with spec_multi_pos_tiles TT_FATALs unless num_kv_heads == 1 per
device. That is a TP=4 fact (4 KV heads over 4 devices); at TP=2 each device holds 2.
The overlay routes TP=2 to the PR's own legacy B=T verify call (one pseudo-user row
per candidate), which reads the KV cache T times per layer instead of T/Tg -- slower,
so verify_cost_ratio from this tree is an upper bound for a TP=2 port.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Until now the B=1 go/no-go (x2.01 at K=5) rested on third-party acceptance and a
modelled verify cost. With the MMRS gate, the FIR conv, chunk 2048 and the
legacy verify-SDPA fallback, the full 20-arm matrix completes on the P150 pair.

Measured committed tokens/iter: agentic 3.27 (K3) / 4.02 (K7), free text
2.82 / 3.22, code 3.98 / 7.62. verify_cost_ratio 1.25-1.43 (upper bound: the
fallback reads KV T times). Decode 54 ms plain -> 33 ms agentic K3 (x1.64),
20 ms code K7 (x2.67), 54 ms prose K7 (break-even).

But greedy token identity FAILS on 7/8 arms (code passes). Both paths are
deterministic and the divergence position does not depend on K, so it is a
fixed numeric difference between verify and plain decode; not yet localised.
The speedups are not licensed until it is. The skill records the working
TP=2 overlay defaults and this state.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The P1a matrix showed greedy spec output diverging from plain decode at a
K-independent position on 7/8 arms. The token ids alone cannot say whether
that is a bf16 near-tie flipped by a different numeric path or a real bug,
and the owner needs that distinction to decide on a tolerance.

QWEN36_LOGIT_PROBE=1 records the top-16 logits of every row a token is
emitted from: plain decode reads its trace's vocab-sharded logits after each
replay; the spec wrapper turns on the verify [T, vocab] readback and keys
each row by the output index it predicts, dropping rejected-draft rows
offline by context. reduce_gap.py compares each pair at its first divergence
(margin of each path for its own token, the swing between paths) against the
path-to-path margin noise on the common prefix, with fixture tests.

arms-gap-b1.json adds 4-5 prompt variants per regime (n>1), the plain
fused-vs-unfused reference pair, and one-at-a-time swaps at the end: the
per-token verify loop and native conv1d in verify (QWEN36_GDN_CONV1D_VERIFY).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The P1a matrix failed greedy token identity on 7/8 arms, and it was open
whether the verify path was wrong or merely rounded differently. With
top-16 logits recorded on both paths over 20 prompts (n>1 per regime):
every divergence is between the top-3 candidates of both paths, plain's
own margin is <= 0.5 logit (<= 4 bf16 ulps; 4 are exact ties), and every
swing (<= 0.875) sits inside the path-to-path margin noise of the plain
fused-vs-unfused control (p99 1.25), which itself diverges on 3/4 prompts.

A strict 2-ulp rule still flags 5/18, so the tolerance stays an owner
decision; this supplies its scale. The reducer now judges the swing
against the pooled noise of each pair kind: a 17-token prefix is too short
to set a scale. The per-token verify swap is stale in the PR (host
TypeError) and localisation was not needed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner 2026-09-25: run MTP on the bfp4 quant (bfpq arm G2) and iterate faster
with two single-card instances. AGENTS.md said one tt-metal process per host.
Measured under the lock (two-card-coexistence record): that holds for MESH
processes only. One container per card with a single --device node, like the
TT_VISIBLE_DEVICES variant, opens, computes and closes while the other card is
busy, and both cards open cleanly afterwards. No hugepages are used, and no
pinned-page leak shows. But the PR #55548 spec path asserts num_devices > 1,
so a TP=1 MTP instance needs new code, and the E2E A/B falls back to
serialized TP=2 (tp1-feasibility record).

The PR-tree loaders get the bfp-quant QWEN36_ATTN_GDN_BF4 gate: 5 attention
and 4 GDN weight sites, matching the bfpq copies. The MTP head builds its
attention through the same loader, so it would have silently gone to bf4 RTN
of its bf16 weights. It is exempted by default, with its own banner, so the
drafter is identical across quant arms and only the base model differs.

g2-ab.sh holds one lock over G2 then P (run-mtp-ab.sh gains LOCK_OWNER).
Arms self-identify by banner count (G2 64 engaged + 1 exempt, P 0). The
logit probe is per arm, so timed speed arms carry no readbacks. compare_ab.py
reports acceptance per regime/K with paired deltas, speed, and a derived
B=1 makespan. reduce_gap.py applies the owner's rule unchanged: a divergence
within the fused/unfused drift p99 is a near-tie.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The G2 run self-identified on its first boot: 64 engaged + 1 exempt banners, cold
cache load 578 s. Recorded so the next quant arm does not rediscover that the MTP
head shares the attention loader.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
These are unmodified copies; diff -q against the image tree comes back clean.
They get their own commit so that the TP=1 change that follows can be
reviewed as a pure diff against upstream. Nothing mounts them yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before this change, "TPAttention cannot run at TP=1" was an AGENTS trap. The
only single-device code path was the legacy 9B stack, which has no spec
verify/commit, so single-card MTP A/B was impossible. The owner directive of
2026-09-25 says to fix that properly, with no shim baseline.

This commit adds model_config.tp_path, which is num_devices > 1 or
QWEN36_TP1=1. Every path-selecting "num_devices > 1" in model, layer, mlp and
mtp now keys on tp_path. Everything that emits a CCL still keys on
num_devices > 1:
- TT_CCL creation
- the vocab-sharded LM head
- the prefill all-gather+matmul fusions (attention, GDN; MLP was already gated)
- the MTP mesh_partition

tp_common gains tt_all_reduce/tt_all_gather wrappers. On one device they
reproduce the framework's 1-D multi-device contract with local ops: flatten to
[1,1,N,C], place in memory_config, cast to the gather dtype, free the input.
On more than one device they call the framework unchanged.

Weight caches are qualified _mesh1x1. The spec feed norm at TP=1 is the final
norm itself. The fused verify SDPA already falls back when NKV != 1, and at
TP=1 NKV is 4.

The MLP prefill gate/up outputs go to DRAM at TP=1 only. At full width, two
[2048, 17408] bf16 tensors would not fit L1.

A double-free on the non-pre-gathered GDN verify path is fixed. At TP=1 the
gather can hand back its input.

The mtp_ab.py harness changes:
- no fabric on a (1,1) mesh
- fail closed if a single-device mesh lacks QWEN36_TP1
- DRAM allocator samples (after load, after KV alloc, at each arm end) and a
  peak summary
- per-arm full-row logit dumps (dump_n) for the TP=1 vs TP=2 logit PCC
- --kv-seqlen for the max-context fit probe

run-mtp-ab.sh takes DEVICES=0|1 (one --device, MESH P150, QWEN36_TP1=1). Its
SIBLINGS setting lets two single-card containers share one lock.
tp1-session.sh runs the gates, and compare_tp.py reduces them. The TP=1
tensor cache lives on /var/lib/models-sata, because the NVMe is 96% full.

TP=2 should be byte-identical: tp_path equals num_devices > 1 there, and every
new branch is dead. Stage s0 of tp1-session.sh checks this against the g2ab-G2
token hashes. Nothing here has run on hardware yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Before this run we did not know whether G2's attention/GDN bf4 weights, with a
GPTQ-snapped checkpoint and an MTP head left at bf8, would disturb the drafter.
They do not.

Acceptance is the same as the ThinkingCap FP8 prod RTN (P), or better:
- K3: 3.01 committed per iteration on G2 vs 2.96 on P (20 prompts).
- K7: 4.33 vs 3.99.
- The largest gain is free text at K7 (+0.66). Code at K7 drops slightly (-0.19).

G2 plain decode is faster: 50.6-51.0 ms/token vs 53.9-54.6 ms/token on P.
Prefill is unchanged at about 3200 tok/s at 4k. The spec TTFT of 3.5-4.1 s
includes the MTP warm pass.

Derived B=1 makespan for 256 tokens, K7 on code: 9.0 s on G2 vs 9.2 s on P.
Plain is 14.3 s on G2 vs 15.3 s on P. On prose_free, K7 is slower than plain on
both checkpoints.

The identity rule is carried unchanged. On P, 18 prompts are near-tie and 2
identical at both K. On G2, K3 has one divergence just over the control p99
(swing 2.125 vs 1.94, a top-2 swap). K7 has one real 7-logit disagreement at
verify row j=4, on prose_free.v1 pos 126. It is recorded and not localised.

B=4/8 remains impossible: there is no per-row commit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Conflict resolution follows the migration notes in PR #68:
- Every conflict sits in files that came from the pre-squash
  serving-throughput commits (AGENTS.md, the serving module, the prod-local
  qwen36_vllm.py, vllm-tt-serve.sh, the p150x2 README). All of them take
  master's version.
- The retired docs take master's deletions, including DIRECTIVES-LEDGER and the
  five docs those commits had added. The 16 records that master moved to
  bench/runs/archive are dropped here, so they do not come back as duplicates.
- This branch keeps only its own work: bench/mtp, the mtp-*/thinkingcap-*/
  two-card records, nix/mtp-pr55548, the thinkingcap probes and the mtp-tt and
  tt-card-slot skills.
- scripts/check-cited-records.py passes.

A merge rather than a rebase, as the coordinator asked, because the branch is
already pushed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The first TP=1 boot loaded fine: G2 on one P150a takes 20.96 GB of 33.1 GB
DRAM. It then died in the first prefill chunk. The GDN qkvzab 2D matmul asked
for 3,321,344 B of static CBs against 1,572,864 B of L1 (per_core_M 7 x
per_core_N 65 at N=16480). At TP=2 that matmul never ran, because the fused
all-gather matmul takes it. At TP=1 there is nothing to gather, so the plain
path runs at twice the width.

The fix: when tp_common.TP1_L1_FIT is set, the prefill progcfg splits each
core's output into out_block_h x out_block_w pieces under a 1.2 MB CB estimate.
model_config sets the flag only at num_devices == 1. The estimate is within
about 5% of the measured figure. TP=2 configs are never touched.

This commit also adds tp2-regress.sh. Stage s0 matched the g2ab-G2 session
bit for bit on every 4096-token prompt, but not on agentic_edit (2048 + a
47-token tail chunk). The script re-runs the same arms with the new tree and
the old tree under one lock, to decide whether the difference is the new code
or tail-path nondeterminism. The attempt is recorded in
bench/runs/mtp-tp1-attempts-20260925.jsonl.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Attempt 2 got past the qkvzab matmul and then overflowed L1 at the GDN
fused-out nlp_concat_heads (1,684,480 B of static dataflow buffers). At TP=1
the op sees all 48 value heads (48 x 128 = 6144 wide); TP=2 only ever saw
half that. The first idea was to turn the GDN fused-out path off, but that
would make TP=1 run a different path from TP=2, so the next change was
tp_common.concat_heads_fit. When TP1_L1_FIT is set and H*D > 3072, it
concatenates groups of heads into DRAM and joins them. Both attention
_concat_heads and the GDN fused-out path use it. TP=2 goes through the
unmodified op.

Also adds the TP=1 smoke arms (W0-W3 plus one K3 spec arm) and the
S1_ARMS/S1_EXTRA knobs in tp1-session.sh, so each fix gets checked with a
short session before the full one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The PR #68 migration notes ask for this. Before the overhaul, the G2-vs-P
session and the TP=1 directive existed only in #63 and in branch records.
LEDGER now has R-2026-09-25-mtp-g2: G2 accepts at least as well as P, and its
plain decode is ~3.5 ms/token faster. It also has D-2026-09-25-mtp-tp1, which
is still in progress with no gate passed. The TP=1 MTP row in Reopened now
points at the real path being built instead of "engineering". MTP.md drops
the "needs code changes" TP=1 paragraph, because that code now exists.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The mtp-tt and tt-card-slot skills still said the spec path is TP-only, so
single-card A/Bs had to be serialised at TP=2. With the QWEN36_TP1 path in the
overlay, that is no longer true. The next agent needs the design rule (select
modules on tp_path, gate CCLs on num_devices), the L1-fit fixes, the SATA cache
location and the stagger/watchdog recipe for two model processes, so that it
does not rediscover them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
s0 had matched g2ab on every 4096-token prompt but not on agentic_edit
(2048 + 47). tp2reg reran new and old trees under one lock. Each tree
repeats itself exactly (new = s0, old = g2ab), so the first reading was that
the new code changed the tail path. The bisect overturned that: the old
overlay with only the new harness (bisB, which adds a DRAM allocator query
and host-side dumps, no device compute op) produced a third distinct result.
Any change to the process moves the partial-chunk output, so the TP=1 code
is not the cause. The suspect is the eager tail prefill feeding a 47-row
activation, whose last-tile pad rows reach the GDN state unmasked. Whole-chunk
prompts are bit-identical in every run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The legacy mkdir /tmp/ttlock serialised the whole box, so a TP=1 smoke that
needs one card queued behind other agents' one-card jobs. run-mtp-ab.sh gains
SLOT_OWNER mode: it checks that /tmp/ttlock.d/cardN is ours, and it waits
only for containers that map one of OUR device nodes. tp1-card.sh takes the
slot with ttx's own slot.sh, runs one arm set on that card, and releases the
slot after the container stops. Card 1 is the default because card 0 is on
PCIe x4.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The first launch died with rc 3 because tt-quant was loading on card 0 and
MemAvailable was down to 1.2 GB. A TP=1 load's host RSS peaks at ~5.8 GB and
falls to ~35 MB once loaded, so the refusal is temporary.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Attempt 3 (card 1, after the reboot) got past the grouped concat's own CBs,
then clashed with a live L1 tensor: the CB region ended at 898,048 B and the
L1 buffer sat at 860,160 B. The head-major GDN norm output is 48 heads wide
at TP=1. Every short-lived prefill activation the TP code keeps in L1 was
tuned at half the per-device width, so fixing them one boot at a time would
take a boot (~4 min) per site. tp_common.pf_l1() returns L1 normally and DRAM
under TP1_L1_FIT, and every such prefill site uses it:
- attention: qkv3, the q/kv slices, the create-heads output, the q/k norm and
  scale, the sigmoid gate, the wo prefill output;
- GDN: the FIR conv output, the fused-out norm and concat.
concat_heads_fit also moves an L1 output to DRAM under the flag. Decode rows
stay in L1. At two devices every call returns exactly what it did before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This is the first TP=1 run to reach decode. The owner asked why decode on
one card was broken. The ttx probes were load-only, and every earlier attempt
died in the first prefill chunk. With the pf_l1 prefill fix, decode ran first
time, with no decode-side change.
- Warmups: plain ~80.9 ms/token; K3 and K7 spec work.
- Timed K3 on code: 38.4 ms/token at 3.92 committed per iteration (TP=2 G2:
  27.1 ms, 3.98).
- DRAM peaks at 24.4 of 33.1 GB.
Labelled 'TP=1 iteration, not production'. Also adds tp1-pair.sh for gate
(c): two per-card slots, card B staggered after card A has loaded, a mem.tsv
sampler and a watchdog.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Measured on cfx-llm2 under ttx per-card slots, G2, B=1:
- Gate (b), acceptance at TP=1 vs TP=2 over 20 prompts: K3 3.05 vs 3.01,
  K7 4.54 vs 4.33. Both within noise.
- Gate (c): cards 0 and 1 ran concurrently, 38 + 26 arms, all OK. MemAvailable
  stayed >= 6.6 GB and the watchdog never fired.
- Gate (a) is recorded as NOT passed. The owner rule finds 3 REAL divergences
  in 20 (one an 11.3-logit swing at a TP=2 near-tie), and 4 of 105 dumped rows
  have PCC 0.81-0.96 with top-1 intact. TP=1 vs TP=2 noise p99 is 2.44 against
  TP=2's own control at 1.94. Not localised, and not reclassified: the owner
  rule stands.
- TP=1 speed (iteration only): plain 80.8 ms/token, PP 1,411 tok/s at 4k;
  K3 code 38.1 ms; K7 code 25.9 ms.

LEDGER gets R-2026-09-25-mtp-tp1 and the Reopened TP=1 row moves to (d).
MTP.md and STATUS.md carry the TP=1 table. The skills cover the pf_l1 rule,
the fact that a prefill failure looks like broken decode, and the ttx-slot
drivers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Believed before: TP=1 vs TP=2 gate (a) had 3 REAL divergences (code.v2, code.v5,
prose_free.v1) and a TP=1-vs-TP=2 noise p99 of 2.44, above the control drift.

Evidence changed that: mtp_ab's code corpus walks models/demos/blackhole including the
bind-mounted overlay (utils/opsync.py, text_demo/layer/mlp/model.py sit inside the 400k
cap), and code.vN / agentic_edit* slice it at a fraction of its length. The TP=2 gate ran
in the mtp-thinkingcap tree (8 overlay files), TP=1 in mtp-tp1 (14, bigger model.py), so
11 of 20 prompts differed (agentic_edit.v1 is 2095 tokens in one, 2094 in the other).
With the corpus pinned to g2ab's exact mounts (MTP_AB_CODE_CORPUS, corpus_walk.py
--write) the TP=1 re-run gives 18 near-tie / 1 identical / 1 REAL (prose_free.v1, swing
2.625, a prompt the drift never touched) and noise p99 1.69, below the 1.94 control.

Also here: the QWEN36_LAYER_DUMP per-layer hidden/GDN-state dump (eager prefill + eager
decode), layer_ref.py (host fp32 per-layer reference fed each path's own inputs), the
tail-pad masked/poison arms, GDN_STATE_BF16 overridable in run-mtp-ab (default 1,
unchanged), tp1-card.sh CARD=mesh, and the TP=1 G2 max-context ladder: plain runs at a
152,064-token KV (103k prompt, TG 96.6 ms/tok, 32.1/33.1 GB) and OOMs at 168,448; K3
runs at 127,488 and OOMs at 135,680.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The tp2bis bisect looked like the eager partial-chunk prefill letting its
unmasked pad rows leak into real rows. A masked-vs-unmasked A/B
(QWEN36_TAIL_ZERO_PAD=0/1), crossed with NaN and 1e4 poison in freed DRAM and
L1, is bit-exact at both TP=1 and TP=2, so neither the pad rows nor
uninitialised memory reach the output. The bisect's hash differences come from
the code-corpus drift recorded in mtp-tp1-gatea-rerun-20260925.jsonl. No fix
is needed.

gdn_precision_probe.py emulates candidate device precisions in the fp32 GDN
reference. None of them reproduces the 4-19% per-layer GDN error.
chain-nofused.sh dumps the same prompt with the non-fused chunk path, to test
whether that error belongs to the fused chunk op.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
We believed gate (a)'s 3 REAL divergences might be a TP=1 defect in the
DRAM-moved prefill activations or the grouped concat-heads. They were mostly
corpus drift: the two arms mounted different overlays and got different
prompts. On identical prompts the result is 1 REAL of 20.

Per-layer dumps of both paths, over all 64 layers and two prompts, compared
against an fp32 host reference, show the same error profile in each path. The
TP1-vs-TP2 difference only compounds with depth, so the remaining flip is a
near-tie. TP=1 is 7-15% less precise than TP=2 on attention and the deep
layers, which is a deficit, not a defect.

The reference also shows that every early and middle GDN layer is 8-19% off
fp32 on the production flags. None of these explain it: the fused chunk op,
bf16 state, chunk size, bf16 decay parameters and exp, bfp8 activation
packing. The cause is open. This is an accuracy finding and gives no speed
number.

The docs now also carry the TP=1 max-context ladder: plain 151,552 and K3
126,976 KV tokens on one card. layer_ref.fetch now retries ssh 255, which had
killed a 64-layer run at L23.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The TP=2 layer dumps for gate (a) needed the mesh run on the same harness path
as the per-card runs. Without that, the arms differ in more than TP (see the
corpus-drift finding).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
We thought the 8-19% per-layer GDN prefill error against fp32 was the fused
chunk op, the bf16 state, the chunk size or the activation packing. It is none
of those: it enters at the in_proj_a / in_proj_b projection.

QWEN36_ATTN_GDN_BF4 packs the fused [qkv|z|a|b] weight as bfloat4_b, but GPTQ
only put qkv/z/out on the bfp4 grid, so a and b get a plain RTN to 4 bits.
Those two tiny projections are the whole input to the gates: g =
-exp(A_log)*softplus(a+dt_bias) and beta = sigmoid(b). Measured on layer 6, the
projections of a and b are 9.7% and 6.4% off the checkpoint's own weights while
every other stage is under 0.5% and the scan itself is ~2%; device a matches
x @ bfp4_RTN(W_a) to 0.44%, so this is measured, not inferred. The prefill sums
g over thousands of rows, so a slow-decay head integrates that error into a 55%
cumulative-decay error, which is why layers 1-30 are bad, layers 50-63 are not,
and only ~5.5% of heads are affected.

The flag computes a/b from a separate bfloat8_b weight: a/b error drops to
0.43%/0.51% and beta to 0.23%. It costs ~9 ms/token at TP=1 decode for the
extra per-layer matmul, so "prefill" mode applies it only where the error
integrates. KL against the FP8 teacher is not measured yet.

New: idump_cmp.py plus QWEN36_GDN_IDUMP_LAYER, which dump and localise every
GDN prefill intermediate against the fp32 reference.

Refs #71, #63, #69.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fixing the bf4 a/b projection alone (previous commit) cleans the gate inputs
20x but barely moves the per-layer error: L2 12.26% vs 12.37%, L6 18.70% vs
19.13%. Once a/b are accurate the residual bf16 gate arithmetic dominates, and
the prefill's cumulative decay amplifies it exactly the same way. g was still
1.38% off fp32, from A_log/dt_bias stored bf16, a bf16 softplus and a bf16
multiply.

QWEN36_GDN_G_FP32=1 stores A_log/dt_bias as fp32, computes -exp(A_log) on the
host, and runs the whole gate in fp32 through one _gate_g helper that every
call site now shares. Measured on layer 6: negA and the softplus become exact,
g drops from 4.67% to 0.003% against fp32 on the device's own a, and the
scan's gate-sensitivity term falls from 31.5% to 6.3%.

tp_common.shard_small also cast every small tensor to bf16 on the host before
upload, whatever device dtype was asked for, which silently threw away the
fp32.

Cost: none at decode. QWEN36_GDN_AB_BF8=prefill keeps the extra a/b matmul out
of the decode step, and the combined arm measures 98.7 ms/token against a
100.3 ms bf4 control (cross-card, so call it neutral), versus 107.9 for the
always-on a/b fix.

Refs #71.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Records the localisation (it is the a/b projection, not the scan), the
mechanism (the prefill sums g, so slow-decay heads integrate the error), why
8-bit a/b alone does not help, and the fp32 gate that takes the GDN layers from
8-19% to 2.4-3.5% at no decode cost. Flags the part that is not done: KL against
the FP8 teacher, so this is numerics and not yet a quality result.

Refs #71.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
merge master into mtp-thinkingcap
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 14s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 1m4s
5f6028d767
# Conflicts:
#	.claude/skills/tt-card-slot/SKILL.md
Grok merged commit be18c2422c into master 2026-09-25 23:13: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!82
No description provided.