WIP: serving: ThinkingCap bfp4 G2 + prefix caching + 0019 (gates 2-4 not run) #73

Closed
Grok wants to merge 0 commits from deploy/g2-prefix-0019 into master
Owner

Status: PREPARED, NOT DEPLOYED. Do not merge-and-deploy until gates 2-4 run on the cards.

The owner approved three changes on 2026-09-25 to ship as one deploy: master's serving
code (patch 0019 restored, source mounts fixed), ThinkingCap-Qwen3.8-27B in the bfp4
GPTQ "G2" form
in place of Qwen3.8-27B-FP8, and prefix caching on (#48). This PR is
the tt-stack half. The nixos-llm half is a lock bump plus the host options and is not
opened yet, because it must not exist before this merges.

Gate results

Gate What Result
1. Render equivalence ttx render prod-g2-prefix vs the docker argv the nix unit renders for the shipping options: env, devices, image, docker options, mount destinations, mounted file content (sha256), vLLM argv incl. --additional-config PASS, 0 failures — bench/runs/deploy-g2-prefix-gate1-render-20260925T202326Z.jsonl
2. Banners on hardware boot the shipping arm, verify 0019, SDPA streaming, device argmax, bf8 KV, QWEN36_ATTN_GDN_BF4 ×64, QWEN36_BFP4_PACKED, prefix caching NOT RUN
3. Correctness tc-baseline / infbench + GSM8K + retrieval against the recorded production arm NOT RUN
4. bench/ab/sweep-32k.sh prefill tok/s, TG ms/token, TTFT, makespan at B=4 and B=8 NOT RUN

Why gates 2-4 did not run. Both P150a cards were held by the MTP and tt-quant
sessions for the whole window (ttx slot status: card0=mtp-tp1-c0-ab8,
card1=mtp-tp1-c1-g32); I queued for the mesh slot and never preempted. Meanwhile
ttx doctor reports ~4.8 GB of kernel-pinned host memory leaked with MemAvailable
falling to 3.6 GB, below ttx's own 4 GB boot guard. Only a reboot reclaims it (a
module reload was measured at 0 MB), and a reboot with other agents on the cards is the
owner's call. So there is no before/after speed table in this PR: nothing was measured.

Gate 1 was not a formality

It found two defects that would each have shipped, with no card time spent on either.

  1. The unit hard-coded the tensor cache to /var/lib/models/tt-cache, the FP8
    snapshot's cache. A tensorbin is named for the tensor and its dtype, never for the
    checkpoint, and ThinkingCap has the same keys and shapes as Qwen3.8 — so changing
    modelDir would not have missed and rebuilt. It would have hit, serving Qwen's
    weights under ThinkingCap's name with every banner green and nothing downstream the
    wiser. New cacheDir option; production G2 gets /var/lib/models/tt-cache/bfpq-PK.
  2. enablePrefixCaching rendered a server nobody has run: --block_size 64 at POOL
    1,048,576. Every prefix result we hold is block size 2048 at POOL ≤786,432, and
    prefix-traced-dram-oom-20260918T1540Z.jsonl is a traced decode at 1M running the
    device out of DRAM. SERVING.md predicted this in its own "Unit caveat" and the option
    shipped anyway. Now: blockSize defaults to 2048 when caching is on (the cache hashes
    whole blocks, so attention and mamba block sizes must be equal and vLLM refuses
    unequal ones), --mamba-ssm-cache-dtype bfloat16 is passed, and poolTokens <= 786432
    is asserted.

What is in the diff

  • patches/prod-local-metal: gdn/tp.py, weight_mapping.py, bfp4_unpack.py vendored
    from the bfp-quant branch, with the image's own files as the base so it is not a guess;
    attention/tp.py is the union of the bench arm's bf4 hunk and patch 0020 — the
    bench copy predates 0020 and shipping it verbatim would have silently removed a cleared
    optimisation, the same class of regression as 89f75ce dropping 0019.
  • modules/tenstorrent-serving.nix: weightsBf4, bfp4Packed, cacheDir, blockSize,
    extraVolumes; assertions for each; readiness-probe banner checks. The bf4 banner is
    counted to 64, not matched: the flag is read once per weight-loading module, so a
    half-applied overlay still prints it once and a match-only check would pass an arm that
    is half bf8. No existing option is renamed or removed.
  • bench/arms/prod-g2-prefix.toml: the arm that is the unit. It needs the
    bench/arms/{prod,models}.toml that #70 brings; the registry entry is quoted in its
    header so the file reads standalone until then.
  • Docs: SERVING §5a (the served checkpoint and the one way it goes wrong), §8 (rollback),
    §5 caveat resolved; STATUS and LEDGER say PREPARED, NOT SHIPPED.

Serving G2 — why it is not a size-for-accuracy trade

Paired against the FP8 teacher, n=288-384 (bfp-quant-p1-20260925T0645Z.jsonl): KL
0.085 vs production's 0.111, top-1 0.944 vs 0.917, GSM8K 58/60 vs 57/60,
keyed retrieval 1.00 at 16k and 32k, decode 1.8-3.3 ms/token faster, makespan 1.8-5.2%
shorter. It is smaller and better because the deployed arm was already bf4 for the MLP
down-projection — by round-to-nearest; G2 picks the grid point that minimises output
error. weightsBf4 over a checkpoint that was not grid-snapped is plain RTN bf4 and
is worse than production (arm R2: KL 0.176); the option's description says so.

Packed (20.6 GB) is what production should serve, not the unpacked ckpt-G2: the
loader unpacks to the exact bf16 grid values, cold boots of each built 980/980
sha256-identical tensorbins with 44/44 token-identical continuations
(bfp4-packed-tt-boot-gate-20260925T110520Z.jsonl), it is a third of the size, and
ckpt-G2 is a directory of symlinks into the quantiser's 46 GB scratch tree — not a
production model root.

Rollback

ssh cfx-llm2 'sudo nixos-rebuild switch --rollback'

One command, no build, no network. It works because the deploy adds rather than
replaces: same vllm-tt:k2 image, the FP8 snapshot untouched, and its warm tensor cache
untouched because G2 was given a cache directory of its own. Also in docs/SERVING.md §8,
with the confirmation checks.

Needs an owner decision

  1. Capacity. Prefix caching costs the KV pool: 6 × 128k or 3 × 256k concurrently
    instead of 8 × 128k or 4 × 256k
    . Refused by assertion rather than clamped, so the
    trade is visible. Raising it needs a record at the higher pool, not a bigger number.
  2. Host reboot to reclaim ~4.8 GB of leaked pinned memory. Other agents are on the
    cards; I have not rebooted and will not without a yes.
  3. Served model id. Kept as qwen3.8-27b-tt although the model behind it changed,
    because renaming breaks every pinned client at the switch. Say if it should change.
  4. A permanent home for the 20.6 GB packed checkpoint, currently on the SATA scratch
    volume (80% full) because /var/lib/models has 36 GB free and three tensor caches.

Licence

ThinkingCap-Qwen3.8-27B is PolyForm Small Business 1.0.0. Internal serving is inside
it. Publishing or redistributing the weights — the quantised derivative in
/var/lib/models-sata/bfpq/packed-G2 included — is not, and nothing here does.

Known open, not fixed here, not a regression

GDN prefill layers 1-30 are 8-19% off an fp32 reference in about 5.5% of heads. It is
pre-existing and affects the currently deployed FP8 arm equally.

🤖 Generated with Claude Code

