deploy: ship prefix caching (gates 2–4) — measured makespan −73…−86% on shared-prefix #94

Closed
opened 2026-09-26 04:44:25 +02:00 by tenstorrent · 8 comments
Member

Parent / blocked-by tracking via #90 grill board (deploy lane). Related: #73.

Grill call: GO (lane 2 — biggest wall win on agent workloads)

Hypothesis. Shared-prefix agents: makespan −73%…−86% already measured (R-2026-09-18-prefix, phase2a-prefix-e2e).

Depends on. Gates 2–4 on #73; pool ≤786k + block 2048 when caching on; patch 0019 present; watch host MemAvailable (leak R-2026-09-25-hostleak).

Risk. Silent wrong weights if cacheDir wrong (#73 gate1 trap); DRAM OOM at 1M pool.

Measure first. Boot prod-g2-prefix, banners + aligned-resume equiv + one sweep-32k.

Refs: grill 2026-09-26 Tenstorrent; #73 WIP serving ThinkingCap bfp4 G2 + prefix caching.

Parent / blocked-by tracking via #90 grill board (deploy lane). Related: #73. ## Grill call: **GO** (lane 2 — biggest wall win on agent workloads) **Hypothesis.** Shared-prefix agents: makespan −73%…−86% already measured (`R-2026-09-18-prefix`, `phase2a-prefix-e2e`). **Depends on.** Gates 2–4 on #73; pool ≤786k + block 2048 when caching on; patch 0019 present; watch host MemAvailable (leak `R-2026-09-25-hostleak`). **Risk.** Silent wrong weights if `cacheDir` wrong (#73 gate1 trap); DRAM OOM at 1M pool. **Measure first.** Boot `prod-g2-prefix`, banners + aligned-resume equiv + one `sweep-32k`. Refs: grill 2026-09-26 Tenstorrent; #73 WIP serving ThinkingCap bfp4 G2 + prefix caching.
Owner

Cycle 11 finding that affects gate delivery for prefix caching: --mamba-cache-mode align and chunked prefill are mutually exclusive on vllm-tt:k2 and the arm cannot boot with both.

vllm_tt_plugin/platform.py:207 sets scheduler_config.disable_chunked_mm_input = True unconditionally once chunked prefill survives _apply_chunked_prefill_policy; vLLM 0.26.0's VllmConfig.validate_block_size then asserts not disable_chunked_mm_input inside the mamba_cache_mode == "align" branch.

It presents as a load failure, because validate_block_size runs from _initialize_kv_caches — after the full three-minute weight load. Two boots of prod-g2-prefix died at 40/64 and 64/64 QWEN36_ATTN_GDN_BF4 banners and read exactly like an OOM. They were not: MemAvailable held at 2.4–3.2 GB and the kernel logged nothing.

Fix: --no-enable-chunked-prefill in the arm's serve args. Free here, since --max-num-batched-tokens already equals max_model_len, so chunked prefill never split a prefill anyway.

prod-prefix.toml carries the same align without that flag and is predicted to fail identically — predicted, not measured; there is no boot record of it on vllm-tt:k2. Worth checking before the gate run.

Record: bench/runs/perf-loop-c11-align-chunked-prefill-20260926T1045Z.jsonl (+ full container log), PR #90.

Blocked from verifying on hardware by #101 (pinned leak, MemAvailable 3958 < 4096, no boots possible).

Cycle 11 finding that affects gate delivery for prefix caching: **`--mamba-cache-mode align` and chunked prefill are mutually exclusive on `vllm-tt:k2`** and the arm cannot boot with both. `vllm_tt_plugin/platform.py:207` sets `scheduler_config.disable_chunked_mm_input = True` unconditionally once chunked prefill survives `_apply_chunked_prefill_policy`; vLLM 0.26.0's `VllmConfig.validate_block_size` then asserts `not disable_chunked_mm_input` inside the `mamba_cache_mode == "align"` branch. It presents as a load failure, because `validate_block_size` runs from `_initialize_kv_caches` — *after* the full three-minute weight load. Two boots of `prod-g2-prefix` died at 40/64 and 64/64 `QWEN36_ATTN_GDN_BF4` banners and read exactly like an OOM. They were not: MemAvailable held at 2.4–3.2 GB and the kernel logged nothing. Fix: `--no-enable-chunked-prefill` in the arm's serve args. Free here, since `--max-num-batched-tokens` already equals `max_model_len`, so chunked prefill never split a prefill anyway. **`prod-prefix.toml` carries the same `align` without that flag and is predicted to fail identically** — predicted, not measured; there is no boot record of it on `vllm-tt:k2`. Worth checking before the gate run. Record: `bench/runs/perf-loop-c11-align-chunked-prefill-20260926T1045Z.jsonl` (+ full container log), PR #90. Blocked from verifying on hardware by #101 (pinned leak, MemAvailable 3958 < 4096, no boots possible).
Owner

Follow-up to my previous comment — clearing the disable_chunked_mm_input deadlock got the boot much further, and exposed a second, deeper blocker that is a capability gap, not a config error.

With the plugin patched so align is reachable, prod-g2-prefix now boots to 64/64 bf4 banners, sizes the pool in full (num_gpu_blocks=392, GPU KV cache size: 766,869 tokens) and then dies in KV allocation:

TypeError: Expected AttentionSpec/UniformTypeKVCacheSpecs for group
['model.layers.0.linear_attn', 'model.layers.4.linear_attn', ... 16 GDN layers],
got MambaSpec
  vllm_tt_plugin/model_runner.py:469 _validate_kv_cache_groups

In mamba_cache_mode="align" vLLM builds a separate KVCacheGroupSpec for the 16 GDN linear_attn layers carrying a MambaSpec. Our model_runner allocates KV only for the 16 full-attention layers — the GDN recurrent state is owned by the TT model, not by vLLM's KV manager — so it rejects any non-attention spec outright.

So align + prefix caching has never run through this model_runner. Which raises a question I cannot answer from here: the −87.5% makespan result on 4e91d87 was produced by something other than this path. Worth reconciling what configuration that run actually used before the number is cited in the gate.

Two patches are on PR #90 if useful:

  • patches/prod-local-plugin/.../platform.py — guards disable_chunked_mm_input on the mm limits actually being nonzero, banner QWEN36_MM_CHUNK_GUARD. Needed by anything that wants align at all.
  • bench/arms/prod-g2.toml — bfp4 control with prefix caching OFF, so bfp4 measurement is not blocked behind this.

Record: bench/runs/perf-loop-c12-align-mambaspec-20260926T0907Z.jsonl.

Follow-up to my previous comment — clearing the `disable_chunked_mm_input` deadlock got the boot much further, and exposed a **second, deeper blocker that is a capability gap, not a config error**. With the plugin patched so `align` is reachable, `prod-g2-prefix` now boots to **64/64 bf4 banners**, sizes the pool in full (`num_gpu_blocks=392`, `GPU KV cache size: 766,869 tokens`) and then dies in KV allocation: ``` TypeError: Expected AttentionSpec/UniformTypeKVCacheSpecs for group ['model.layers.0.linear_attn', 'model.layers.4.linear_attn', ... 16 GDN layers], got MambaSpec vllm_tt_plugin/model_runner.py:469 _validate_kv_cache_groups ``` In `mamba_cache_mode="align"` vLLM builds a separate `KVCacheGroupSpec` for the 16 GDN `linear_attn` layers carrying a `MambaSpec`. Our `model_runner` allocates KV only for the 16 full-attention layers — the GDN recurrent state is owned by the TT model, not by vLLM's KV manager — so it rejects any non-attention spec outright. **So `align` + prefix caching has never run through this `model_runner`.** Which raises a question I cannot answer from here: **the −87.5% makespan result on 4e91d87 was produced by something other than this path.** Worth reconciling what configuration that run actually used before the number is cited in the gate. Two patches are on PR #90 if useful: - `patches/prod-local-plugin/.../platform.py` — guards `disable_chunked_mm_input` on the mm limits actually being nonzero, banner `QWEN36_MM_CHUNK_GUARD`. Needed by anything that wants `align` at all. - `bench/arms/prod-g2.toml` — bfp4 control with prefix caching OFF, so bfp4 measurement is not blocked behind this. Record: `bench/runs/perf-loop-c12-align-mambaspec-20260926T0907Z.jsonl`.
Owner

Heads-up from perf-loop c22 (master 97bed9d): before today a prefix boot on master could not succeed (MambaSpec TypeError at KV init) because the prefix overlay was never committed. It's now patches/prefix-local, mounted by the nix unit when enablePrefixCaching, plus trace_mode=decode_only. The unit's mount set CHANGED, so any deploy of prefix caching must use master >= a6cf6bc. Distinct-prompt 4k/B=8 cost: +21.8% makespan vs prod-g2; shared-head benefit is being measured (c24).

Heads-up from perf-loop c22 (master 97bed9d): before today a prefix boot on master could not succeed (MambaSpec TypeError at KV init) because the prefix overlay was never committed. It's now patches/prefix-local, mounted by the nix unit when enablePrefixCaching, plus trace_mode=decode_only. The unit's mount set CHANGED, so any deploy of prefix caching must use master >= a6cf6bc. Distinct-prompt 4k/B=8 cost: +21.8% makespan vs prod-g2; shared-head benefit is being measured (c24).
Owner

c24/c25 (master): prefix caching on ≤32k, B=8, 16k prompts. With an 87.5% shared head the cold cell is -13.3% makespan (intra-batch sharing), but the warm cell killed the engine on the default QWEN36_PREFIX_MAX_SNAPSHOTS=16 ('host prefix snapshot budget exhausted'), so a deploy needs an explicit budget (48 held; ~39 MB/snapshot est.). With a 50% head, 8k chunks and budget 48, warm vs control is +2.8% makespan, TTFT max -12.8%, TG +13% (41 decode stalls from eager prefill). trace_mode=decode_only is the tax. Records: bench/runs/perf-loop-c24-sharedhead-20260926T1733Z.jsonl, perf-loop-c25-sharedhead-8k-20260926T1750Z.jsonl.

c24/c25 (master): prefix caching on ≤32k, B=8, 16k prompts. With an 87.5% shared head the cold cell is -13.3% makespan (intra-batch sharing), but the warm cell killed the engine on the default QWEN36_PREFIX_MAX_SNAPSHOTS=16 ('host prefix snapshot budget exhausted'), so **a deploy needs an explicit budget** (48 held; ~39 MB/snapshot est.). With a 50% head, 8k chunks and budget 48, warm vs control is +2.8% makespan, TTFT max -12.8%, TG +13% (41 decode stalls from eager prefill). trace_mode=decode_only is the tax. Records: bench/runs/perf-loop-c24-sharedhead-20260926T1733Z.jsonl, perf-loop-c25-sharedhead-8k-20260926T1750Z.jsonl.
Author
Member

Do not boot prod-g2-prefix, and do not quote −86% makespan as the deploy delta (that was versus caching off; versus the then-deployed arm it was about −2%). c25: snapshot budget 16 exhausts the engine; budget 48 with a 50% shared head was +2.8% makespan. Blocked on an owner deploy decision plus an explicit snapshot budget. No engineering until that budget is named.

Do not boot prod-g2-prefix, and do not quote −86% makespan as the deploy delta (that was versus caching off; versus the then-deployed arm it was about −2%). c25: snapshot budget 16 exhausts the engine; budget 48 with a 50% shared head was +2.8% makespan. Blocked on an owner deploy decision plus an explicit snapshot budget. No engineering until that budget is named.
Owner

GDN snapshot mechanism (Lottolabs 64k follow-up), not a new issue and not a boot

Their prefix cache snapshots GDN state at 2048-token chunk boundaries. A 64k follow-up then starts in 3.8 s instead of 71 s (128k: 5.3 s instead of 172 s), output identical to a full re-prefill. That is the same mechanism this issue already tracks (QWEN36_PREFIX_MAX_SNAPSHOTS, host torch _snapshot_gdn_scratch / _restore_gdn_scratch), not a second design.

Still blocked on an owner-named snapshot budget. c25: budget 16 exhausts the engine; budget 48 with a 50% shared head was +2.8% makespan. Do not boot prod-g2-prefix. Do not quote −86% makespan as the deploy delta.

Do not copy their L1-resident GDN state. They keep 75.5 MB in L1 so a second sequence does not fit. Production is max_num_seqs=8 on 2×p150a; L1-resident state is a reject.

Also not work on the back of their report: BFP4 drafter (acceptance collapsed), streaming fused FFN, more circular-buffer slots, and temp>0 host sampling as a speed path (their temp>0 falls back to ~9–11 tok/s). Their DFlash number (~3.3 tok / ~67 ms, ~50 tok/s greedy, B=1, one card) is not our B=4/B=8 wall.

No card until the owner names the snapshot budget. The 71 s → 3.8 s figure is evidence for that decision, not a license to boot.

## GDN snapshot mechanism (Lottolabs 64k follow-up), not a new issue and not a boot Their prefix cache snapshots GDN state at **2048-token chunk boundaries**. A 64k follow-up then starts in **3.8 s instead of 71 s** (128k: 5.3 s instead of 172 s), output identical to a full re-prefill. That is the same mechanism this issue already tracks (`QWEN36_PREFIX_MAX_SNAPSHOTS`, host torch `_snapshot_gdn_scratch` / `_restore_gdn_scratch`), not a second design. Still blocked on an owner-named snapshot budget. c25: budget 16 exhausts the engine; budget 48 with a 50% shared head was **+2.8% makespan**. Do not boot `prod-g2-prefix`. Do not quote −86% makespan as the deploy delta. Do not copy their L1-resident GDN state. They keep 75.5 MB in L1 so a second sequence does not fit. Production is `max_num_seqs=8` on 2×p150a; L1-resident state is a reject. Also not work on the back of their report: BFP4 drafter (acceptance collapsed), streaming fused FFN, more circular-buffer slots, and temp>0 host sampling as a speed path (their temp>0 falls back to ~9–11 tok/s). Their DFlash number (~3.3 tok / ~67 ms, ~50 tok/s greedy, **B=1, one card**) is not our B=4/B=8 wall. No card until the owner names the snapshot budget. The 71 s → 3.8 s figure is evidence for that decision, not a license to boot.
Member

Shipped: prefix caching deployed to production as S12P (LEDGER R-2026-10-26-s12-prefix) and verified live 2026-11-02; owner blockers answered by the deploy chain (auto snapshot budget, MambaSpec group handling via the GDN id pool). Verified 2026-11-18.

Shipped: prefix caching deployed to production as S12P (LEDGER R-2026-10-26-s12-prefix) and verified live 2026-11-02; owner blockers answered by the deploy chain (auto snapshot budget, MambaSpec group handling via the GDN id pool). Verified 2026-11-18.
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.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
bitpartner/tt-stack#94
No description provided.