**Status: PREPARED, NOT DEPLOYED. Do not merge-and-deploy until gates 2-4 run on the cards.** The owner approved three changes on 2026-09-25 to ship as one deploy: master's serving code (patch 0019 restored, source mounts fixed), **ThinkingCap-Qwen3.8-27B in the bfp4 GPTQ "G2" form** in place of Qwen3.8-27B-FP8, and **prefix caching on** (#48). This PR is the tt-stack half. The nixos-llm half is a lock bump plus the host options and is not opened yet, because it must not exist before this merges. ## Gate results | Gate | What | Result | |---|---|---| | 1. Render equivalence | `ttx render prod-g2-prefix` vs the docker argv the nix unit renders for the shipping options: env, devices, image, docker options, mount destinations, mounted file **content** (sha256), vLLM argv incl. `--additional-config` | **PASS**, 0 failures — `bench/runs/deploy-g2-prefix-gate1-render-20260925T202326Z.jsonl` | | 2. Banners on hardware | boot the shipping arm, verify 0019, SDPA streaming, device argmax, bf8 KV, `QWEN36_ATTN_GDN_BF4` ×64, `QWEN36_BFP4_PACKED`, prefix caching | **NOT RUN** | | 3. Correctness | tc-baseline / infbench + GSM8K + retrieval against the recorded production arm | **NOT RUN** | | 4. `bench/ab/sweep-32k.sh` | prefill tok/s, TG ms/token, TTFT, makespan at B=4 and B=8 | **NOT RUN** | **Why gates 2-4 did not run.** Both P150a cards were held by the MTP and tt-quant sessions for the whole window (`ttx slot status`: `card0=mtp-tp1-c0-ab8`, `card1=mtp-tp1-c1-g32`); I queued for the mesh slot and never preempted. Meanwhile `ttx doctor` reports **~4.8 GB of kernel-pinned host memory leaked** with MemAvailable falling to **3.6 GB, below ttx's own 4 GB boot guard**. Only a reboot reclaims it (a module reload was measured at 0 MB), and a reboot with other agents on the cards is the owner's call. So there is no before/after speed table in this PR: nothing was measured. ## Gate 1 was not a formality It found two defects that would each have shipped, with no card time spent on either. 1. **The unit hard-coded the tensor cache** to `/var/lib/models/tt-cache`, the FP8 snapshot's cache. A tensorbin is named for the tensor and its dtype, **never** for the checkpoint, and ThinkingCap has the same keys and shapes as Qwen3.8 — so changing `modelDir` would not have missed and rebuilt. It would have **hit**, serving Qwen's weights under ThinkingCap's name with every banner green and nothing downstream the wiser. New `cacheDir` option; production G2 gets `/var/lib/models/tt-cache/bfpq-PK`. 2. **`enablePrefixCaching` rendered a server nobody has run**: `--block_size 64` at POOL 1,048,576. Every prefix result we hold is block size 2048 at POOL ≤786,432, and `prefix-traced-dram-oom-20260918T1540Z.jsonl` is a traced decode at 1M running the device out of DRAM. SERVING.md predicted this in its own "Unit caveat" and the option shipped anyway. Now: `blockSize` defaults to 2048 when caching is on (the cache hashes whole blocks, so attention and mamba block sizes must be equal and vLLM refuses unequal ones), `--mamba-ssm-cache-dtype bfloat16` is passed, and `poolTokens <= 786432` is asserted. ## What is in the diff - `patches/prod-local-metal`: `gdn/tp.py`, `weight_mapping.py`, `bfp4_unpack.py` vendored from the bfp-quant branch, with the image's own files as the base so it is not a guess; `attention/tp.py` is the **union** of the bench arm's bf4 hunk and patch 0020 — the bench copy predates 0020 and shipping it verbatim would have silently removed a cleared optimisation, the same class of regression as 89f75ce dropping 0019. - `modules/tenstorrent-serving.nix`: `weightsBf4`, `bfp4Packed`, `cacheDir`, `blockSize`, `extraVolumes`; assertions for each; readiness-probe banner checks. The bf4 banner is **counted to 64**, not matched: the flag is read once per weight-loading module, so a half-applied overlay still prints it once and a match-only check would pass an arm that is half bf8. **No existing option is renamed or removed.** - `bench/arms/prod-g2-prefix.toml`: the arm that *is* the unit. It needs the `bench/arms/{prod,models}.toml` that #70 brings; the registry entry is quoted in its header so the file reads standalone until then. - Docs: SERVING §5a (the served checkpoint and the one way it goes wrong), §8 (rollback), §5 caveat resolved; STATUS and LEDGER say PREPARED, NOT SHIPPED. ## Serving G2 — why it is not a size-for-accuracy trade Paired against the FP8 teacher, n=288-384 (`bfp-quant-p1-20260925T0645Z.jsonl`): KL **0.085** vs production's 0.111, top-1 **0.944** vs 0.917, GSM8K **58/60** vs 57/60, keyed retrieval 1.00 at 16k and 32k, decode 1.8-3.3 ms/token faster, makespan 1.8-5.2% shorter. It is smaller *and* better because the deployed arm was already bf4 for the MLP down-projection — by round-to-nearest; G2 picks the grid point that minimises output error. `weightsBf4` over a checkpoint that was **not** grid-snapped is plain RTN bf4 and is *worse* than production (arm R2: KL 0.176); the option's description says so. **Packed (20.6 GB) is what production should serve**, not the unpacked `ckpt-G2`: the loader unpacks to the exact bf16 grid values, cold boots of each built 980/980 sha256-identical tensorbins with 44/44 token-identical continuations (`bfp4-packed-tt-boot-gate-20260925T110520Z.jsonl`), it is a third of the size, and `ckpt-G2` is a directory of symlinks into the quantiser's 46 GB scratch tree — not a production model root. ## Rollback ``` ssh cfx-llm2 'sudo nixos-rebuild switch --rollback' ``` One command, no build, no network. It works because the deploy **adds** rather than replaces: same `vllm-tt:k2` image, the FP8 snapshot untouched, and its warm tensor cache untouched because G2 was given a cache directory of its own. Also in `docs/SERVING.md` §8, with the confirmation checks. ## Needs an owner decision 1. **Capacity.** Prefix caching costs the KV pool: **6 × 128k or 3 × 256k concurrently instead of 8 × 128k or 4 × 256k**. Refused by assertion rather than clamped, so the trade is visible. Raising it needs a record at the higher pool, not a bigger number. 2. **Host reboot** to reclaim ~4.8 GB of leaked pinned memory. Other agents are on the cards; I have not rebooted and will not without a yes. 3. **Served model id.** Kept as `qwen3.8-27b-tt` although the model behind it changed, because renaming breaks every pinned client at the switch. Say if it should change. 4. **A permanent home for the 20.6 GB packed checkpoint**, currently on the SATA scratch volume (80% full) because `/var/lib/models` has 36 GB free and three tensor caches. ## Licence ThinkingCap-Qwen3.8-27B is **PolyForm Small Business 1.0.0**. Internal serving is inside it. Publishing or redistributing the weights — the quantised derivative in `/var/lib/models-sata/bfpq/packed-G2` included — is not, and nothing here does. ## Known open, not fixed here, not a regression GDN prefill layers 1-30 are 8-19% off an fp32 reference in about 5.5% of heads. It is pre-existing and affects the currently deployed FP8 arm equally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The G2 accuracy work (issue #62) measured a GPTQ checkpoint whose every linear
weight is snapped onto the native bfp4_b grid, and it beats what we serve today
on every axis we gate on: KL 0.085 against the FP8 teacher versus production's
0.111, top-1 0.944 versus 0.917, GSM8K 58/60 versus 57/60, keyed retrieval 1.0,
and decode 1.8-3.3 ms/token faster. None of that was reachable from the deployed
unit, because the three things it needs -- the bf4 weight dtype, the packed
checkpoint loader, and a volume the checkpoint can live on -- existed only as
bench-side file mounts in bench/bfpq/sources on the bfp-quant branch.

So vendor them into the one place the unit reads from, patches/prod-local-metal,
and give them options with banner checks rather than leaving them to extraEnv.

What the sources are. gdn/tp.py and weight_mapping.py are the image's own files
plus the bfp-quant hunks, taken from vllm-tt:k2 itself so the base is not a guess.
attention/tp.py is the one merge: the bench arm was cut before patch 0020, so its
copy has the bf4 dtype and NO SDPA streaming, and shipping it verbatim would have
silently removed a cleared optimisation -- the same class of regression as 89f75ce
dropping 0019. The file here is the union, and it is byte-identical to the bench
arm's except for the streaming hunk it restores.

Why the mounts are unconditional while the behaviour is not. Both additions are
inert without their env flag: the weight dtype falls back to bfloat8_b, and the
unpack hook only fires on a key ending _bfp4_codes. A mount set that varies with
the options would be a second thing to keep in step with PROD-SERVING-SOURCES.md,
and that manifest has already drifted once.

Why weightsBf4 counts to 64. The flag is read once per weight-loading module, so
a half-applied mount -- attention patched, gdn stale -- still prints the banner
and a match-once check would pass an arm that is half bf8. The readiness probe
counts 64, the decoder layer count, and refuses anything less. bfp4Packed demands
its own banner for the same reason in reverse: the unpack hook being inert means a
modelDir typo would serve the FP8 base weights without a word.

weightsBf4 is deliberately NOT a quantiser. Over a checkpoint that was not snapped
to the grid it is plain round-to-nearest bf4, which measured WORSE than production
(arm R2: KL 0.176). The option description says so, because the tempting mistake is
to turn it on over the FP8 snapshot and expect G2's numbers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Found while diffing the shipping arm against the unit it is supposed to be.
The unit hard-coded HOME and TT_CACHE_PATH to /var/lib/models/tt-cache, which is
the Qwen3.8-27B-FP8 snapshot's cache and nothing else. Change modelDir without
changing that path and the next boot does not miss and rebuild: a tensorbin is
named for the tensor and its dtype, NEVER for the checkpoint it came from, so it
HITS, and serves the old checkpoint's weights under the new one's name.

Every banner would still be correct. ThinkingCap has the same keys and the same
shapes as Qwen3.8, which is precisely the case where nothing downstream notices --
and the ttx arm registry already treats this as a known trap (models.toml:
"a wrong seed silently serves the other checkpoint's weights: exclude generously"),
while the unit had no way to express it at all.

TT_METAL_CACHE deliberately does NOT move under cacheDir. That one holds compiled
kernels, which depend on the mesh and the ttnn build and not on which numbers flow
through them, so every arm keeps sharing it and a checkpoint change does not pay a
full kernel recompile.

Also adds bench/arms/prod-g2-prefix.toml, the arm that IS the shipping unit: the
comparison of `ttx render prod-g2-prefix` against the module's rendered ExecStart
is what caught this, and it now passes on env, devices, image, docker options,
mount destinations, mounted file CONTENT and the vLLM argv. The arm needs the
bench/arms/{prod,models}.toml that PR #70 brings; its registry entry for the packed
checkpoint is quoted in the header so the file is readable before that lands.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The option existed, but turning it on produced a server nobody had ever run:
--block_size 64 and POOL 1,048,576, while every prefix-caching result we hold
was taken at block size 2048 and POOL 786,432 or below, and a traced decode at
POOL 1M with caching on is on record running the device out of DRAM
(bench/runs/prefix-traced-dram-oom-20260918T1540Z.jsonl). SERVING.md said as much
in its own "Unit caveat" and predicted it would fail; the option shipped anyway.

Block size is not a preference here. The cache hashes whole blocks, so
hash_block_size must divide every KV group and the attention and mamba block sizes
must be equal -- vLLM refuses anything else -- which forces 2048. So blockSize is a
new option that defaults to 2048 exactly when caching is on, with an assertion for
anyone who overrides it, and --mamba-ssm-cache-dtype bfloat16 is passed so vLLM's
declared SSM dtype matches the bf16 state the model actually keeps.

The pool is a REAL COST and is left to the caller, refused rather than silently
clamped: at 786,432 tokens the box serves 6 x 128k or 3 x 256k concurrently instead
of 8 x 128k or 4 x 256k. That is a capacity decision, not a detail, and a unit that
quietly rewrote it would hide the one thing an owner needs to weigh against the
caching win. A single request may still be max_model_len.

bench/arms/prod-g2-prefix.toml moves with it, and the render comparison against the
module is recorded as gate 1 of this deploy: env, devices, image, docker options,
mount destinations, mounted file CONTENT and the vLLM argv all match. That
comparison is what found this, and the cache-path bug before it, with no card time
spent on either.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docs: the G2 + prefix + 0019 deploy, and a rollback that is one command
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 8s
fbd0b93a5b
SERVING.md gains what the deploy needs to be reversible by someone who was not
here: section 5a on the served checkpoint and the single way it goes wrong (a
shared tensor cache HITS rather than misses, and serves the other checkpoint's
weights under this one's name), and section 8, the rollback.

The rollback is `sudo nixos-rebuild switch --rollback` and nothing else, and the
reason it can be that short is a property of how the deploy was built rather than a
promise: it ADDS instead of replacing. Same image, the FP8 snapshot untouched, and
its warm tensor cache untouched because G2 was given a cache directory of its own.
Nothing on the rollback path has to be rebuilt or re-downloaded, so the document
also says to keep those three out of any cache gc.

The prefix-caching section's own "expect it to fail at the default POOL" caveat is
resolved rather than deleted -- it was right, and the fix is recorded next to the
prediction, including the capacity the feature costs.

STATUS and LEDGER say plainly that this is PREPARED and NOT SHIPPED: gate 1 (render
equivalence) passed, gates 2-4 never ran because both cards were held all evening and
the host is below its own boot guard on leaked pinned memory. The ledger entry lists
what the owner still has to rule on rather than burying it: the pool cut from 8x128k
to 6x128k, the served-model id, a permanent home for the 20.6 GB checkpoint, and the
reboot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docs: mark the two bfp-quant evidence records as branch-only
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 17s
d233549eb6
check-cited-records.py refused the PR: SERVING.md cited the G2 accuracy record and
the packed boot gate as if they were on this branch. They are on bfp-quant and land
with it, which is exactly the case the `<branch>:` prefix exists for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bench/runs: rollback readiness checked on the box before the deploy
All checks were successful
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 11s
tt-stack-ci / Report upstream drift (pull_request) Successful in 8s
a8c3ee0008
The one-command rollback in SERVING.md section 8 is only true if generation 177 is
still there and if nothing the deploy touches is needed to serve the old arm. Both
are facts about cfx-llm2 rather than about the diff, so they are recorded: previous
generation present, vllm-tt:k2 unchanged by the deploy, FP8 snapshot and its warm
tensor cache untouched because G2 got a cache directory of its own.

Not rehearsed, and the record says so: the unit was inactive and both cards were held
all evening, so there was nothing to roll back and no window to prove the boot time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Owner

Status update on this PR.

CI is green on d233549 / a8c3ee0 (both jobs). The first push was red for one reason worth naming: scripts/check-cited-records.py refused two citations in SERVING.md that point at records living on bfp-quant. They are now marked with the bfp-quant: prefix, which is what that mechanism is for.

tools/ttx/tests is 40/41 against #70's branch with this module. The single failure is ProdPrefixMatchesNix.test_serve_args, and it is the intended one: this PR changes what enablePrefixCaching = true renders (block size 2048, --mamba-ssm-cache-dtype bfloat16), so #70's bench/arms/prod-prefix.toml needs the same edit. I have not carried that file here because it does not exist on master. Noted on #70; whichever lands second updates it.

Rollback readiness is now checked on the box rather than asserted (bench/runs/deploy-g2-prefix-rollback-readiness-20260925T204500Z.jsonl): generation 177 is present as the rollback target, vllm-tt:k2 is unchanged by this deploy, and the FP8 snapshot and its warm tensor cache are untouched — the last of those only because G2 was given a cache directory of its own. It is not a rehearsal: the unit was inactive all evening and there was nothing to roll back.

The hardware gates are still not run, and the queue is still the reason. ttx up prod-g2-prefix --card mesh --wait 10800 has been waiting for the mesh slot since 20:20Z without preempting; card0 freed, card1 is still mtp-tp1-c1-g32. MemAvailable has swung between 3.6 and 6.5 GB against a 4 GB boot guard, with ~4.8 GB of kernel-pinned memory leaked that only a reboot reclaims.

The host half is nixos-llm#588, deliberately blocked on this PR merging and on the flake input being bumped to it.

Status update on this PR. **CI is green** on `d233549` / `a8c3ee0` (both jobs). The first push was red for one reason worth naming: `scripts/check-cited-records.py` refused two citations in SERVING.md that point at records living on `bfp-quant`. They are now marked with the `bfp-quant:` prefix, which is what that mechanism is for. **`tools/ttx/tests` is 40/41 against #70's branch with this module.** The single failure is `ProdPrefixMatchesNix.test_serve_args`, and it is the intended one: this PR changes what `enablePrefixCaching = true` renders (block size 2048, `--mamba-ssm-cache-dtype bfloat16`), so #70's `bench/arms/prod-prefix.toml` needs the same edit. I have not carried that file here because it does not exist on master. Noted on #70; whichever lands second updates it. **Rollback readiness is now checked on the box rather than asserted** (`bench/runs/deploy-g2-prefix-rollback-readiness-20260925T204500Z.jsonl`): generation 177 is present as the rollback target, `vllm-tt:k2` is unchanged by this deploy, and the FP8 snapshot and its warm tensor cache are untouched — the last of those only because G2 was given a cache directory of its own. It is not a rehearsal: the unit was inactive all evening and there was nothing to roll back. **The hardware gates are still not run**, and the queue is still the reason. `ttx up prod-g2-prefix --card mesh --wait 10800` has been waiting for the mesh slot since 20:20Z without preempting; card0 freed, card1 is still `mtp-tp1-c1-g32`. MemAvailable has swung between 3.6 and 6.5 GB against a 4 GB boot guard, with ~4.8 GB of kernel-pinned memory leaked that only a reboot reclaims. The host half is [nixos-llm#588](https://git.bitp.cz/bitpartner/nixos-llm/pulls/588), deliberately blocked on this PR merging and on the flake input being bumped to it.
bench/runs: re-derive the KV budget from G2, and find where the pool actually goes
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 5s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 13s
481f591776
Owner wants the 8x128k / 4x256k target shapes kept AND prefix caching shipped,
so the pool has to come from somewhere. This is the arithmetic, from existing
measured records, before anyone spends a card window on it.

The headline is not a saving, it is a misattribution. vLLM advertises 765,579
usable KV tokens against the 1,052,672 the device actually allocated -- exactly
8/11. Our get_kv_cache_spec declares 3 MambaSpec groups for the 48 GDN layers and
the planner charges them block for block, while on the device GDN state is
allocated per DECODE SLOT and never per block. So 287,093 tokens, 4.65 GiB/card
of pool, are reserved for something whose real requirement is 0.28 GiB/card, and
the memory is sitting there free.

That decides the target rather than merely helping it. At today's ratio, serving
1,048,576 USABLE tokens needs a 1,441,793-token pool = 23.37 GiB/card, which does
not fit even with a K8/V4 KV cache. Correct the accounting and the same target
costs 17.27 GiB/card at bf8, or 13.20 with K8/V4.

Two corrections to the budget everyone has been quoting. Prefix snapshots cost
ZERO device DRAM -- they are host torch tensors read back with ttnn.to_torch, and
the 16-snapshot budget is a host budget -- so charging 16 x 72 MiB to the card was
wrong. And the G2 weight saving at TP=2 is UNKNOWN, not 5 GiB: the 21.0 GB figure
is a TP=1 whole-model footprint that does not halve because embed_tokens and
lm_head are not sharded, the one TP=2 reading is 12.81 GiB/card from a text_demo
arm, and no FP8 TP=2 footprint was ever measured at all -- the ~25.1 GiB everything
rests on is pool arithmetic with no record behind it.

Also worth knowing before sizing anything: nothing on the TT path measures free
DRAM. determine_available_memory returns 1<<64 and the pool comes from arithmetic,
so an over-large POOL does not degrade gracefully, it OOMs on the first request.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bench+docs: the card has 1.0 GiB/card more than every budget said, and prefix caching had never actually booted
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 25s
27738f7264
Three findings from one 20-minute mesh slot.

The 0.5 GiB bank-size discrepancy was never a discrepancy. ttnn reports
total_bytes_per_bank NET of trace_region_size, and the region is reserved whole at
open before a single trace is captured: the same mesh reads 4,277,141,376 B/bank at
trace 0, 4,210,032,512 at 512 MiB and 4,142,923,648 at 1024 MiB, the drop equalling
the request exactly both times. So docs/HARDWARE.md's "30.87 GiB usable, measured
device query" is this card with a 1 GiB trace region, and the 4,210,032,512 in the
OOM record is the same card at the production 512 MiB. One card, two trace sizes,
and the table was mislabelled. Every budget that started at 30.87 and then subtracted
512 MiB of trace charged it TWICE: production actually has 31.37 GiB/card, and the
8x128k margin is 1.29 GiB rather than 0.29.

Prefix caching could not have shipped tonight in any case. Booting the shipping arm
for the first time, vLLM refused to construct before it reached the device --
"Chunked MM input disabled but max_tokens_per_mm_item (16384) is larger than
max_num_batched_tokens (2048)" -- because the unit rendered no
--max-num-batched-tokens at all. The option had been rendered, asserted over and
reviewed all evening without once being started. It is now set to max_model_len,
which is also the floor that stops a split prompt resuming mid-page where the prefix
guard rejects it. Cost: two 30 s boots.

And the snapshot correction the budget rested on: GDN prefix snapshots are HOST torch
tensors (model.py:1543 reads them back with ttnn.to_torch), so
QWEN36_PREFIX_MAX_SNAPSHOTS is a host RSS budget and prefix caching adds no device
allocation at all beyond the block-size pad. HARDWARE.md now also says plainly that no
FP8 TP=2 weight footprint was ever measured -- the ~25.1 GiB everything is derived from
is pool arithmetic with no record behind it -- so nobody re-derives a G2 saving from it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bench/runs: the GDN reservation is padding slack, measured, and prefix caching had two construction defects
All checks were successful
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 36s
tt-stack-ci / Report upstream drift (pull_request) Successful in 10s
8adfadf58f
The 27% of the KV pool vLLM withholds is now measured rather than inferred. The
server prints it: 'mamba page 817152 B -> 4194304 B (1 x the 4194304 B attention
page, +3377152 B slack per block)'. The GDN state page is a fifth of an attention
page and can only be padded UP, never split, because our attention backend does not
set indexes_kv_by_block_stride -- so 80.5% of every GDN page is slack. The device
never wanted that memory: it allocates only the attention paged KV and holds GDN
state per decode slot, never per block.

The banner also points at the lever. The slack is worst precisely when the GDN page
is much smaller than the attention page, which is the 2048/2048 case we ship; a
larger --mamba-block-size fills the page instead of wasting it, and qwen36_vllm.py
already accepts any multiple of 2048. Whether that actually returns the pool is one
boot away and is not claimed here -- this arm reported 95.5% of cacheable at POOL
786,432 where the old ladder reported 72.7% at 1,048,576, but the two also differ by
--mamba-ssm-cache-dtype and both landed near 766k, which could be a cap.

Booting the shipping arm for the first time also showed that enablePrefixCaching
could not have worked at all. Two construction failures, neither reachable by
reading: no --max-num-batched-tokens (fixed), and disable_chunked_mm_input against
block_size 2048 (open). The option had been rendered, asserted over and reviewed for
an evening without once being started.

What the boot does license: the arm is what it claims on hardware -- 64 bf4 banners,
exactly the decoder-layer count, SDPA streaming, prefix caching, and a warm load from
the G2 cache with no placeholder tensors. It is not gate 2: no request was served.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
serving: declare no multimodal budget, and record what the pool is actually blocked on
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 11s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 34s
610da97f21
Three things, all from the same failed attempt to boot the prefix-caching arm.

--limit-mm-per-prompt '{"image":0,"video":0}'. The arm died twice after a full
weight load, the second time on "Chunked MM input is required because we need the
flexibility to schedule a multiple of block_size tokens even if they are in the
middle of a mm input" (vllm/config/vllm.py:2274). We set QWEN36_SKIP_VISION=1, so
the vision tower is never built and image/video requests are rejected outright;
declaring a zero multimodal budget is the honest statement of that. The
alternative, disable_chunked_mm_input=False, would enable chunking for a modality
that cannot arrive, and changes the prefill path to buy nothing.

--mamba-block-size does not recover the pool. Measured at 2048 and 32768: the
page-align banner is byte-identical (817152 B -> 4194304 B, 80.5% slack) and the
engine reports the same 766,869 tokens. A MambaSpec page is sized by the GDN
state, which is per-sequence and context-independent, so block size cannot fill
it. The cheap lever was never there; recovering the ~4.65 GiB/card needs a
MambaSpec change, which is not started.

gdnPrefillPrecision, default off. Issue #71 (mtp-thinkingcap 814108e) root-caused
the GDN prefill error to the decay gate's precision: QWEN36_GDN_G_FP32=1 plus
QWEN36_GDN_AB_BF8=prefill take layer error from 19.1% to 3.5% at L6 at no decode
cost, and it applies to any QWEN36_ATTN_GDN_BF4 arm, which is what G2 is. The
option and its two banner checks land here; it stays off until there is a KL and
top-1 confirmation against the FP8 teacher, because #71 is a numerical result and
not yet a quality one. It costs no device memory, so no budget figure moves.

Two ledger entries go with this: the corrected 31.87/31.37 GiB usable DRAM (every
earlier budget subtracted the trace region twice, because get_memory_view already
reports bank capacity net of it), and the trap that prefix caching had only ever
been rendered, never booted -- which is precisely the failure class the
banner-and-gate rules exist to catch, and it got past them because the gates were
applied to the arm specification rather than to a process that reached
"Application startup complete".

Refs #48, #62, #71, #73.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Owner

Pool update, and the GDN precision flags from #71

--mamba-block-size does not recover the pool. Negative result, measured.
Record: bench/runs/prefix-mamba-block-size-20260925T220000Z.jsonl.

--mamba-block-size GDN page padded to slack/block GPU KV cache size
2048 817,152 B 4,194,304 B +3,377,152 B (80.5%) 766,869 tokens
32768 817,152 B 4,194,304 B +3,377,152 B (80.5%) 766,869 tokens

Byte-identical. A MambaSpec page is sized by the GDN state, which is
per-sequence and context-independent (72 MiB/sequence), so the block size cannot
multiply it and cannot fill the page. The cheap configuration lever was never
there. Recovering the ~4.65 GiB/card costs a MambaSpec change — one page per
sequence rather than per block — which is engineering, not configuration, and is
not started pending a decision on who owns it.

Stated plainly, as asked: the accounting corrections and K8/V4 together are now
the only combination that reaches 8×128k / 4×256k with prefix caching on. The
accounting alone recovers +1.0 GiB/card (the trace region was subtracted twice —
ttnn.get_memory_view already reports bank capacity net of it, so usable DRAM is
31.87 GiB/card with no trace and 31.37 GiB at TRACE_MIB=512) and removes a
phantom ~0.56 GiB/card charge for prefix snapshots, which are host tensors. Neither
closes the 287,093-token admission shortfall on its own.

GDN precision flags (#71) prepared, default off. services.tenstorrentServing.gdnPrefillPrecision
sets QWEN36_GDN_G_FP32=1 and QWEN36_GDN_AB_BF8=prefill, with readiness banner
checks for both — including that AB_BF8 reads prefill and not 1, since applying
it at decode costs +7.7 ms/token for error that only integrates in prefill. It applies
to any QWEN36_ATTN_GDN_BF4 arm, so to the G2 weights this PR ships. It changes no
figure in the KV budget
: the fp32 g and the bf8 a/b are prefill activations.

It stays off until there is a KL and top-1 confirmation against the FP8 teacher —
#71 is a numerical result (error against an fp32 reference), not a quality one.

One thing this PR cannot do on its own: the flags need the #71 hunks in
patches/prod-local-metal/.../tt/gdn/tp.py, and they are not a mechanical port.
The version on mtp-thinkingcap is a TP=1-divergent tree — different tt_all_reduce
import, fused_recurrent_gated_delta_rule_ttnn, TP=1 fusion gating, an MTP-head bf4
exemption, and two _project_qkvzab call sites where the production overlay has
three. The ab8 path also changes the forward signature, not just the loader. That
port should come from whoever owns and can test that file, or after
mtp-thinkingcap lands on master — not from a blind copy here.

Not fixed by this work and not a regression from it: the underlying GDN prefill
error (layers 1–30, 8–19% off fp32 in ~5.5% of heads) is pre-existing and affects the
deployed FP8 arm equally. #71 is the fix; this PR only prepares the switch for it.

Licence, on record: ThinkingCap-Qwen3.8-27B is PolyForm Small Business 1.0.0.
Internal serving only; no publication or redistribution of the weights or of the
quantised G2 derivative as part of this work.

Still WIP. No production switch until the pool question is settled.

🤖 Generated with Claude Code

### Pool update, and the GDN precision flags from #71 **`--mamba-block-size` does not recover the pool. Negative result, measured.** Record: `bench/runs/prefix-mamba-block-size-20260925T220000Z.jsonl`. | `--mamba-block-size` | GDN page | padded to | slack/block | `GPU KV cache size` | |---|---|---|---|---| | 2048 | 817,152 B | 4,194,304 B | +3,377,152 B (80.5%) | 766,869 tokens | | 32768 | 817,152 B | 4,194,304 B | +3,377,152 B (80.5%) | 766,869 tokens | Byte-identical. A `MambaSpec` page is sized by the GDN **state**, which is per-sequence and context-independent (72 MiB/sequence), so the block size cannot multiply it and cannot fill the page. The cheap configuration lever was never there. Recovering the ~4.65 GiB/card costs a `MambaSpec` change — one page per sequence rather than per block — which is engineering, not configuration, and is **not started** pending a decision on who owns it. **Stated plainly, as asked:** the accounting corrections and K8/V4 together are now the only combination that reaches 8×128k / 4×256k with prefix caching on. The accounting alone recovers +1.0 GiB/card (the trace region was subtracted twice — `ttnn.get_memory_view` already reports bank capacity net of it, so usable DRAM is **31.87 GiB/card** with no trace and **31.37 GiB** at `TRACE_MIB=512`) and removes a phantom ~0.56 GiB/card charge for prefix snapshots, which are host tensors. Neither closes the 287,093-token admission shortfall on its own. **GDN precision flags (#71) prepared, default off.** `services.tenstorrentServing.gdnPrefillPrecision` sets `QWEN36_GDN_G_FP32=1` and `QWEN36_GDN_AB_BF8=prefill`, with readiness banner checks for both — including that `AB_BF8` reads `prefill` and not `1`, since applying it at decode costs +7.7 ms/token for error that only integrates in prefill. It applies to any `QWEN36_ATTN_GDN_BF4` arm, so to the G2 weights this PR ships. **It changes no figure in the KV budget**: the fp32 `g` and the bf8 `a`/`b` are prefill activations. It stays off until there is a KL and top-1 confirmation against the FP8 teacher — #71 is a numerical result (error against an fp32 reference), not a quality one. **One thing this PR cannot do on its own:** the flags need the `#71` hunks in `patches/prod-local-metal/.../tt/gdn/tp.py`, and they are not a mechanical port. The version on `mtp-thinkingcap` is a TP=1-divergent tree — different `tt_all_reduce` import, `fused_recurrent_gated_delta_rule_ttnn`, TP=1 fusion gating, an MTP-head bf4 exemption, and two `_project_qkvzab` call sites where the production overlay has three. The `ab8` path also changes the forward signature, not just the loader. That port should come from whoever owns and can test that file, or after `mtp-thinkingcap` lands on master — not from a blind copy here. **Not fixed by this work and not a regression from it:** the underlying GDN prefill error (layers 1–30, 8–19% off fp32 in ~5.5% of heads) is pre-existing and affects the deployed FP8 arm equally. #71 is the fix; this PR only prepares the switch for it. **Licence, on record:** ThinkingCap-Qwen3.8-27B is PolyForm Small Business 1.0.0. Internal serving only; no publication or redistribution of the weights or of the quantised G2 derivative as part of this work. Still WIP. No production switch until the pool question is settled. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kv: "GPU KV cache size" is not the pool — the 287,093-token shortfall never existed
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 11s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 33s
0a1e01e413
I recorded an 8-of-11 admission shortfall earlier today and it was wrong. Withdrawing
it before anyone builds on it.

`GPU KV cache size` (vllm/v1/core/kv_cache_utils.py:2177) is
get_kv_cache_capacity() = int(max_concurrency * max_model_len) (:1819-1829) — a
reported capacity, not an allocation. The line directly above it in the same boot
reads "Overriding num_gpu_blocks=392 with num_gpu_blocks_override=392": the pool
was delivered in full, exactly as asked. I derived a deficit from one log line
without reading the one above it.

bench/probes/kv_capacity_model.py reconstructs the reported figure from the group
structure alone and reproduces the observed boot to the token — 766,869 predicted,
766,869 logged, 2.93x concurrency — which is what makes the rest of this trustworthy
rather than another estimate.

What it says. A 256k request costs 134 blocks, of which 128 are attention and 6 are
GDN. Attention is the binding constraint; the GDN groups are 4.5% of it. The pool
was 786,432 for exactly one reason: the poolTokens <= 786432 assertion this branch
added at Gate 1. Concurrency against the 4x256k target is 2.93x at 786,432, 3.88x at
1,048,576, and 4.00x at 1,081,344 — so the target is a pool number, and 1,048,576 is
not it.

The per-sequence GDN spec cannot be built, and it would not be enough if it could.
A perfect fix moves 3.88x -> 3.97x and still misses 4.0. And the declaration is not
available: unify_kv_cache_spec_page_size (:1098-1107) pads a MambaSpec back up to the
attention page unconditionally and asserts the result, get_uniform_page_size
(:1010-1016) asserts one page size across groups, and indexes_kv_by_block_stride does
not apply to a MambaSpec at all — it is not an AttentionSpec, so the field does not
exist on it, and the flag gates only the attention padding fallback, which would raise
the uniform page and cost capacity rather than recover it. The 3x is three GDN groups,
from group_size = min(16,48) = 16; forcing one group sets group_size to 48 and divides
the block count by three. Recovering the padding means patching vLLM's uniform-page
hybrid design for 2.3% that misses the target anyway.

The pool assertion stays fail-closed at 786,432. It is not a formality and not mine to
raise on arithmetic: a traced decode at 1,048,576 with caching on did OOM the device
(prefix-traced-dram-oom-20260918T1540Z.jsonl), nothing on the TT path measures free
DRAM (determine_available_memory returns 1<<64, so an over-large pool OOMs on the
first request rather than clamping), and the G2 TP=2 weight footprint is still
unmeasured. Its message now carries the real numbers and the reason instead of a
capacity claim derived from the figure I misread.

Refs #48, #73.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Owner

Correction: the 287,093-token shortfall never existed, and the target is a pool number

I reported an 8-of-11 "admission shortfall" earlier today. It was wrong. Withdrawing
it before anything is built on it.

GPU KV cache size (kv_cache_utils.py:2177) is
get_kv_cache_capacity() = int(max_concurrency * max_model_len) (:1819-1829) — a
reported capacity, not an allocation. The line directly above it in the same boot log
reads Overriding num_gpu_blocks=392 with num_gpu_blocks_override=392: the pool was
delivered in full. I derived a deficit from one log line without reading the one above it.

bench/probes/kv_capacity_model.py reconstructs the reported figure from the group
structure alone and reproduces the observed boot to the token — 766,869 predicted,
766,869 logged, 2.93x — which is what makes the rest of this a result rather than another
estimate. Record: bench/runs/kv-capacity-model-20260925T230000Z.jsonl.

Where a 256k request's 134 blocks go: 128 attention, 6 GDN. Attention KV is the
binding constraint on concurrency; the GDN groups are 4.5% of it.

The pool was 786,432 for one reason — the poolTokens <= 786432 assertion this branch
added at Gate 1.
Capacity against the 4×256k target:

POOL blocks reported tokens concurrency 4×256k
786,432 392 766,869 2.925 no
1,048,576 520 1,017,275 3.881 no
1,081,344 536 1,048,576 4.000 yes

Note 1,048,576 — the number the target shapes are usually quoted at — is not enough;
the per-request output reservation pushes it to 1,081,344.

The per-sequence GDN spec cannot be built, and would not be enough if it could

A perfect fix moves concurrency 3.881 → 3.969 at POOL 1,048,576 and still misses 4.0.
And the declaration is not available:

  • unify_kv_cache_spec_page_size (:1098-1107) pads a MambaSpec back up to the largest
    page unconditionally and asserts the result — a smaller honest page is not rejected,
    it is silently padded back. Bypass that and get_uniform_page_size (:1010-1016)
    asserts len(page_sizes) == 1.
  • indexes_kv_by_block_stride is not the mechanism. MambaSpec is not an
    AttentionSpec (kv_cache_interface.py:690), so the field does not exist on it. It
    gates only the attention padding fallback (:1114-1118), which raises the uniform
    page and costs capacity rather than recovering it.
  • The 3× is three GDN groups, not blocks: group_size = min(16,48) = 16 (:1221-1232)
    and the concurrency denominator sums max_memory_usage_bytes once per group (:937-955).
    Forcing one GDN group sets group_size = 48 and divides the block count by three — a net
    loss.

So recovering the padding means patching vLLM's uniform-page hybrid design itself, for 2.3%
of capacity that misses the target anyway. I have not started it, and on this evidence it
should not be started.

What actually gates the target

Whether POOL 1,081,344 physically fits, which is unmeasured and the real risk. A traced
decode at 1,048,576 with caching on did OOM the device
(prefix-traced-dram-oom-20260918T1540Z.jsonl); nothing on the TT path measures free DRAM
(determine_available_memory returns 1<<64, so an over-large pool OOMs on the first
request rather than clamping); and the G2 TP=2 weight footprint is still UNMEASURED. At bf8
KV that pool is ~16.5 GiB/card against 31.37 GiB usable, leaving ~14.9 GiB for weights.

The assertion therefore stays fail-closed at 786,432 — it is not mine to raise on
arithmetic. Its message now carries the real numbers and the reason. The queued mesh slot
(behind the MTP agent, never preempting) runs the POOL boot and the FP8/G2 tp_load_probe
readings that decide it.

🤖 Generated with Claude Code

### Correction: the 287,093-token shortfall never existed, and the target is a pool number I reported an 8-of-11 "admission shortfall" earlier today. **It was wrong.** Withdrawing it before anything is built on it. `GPU KV cache size` (`kv_cache_utils.py:2177`) is `get_kv_cache_capacity() = int(max_concurrency * max_model_len)` (`:1819-1829`) — a **reported capacity**, not an allocation. The line directly above it in the same boot log reads `Overriding num_gpu_blocks=392 with num_gpu_blocks_override=392`: the pool was delivered in full. I derived a deficit from one log line without reading the one above it. `bench/probes/kv_capacity_model.py` reconstructs the reported figure from the group structure alone and reproduces the observed boot **to the token** — 766,869 predicted, 766,869 logged, 2.93x — which is what makes the rest of this a result rather than another estimate. Record: `bench/runs/kv-capacity-model-20260925T230000Z.jsonl`. **Where a 256k request's 134 blocks go:** 128 attention, 6 GDN. Attention KV is the binding constraint on concurrency; the GDN groups are 4.5% of it. **The pool was 786,432 for one reason — the `poolTokens <= 786432` assertion this branch added at Gate 1.** Capacity against the 4×256k target: | POOL | blocks | reported tokens | concurrency | 4×256k | |---|---|---|---|---| | 786,432 | 392 | 766,869 | 2.925 | no | | 1,048,576 | 520 | 1,017,275 | 3.881 | no | | **1,081,344** | 536 | 1,048,576 | **4.000** | **yes** | Note 1,048,576 — the number the target shapes are usually quoted at — is **not** enough; the per-request output reservation pushes it to 1,081,344. ### The per-sequence GDN spec cannot be built, and would not be enough if it could A perfect fix moves concurrency 3.881 → 3.969 at POOL 1,048,576 and still misses 4.0. And the declaration is not available: - `unify_kv_cache_spec_page_size` (`:1098-1107`) pads a `MambaSpec` back up to the largest page **unconditionally** and asserts the result — a smaller honest page is not rejected, it is silently padded back. Bypass that and `get_uniform_page_size` (`:1010-1016`) asserts `len(page_sizes) == 1`. - **`indexes_kv_by_block_stride` is not the mechanism.** `MambaSpec` is not an `AttentionSpec` (`kv_cache_interface.py:690`), so the field does not exist on it. It gates only the *attention* padding fallback (`:1114-1118`), which raises the uniform page and costs capacity rather than recovering it. - The 3× is three GDN **groups**, not blocks: `group_size = min(16,48) = 16` (`:1221-1232`) and the concurrency denominator sums `max_memory_usage_bytes` once per group (`:937-955`). Forcing one GDN group sets `group_size = 48` and divides the block count by three — a net loss. So recovering the padding means patching vLLM's uniform-page hybrid design itself, for 2.3% of capacity that misses the target anyway. **I have not started it, and on this evidence it should not be started.** ### What actually gates the target Whether POOL 1,081,344 **physically fits**, which is unmeasured and the real risk. A traced decode at 1,048,576 with caching on did OOM the device (`prefix-traced-dram-oom-20260918T1540Z.jsonl`); nothing on the TT path measures free DRAM (`determine_available_memory` returns `1<<64`, so an over-large pool OOMs on the first request rather than clamping); and the G2 TP=2 weight footprint is still UNMEASURED. At bf8 KV that pool is ~16.5 GiB/card against 31.37 GiB usable, leaving ~14.9 GiB for weights. The assertion therefore **stays fail-closed at 786,432** — it is not mine to raise on arithmetic. Its message now carries the real numbers and the reason. The queued mesh slot (behind the MTP agent, never preempting) runs the POOL boot and the FP8/G2 `tp_load_probe` readings that decide it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kv: withdraw the shortfall everywhere it propagated, and arm the measurement that decides the pool
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 12s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 33s
ba11d8dbae
Follow-up to 0a1e01e, which withdrew the 287,093-token "admission shortfall" in the
ledger, the module and #73. It had propagated further:

- docs/HARDWARE.md carried the same misreading as a Notes bullet ("the engine charges
  ~44.1 KiB/token ... 765,579 engine KV tokens against 1,052,672 cacheable"). The two
  numbers are not comparable: 1,052,672 is the pool the device allocated, 765,579 is
  int(max_concurrency * max_model_len). Replaced with the withdrawal and with the
  figure from that rung that IS sound and IS measured -- 17,408 B/token/device.
- bench/runs/prefix-mamba-block-size-…jsonl and kv-budget-rederivation-…jsonl, both
  written by me today, carried it as a live claim. Marked WITHDRAWN in place, with the
  reason and the superseding record. The mamba-block-size negative result those records
  exist for is unaffected and stands.

The per-sequence GDN spec is cancelled and not built.

What the fit actually turns on. kv_capacity_model.py now carries the DRAM side, and the
per-token cost in it is MEASURED rather than derived: prefix-pool-ladder-20260915T055327Z
allocated 18,324,914,176 B for 514 x 2048 tokens = 17,408 B/token/card. That record also
settles something the risk framing had wrong -- POOL 1,048,576 with prefix caching
BOOTS, verdict PASS. The 1M OOM we have been citing was a TRACED arm, and that record
says so itself: it was the traced prefill buckets, not the cache.

On the best weight number available, POOL 1,081,344 at bf8 lands at 30.61 of 31.37
GiB/card -- fits, with 0.76 GiB to spare. That margin is inside the uncertainty of the
weight figure, which is a text_demo dram_after_load reading and therefore weights PLUS
that demo's working set. Which is exactly why this commit adds the two arms rather than
a conclusion.

load-probe-fp8-tp2 and load-probe-g2-tp2 read the weight footprint on the PRODUCTION
source tree at TP=2, one per checkpoint, to be run in one window so the delta is free of
host drift. The FP8 one is the control the ~25.1 GiB inherited estimate never had. The
G2 one keeps the 64x QWEN36_ATTN_GDN_BF4 banner check, because tensorbins are named for
the tensor and its dtype and never for the checkpoint, so a cache adopt with no identity
check would read FP8 weights under a G2 name.

The poolTokens <= 786432 assertion stays fail-closed. It is raised by a boot record or
not at all.

Refs #48, #73.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ledger: a card claim outlived its process by 4h47m and idled the box
All checks were successful
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 11s
tt-stack-ci / Report upstream drift (pull_request) Successful in 4s
0e8fa5390e
Three agents queued behind a corpse at load average 0.06, zero containers, no
tt-metal process alive. One of the waiters was my own load probe, which then
timed out REFUSED having measured nothing.

The cause belongs where agents read first: `ttx slot acquire` polls over ssh ON
THE BOX, so killing a driver locally does not kill an acquire already in flight.
The orphan won the mesh two hours after its parent died and nothing released it.
A local pkill was never enough; the remote waiter has to be killed too.

Also records why the obvious fix is wrong. The owner line carries pid@host, so
checking it looks like the answer -- but a slot is designed to outlive the ssh
session that took it, so that pid is dead moments after a perfectly HEALTHY
acquisition, and reclaiming on pid liveness would evict every live job on the
box. Container occupancy plus age is the test.

Fix, tests and the procedure are in PR #91.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bench: G2 weights are 11.27 GiB/card measured, and the usable-DRAM figure is open by 0.5 GiB
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 4s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 11s
dcea28e45c
First direct reading of the shipping checkpoint's weight footprint on the production
tree at TP=2: dram_after_load = 12,096,289,792 B = 11.27 GiB/card, model load 605 s
(bench/runs/ttx-load-probe-g2-tp2-smoke-20260926T012313Z.jsonl). That is 1.5 GiB below
the 12.81 GiB we had been budgeting with, as expected -- the old number came from a
text_demo arm and carried that demo's working set.

Against the conservative usable figure, POOL 1,081,344 lands at 29.07 of 30.87 GiB/card
with 1.80 GiB free, at concurrency 4.00x. That is the 4x256k target. It is NOT permission
to raise the pool: the reading is weights at load time, with no vLLM working set, no
activations and no traced prefill buckets -- and the traced buckets are exactly what
exhausted the card at POOL 1M before. The pool boots decide it.

The same record reopens a number I corrected yesterday. The trace ladder reads 31.37
GiB/card at TRACE_MIB=512; this probe, running the actual production arm at the same
trace size, reads 30.87 -- which is what the ladder attributes to TRACE_MIB=1024. Exactly
one trace region is unaccounted for. I am not picking a winner: both readings are in
docs/HARDWARE.md under an OPEN heading with the candidate explanations, budgets use the
conservative 30.87, and the ledger says so. The direction of yesterday's correction still
holds -- get_memory_view is net of the trace region and subtracting it again double-charges
it -- but my absolute figures were a region too high, because having found the double
charge I added one back to the wrong row.

Two arm-spec fixes. Both load probes are kind = "demo" and inherited prod's [expect]
list, which is a vLLM SERVER banner set; a no-vLLM arm cannot satisfy it, so the G2 run
is stamped REFUSED even though the measurement is sound and the identity that matters did
pass (QWEN36_ATTN_GDN_BF4 engaged x64 and QWEN36_BFP4_PACKED engaged were observed). The
arms now replace that list rather than extend it: G2 checks the two loader banners, and
the FP8 control gets the NEGATIVE check it should have had from the start -- those two
banners must be ABSENT, or it is not the bfloat8_b control it claims to be. Both need a
clean re-run before the numbers count as evidence.

The FP8 control still has no reading: it lost its window to the stale-slot incident
(R-2026-09-26-stale-slot) and is re-queued behind the pool ladder.

Refs #48, #73.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bench: drop FP8 for good, and retire its weight estimate rather than measure it
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 14s
d5a78bcb9c
Owner, 2026-09-26: "we already have plenty of data on FP8, stop running it, and focus
on our bfp4 quant, and get THAT to run faster." So the FP8 control arm is deleted, its
re-run is killed (local driver and the remote acquire orphan both), and it is out of
every queue.

The ~25.1 GiB FP8 TP=2 weight estimate is therefore RETIRED WITH NO SUCCESSOR, and
HARDWARE.md says so in those words. It had no record behind it and was only ever a
back-derivation from pool arithmetic; leaving it marked UNMEASURED would invite someone
to go and measure it, which is the opposite of the instruction. The number the budgets
actually need is the bfp4 one and it is measured: 11.27 GiB/card for G2 packed at TP=2.

The negative-banner check the FP8 control introduced is kept, on the arm that survives,
with a note saying why it is the half people forget: a positive banner proves a flag was
read, `absent` proves the OTHER arm was not run by mistake. That matters whenever arms
share a tensor cache, because tensorbins are named for the tensor and its dtype and never
for the checkpoint.

Also recorded: tenstorrent-serving.service is a NUISANCE, not production -- there is no
production on TT, this is research. It cold-booted the FP8 snapshot onto both cards
holding no ttx slot and cost a second window. It cannot be disabled from the host
(read-only Nix store), so it returns on any reboot. ttx now names unslotted containers on
the status line (PR #91); masking the unit through nixos-llm is the durable fix and is
not done yet.

Refs #48, #73.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bench: POOL 1,048,576 allocates exactly as predicted; the blocker is align mode vs the TT plugin
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 4s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 13s
6aac857cf4
Rung 1 of the pool ladder. The KV cache sized to num_gpu_blocks=520, GPU KV cache size
1,017,275 tokens, 3.88x concurrency -- against a prediction of 520 / 1,017,275 / 3.881
written before the boot. kv_capacity_model.py now reproduces two independent boots to the
token, so its 1,081,344 projection (536 / 1,048,576 / 4.00x) is arithmetic worth trusting,
though still unverified on hardware.

Memory was never the blocker here. MemAvailable low-water 3,786 MB, sampled every 10 s
DURING weight load -- the phase the 2026-09-14 freezes happened in, and the one the
acquire-time 4 GB check does not cover. It stayed 2.25 GB above the 1.5 GB stop floor. A
1,048,576-token pool did not come close to exhausting the host.

What actually stops the arm is a code conflict, and no serve argument bridges it.
vllm/config/vllm.py:2274 asserts `not disable_chunked_mm_input` UNCONDITIONALLY whenever
mamba_cache_mode == "align"; it reads neither the model's modalities nor
limit_mm_per_prompt. And the TT plugin itself sets that flag True unconditionally
(vllm_tt_plugin/platform.py:207). Align mode and the plugin are mutually incompatible as
they stand.

So the --limit-mm-per-prompt change could never have fixed this -- it cannot satisfy an
assertion that never reads it. It stays, because it did fix a different earlier failure.
I should have read the assertion before believing a plausible story about which flag it
was testing.

On flipping the flag, since it will be asked: it lets a chunk boundary land inside a
multimodal item. On our traffic that is inert -- the vision tower is never built and
image/video are rejected at admission, so there is no item to split. The cost is the lost
guard: a later regression removing QWEN36_SKIP_VISION or the mm limit would fail as a
silent embedding/position mismatch instead of a refusal. The fix is to make platform.py:207
conditional on a non-zero multimodal budget, not to force the flag off. Not applied.

Rung 2 was not run. It would fail identically -- the assertion is on the cache mode, not on
the pool -- so it would have bought a third confirmation of arithmetic at the cost of
another full weight load on a host carrying ~7 GB of leaked pinned pages, beside another
agent's parked work. Container stopped gracefully, both cards released.

Two process notes. The ledger's stale-slot entry was clobbered by one of my own slice edits
and is restored here. And ttx's new unslotted-container warning caught my own orphan within
minutes of landing: killing the ladder driver released the slot through its trap but left
the container running on both device nodes. A slot-holding trap must `ttx down` before
`slot release`, in that order.

Refs #48, #73.

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

Do not merge and do not deploy. Gates 2–4 never ran, and this branch is pre-BEST. G2 weights and K8/V4 are already on master. Prefix deploy stays on #48.

Do not merge and do not deploy. Gates 2–4 never ran, and this branch is pre-BEST. G2 weights and K8/V4 are already on master. Prefix deploy stays on #48.
Member

Closing: every commit on this branch (head 6aac857c) is already on master f30ab09. Gates 2–4 never ran; the prefix deploy stays on #48. Triage 2026-10-09.

Closing: every commit on this branch (head 6aac857c) is already on master f30ab09. Gates 2–4 never ran; the prefix deploy stays on #48. Triage 2026-10-09.
tenstorrent closed this pull request 2026-10-09 10:53:55 +02:00
Author
Owner

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

agent-gateway closeout (closed): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 4s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 13s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack!73
No description provided.