pp/host self-test: block budget from the KV pool, not the page-table width (4k-only S5 boots refused) #287

Open
Grok wants to merge 1 commit from fix/pphost-probe-mml into master
Owner

Bug

On S5 (CONTROL), every boot with max_model_len below about 7.5k is refused by the pp/host self-test:

pp/host self-test REFUSED: 96 KV blocks cannot hold the [5096, 2348] probe

ttx ab / sweep32k default max_model_len to the largest context + 2048, so every 4k-only screen hits this. CI cells would too.

  • First seen on the a-kdyn screen boot of 2026-10-20 (ab20261020T223029Z).
  • Its server log is ttx-upfail-…-s5-cap-20261020T225856Z.server.log in the screen worktree.

Cause

warmup_model_decode passes num_blocks = the decode page-table width (max_model_len / 64 = 96). prefill_host_selftest treated that number as the pool size. The pool that was actually allocated holds 12293 blocks.

Fix

  • Take the free-block budget from self._paged_kv_caches[0][0].shape[0], still excluding the pad block.
  • The probe's own page table is max(need) wide, and both prompts fit within max_model_len, so the probe can draw its physical blocks from anywhere in the pool.
  • Also refuse if the probe exceeds max_seq_len.

Verification

  • py_compile only. This has not been verified on hardware.
  • To verify: boot a 4k-only S5 ttx ab (default max_model_len 6144) and expect QWEN36_PREFILL_* engaged plus the pp/host self-test exact line.
  • Until this merges, 4k-only screens work around it with --max-model-len 16384.

🤖 Generated with Claude Code

## Bug On S5 (CONTROL), every boot with max_model_len below about 7.5k is refused by the pp/host self-test: `pp/host self-test REFUSED: 96 KV blocks cannot hold the [5096, 2348] probe` `ttx ab` / sweep32k default max_model_len to the largest context + 2048, so every 4k-only screen hits this. CI cells would too. - First seen on the a-kdyn screen boot of 2026-10-20 (ab20261020T223029Z). - Its server log is `ttx-upfail-…-s5-cap-20261020T225856Z.server.log` in the screen worktree. ## Cause `warmup_model_decode` passes `num_blocks` = the decode page-table **width** (max_model_len / 64 = 96). `prefill_host_selftest` treated that number as the **pool** size. The pool that was actually allocated holds 12293 blocks. ## Fix - Take the free-block budget from `self._paged_kv_caches[0][0].shape[0]`, still excluding the pad block. - The probe's own page table is max(need) wide, and both prompts fit within max_model_len, so the probe can draw its physical blocks from anywhere in the pool. - Also refuse if the probe exceeds `max_seq_len`. ## Verification - `py_compile` only. **This has not been verified on hardware.** - To verify: boot a 4k-only S5 `ttx ab` (default max_model_len 6144) and expect `QWEN36_PREFILL_* engaged` plus the pp/host self-test exact line. - Until this merges, 4k-only screens work around it with `--max-model-len 16384`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
pp/host self-test: size the probe's block budget from the KV pool, not the page-table width
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 3m56s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 11m42s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 16m46s
tt-stack-ci / Serialized card gate (pull_request) Successful in 35m26s
cards-fresh cards: stale, verdict run 923 fp=d9c1edc24d4d853c != merged fp=9ff4e9d2abdad648; push or add cards:go
0ea1955966
warmup_model_decode passes num_blocks = the decode page-table width (max_model_len / block_size).
prefill_host_selftest read that as the pool size, so any boot with max_model_len below ~7.5k
(every 4k-only ttx ab / sweep, max_model_len 4096 + 2048 = 6144 -> 96) was REFUSED: '96 KV blocks
cannot hold the [5096, 2348] probe', while the allocated pool held 12293 blocks. Seen on the S5
a-kdyn screen boot of 2026-10-20 (ab20261020T223029Z). The probe's own page table is max(need)
wide and both prompts fit within max_model_len, so it can take its physical blocks from the
whole pool.

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

verdict: approve
tier: T1 (single-file fix in the prod-local-metal overlay, patches/prod-local-metal/models/demos/blackhole/qwen36/tt/model.py only; the "T?" in the dispatch resolves to T1 — one function in the patched model, additive guard, no nix/CI/config surface)

rationale: The root cause is exactly as stated: warmup_model_decode forwards the decode page-table width (max_model_len/64 → 96 on a 4k-only S5) as num_blocks, and the old check used that width as the KV pool budget, so every boot with max_model_len under ~7.5k was refused even though the actual pool is 12293 blocks. Sourcing the budget from self._paged_kv_caches[0][0].shape[0] is the real pool size (same expression the KV-cache assert at model.py:3417 uses for num_kv_blocks), the pad block is still excluded, and the probe's own page table is only max(need) wide — physical blocks from anywhere in the pool are valid. The new max_seq_len guard with the or max(lens) fallback is a sound fail-closed addition. No secrets, no red-flag patterns, blast radius is the in-boot self-test path only (levers off → no behavior change).

concerns:

  • [warn] patches/prod-local-metal/models/demos/blackhole/qwen36/tt/model.py:2331 — int(getattr(self.args, "max_seq_len", 0) or max(lens)) silently disables the guard when args.max_seq_len is unset (falls back to max(lens), so the comparison is always false). That's defensible (the served path enforces max_model_len anyway) but it makes the new guard a no-op in exactly the configurations where it might matter. Fine to merge; noting it deliberately rather than as a defect.
  • [warn] Not yet verified on a card (PR body says py_compile only). Head CI run 9714 is on the exact head SHA (build jobs running, "Serialized card gate" blocked behind them) — the 4k-only S5 boot proof is the device gate. human-approved label deliberately NOT applied until that run lands a result; a CI gate watcher is armed and will label + report via ntfy when it turns.

(handoff ho-fc01ffe97dfd; session running on agent-dense as requested)

**verdict:** approve **tier:** T1 (single-file fix in the prod-local-metal overlay, `patches/prod-local-metal/models/demos/blackhole/qwen36/tt/model.py` only; the "T?" in the dispatch resolves to T1 — one function in the patched model, additive guard, no nix/CI/config surface) **rationale:** The root cause is exactly as stated: `warmup_model_decode` forwards the decode page-table *width* (max_model_len/64 → 96 on a 4k-only S5) as `num_blocks`, and the old check used that width as the KV *pool* budget, so every boot with max_model_len under ~7.5k was refused even though the actual pool is 12293 blocks. Sourcing the budget from `self._paged_kv_caches[0][0].shape[0]` is the real pool size (same expression the KV-cache assert at model.py:3417 uses for `num_kv_blocks`), the pad block is still excluded, and the probe's own page table is only `max(need)` wide — physical blocks from anywhere in the pool are valid. The new `max_seq_len` guard with the `or max(lens)` fallback is a sound fail-closed addition. No secrets, no red-flag patterns, blast radius is the in-boot self-test path only (levers off → no behavior change). **concerns:** - [warn] `patches/prod-local-metal/models/demos/blackhole/qwen36/tt/model.py:2331` — `int(getattr(self.args, "max_seq_len", 0) or max(lens))` silently disables the guard when `args.max_seq_len` is unset (falls back to `max(lens)`, so the comparison is always false). That's defensible (the served path enforces max_model_len anyway) but it makes the new guard a no-op in exactly the configurations where it might matter. Fine to merge; noting it deliberately rather than as a defect. - [warn] Not yet verified on a card (PR body says py_compile only). Head CI run 9714 is on the exact head SHA (build jobs running, "Serialized card gate" blocked behind them) — the 4k-only S5 boot proof is the device gate. `human-approved` label deliberately NOT applied until that run lands a result; a CI gate watcher is armed and will label + report via ntfy when it turns. (handoff ho-fc01ffe97dfd; session running on `agent-dense` as requested)
Member

Card gate — prod vs prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5

  • PR #287 ref refs/pull/287/head
  • head 0ea1955966aede52e2311bf210ed4690afc18130 merged onto master (measured tree, fingerprint in the verdict comment)
  • host cfx-llm2, slot mesh (card0+card1)
  • serving check out /nix/store/s1m5imf4nm2l83rc2k6vnr42av2sciv3-vm-test-run-tenstorrent-serving
  • ttx ab exit 0 (3 = aborted: the job fails even if a control record exists); gates exit 1
  • sweep reps: 1. Cells kept: B=8, B=4 and B=1 at ctx 4096 and 32768, one visit per arm.

gsm8k / retrieval / equiv do not gate merge. A FAIL below is a report.

Gates

  • prod equiv: kind REFUSED verdict None (bench/runs/ttx-prod-equiv-20261020T235850Z.jsonl)
  • prod gsm8k: kind REFUSED verdict None (bench/runs/ttx-prod-gsm8k-20261020T235850Z.jsonl)
  • prod retrieval: kind REFUSED verdict None (bench/runs/ttx-prod-retrieval-20261020T235850Z.jsonl)

PP tok/s and TG tok/s per user (TG ms/token secondary)

arm B ctx PP tok/s TG tok/s/user TG ms/token vs control PP vs control TG tok/s
prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5 1 4096 7938.0 70.5 14.187
prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5 1 32768 7302.9 62.4 16.017
prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5 4 4096 7272.1 77.7 12.863
prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5 4 32768 7149.1 65.2 15.33
prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5 8 4096 6927.7 67.4 14.836
prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5 8 32768 7115.6 51.6 19.371

Records

  • bench/runs/ttx-ab-prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5-switch-20261020T234601Z.jsonl
  • bench/runs/ttx-prod-equiv-20261020T235850Z.jsonl
  • bench/runs/ttx-prod-gsm8k-20261020T235850Z.jsonl
  • bench/runs/ttx-prod-retrieval-20261020T235850Z.jsonl
  • bench/runs/ttx-sweep32k-prod-ab20261020T234601Z-r0.jsonl
  • bench/runs/ttx-sweep32k-prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5-ab20261020T234601Z-r0.jsonl

Full jsonl from this run: https://git.bitp.cz/bitpartner/tt-stack/actions/runs/9714 (artifact bench-runs when the upload step ran).

## Card gate — `prod` vs `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` - PR `#287` ref `refs/pull/287/head` - head `0ea1955966aede52e2311bf210ed4690afc18130` merged onto `master` (measured tree, fingerprint in the verdict comment) - host `cfx-llm2`, slot mesh (card0+card1) - serving check out `/nix/store/s1m5imf4nm2l83rc2k6vnr42av2sciv3-vm-test-run-tenstorrent-serving` - `ttx ab` exit 0 (3 = aborted: the job fails even if a control record exists); gates exit 1 - sweep reps: 1. Cells kept: B=8, B=4 and B=1 at ctx 4096 and 32768, one visit per arm. gsm8k / retrieval / equiv do **not** gate merge. A FAIL below is a report. ### Gates - `prod` `equiv`: kind `REFUSED` verdict `None` (`bench/runs/ttx-prod-equiv-20261020T235850Z.jsonl`) - `prod` `gsm8k`: kind `REFUSED` verdict `None` (`bench/runs/ttx-prod-gsm8k-20261020T235850Z.jsonl`) - `prod` `retrieval`: kind `REFUSED` verdict `None` (`bench/runs/ttx-prod-retrieval-20261020T235850Z.jsonl`) ### PP tok/s and TG tok/s per user (TG ms/token secondary) | arm | B | ctx | PP tok/s | TG tok/s/user | TG ms/token | vs control PP | vs control TG tok/s | | --- | --- | --- | --- | --- | --- | --- | --- | | `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` | 1 | 4096 | 7938.0 | 70.5 | 14.187 | | | | `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` | 1 | 32768 | 7302.9 | 62.4 | 16.017 | | | | `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` | 4 | 4096 | 7272.1 | 77.7 | 12.863 | | | | `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` | 4 | 32768 | 7149.1 | 65.2 | 15.33 | | | | `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` | 8 | 4096 | 6927.7 | 67.4 | 14.836 | | | | `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5` | 8 | 32768 | 7115.6 | 51.6 | 19.371 | | | ### Records - `bench/runs/ttx-ab-prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5-switch-20261020T234601Z.jsonl` - `bench/runs/ttx-prod-equiv-20261020T235850Z.jsonl` - `bench/runs/ttx-prod-gsm8k-20261020T235850Z.jsonl` - `bench/runs/ttx-prod-retrieval-20261020T235850Z.jsonl` - `bench/runs/ttx-sweep32k-prod-ab20261020T234601Z-r0.jsonl` - `bench/runs/ttx-sweep32k-prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5-ab20261020T234601Z-r0.jsonl` Full jsonl from this run: https://git.bitp.cz/bitpartner/tt-stack/actions/runs/9714 (artifact `bench-runs` when the upload step ran).
Member

Cards verdict: success

  • fingerprint d9c1edc24d4d853cc87817a0f26b27c351b6d0f7dec7e8c67a6bc0ed646d67cb (CONTROL prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5, arms prod, 547 card files fe4c360b86685264)
  • measured tree: head 0ea1955966aede52e2311bf210ed4690afc18130 merged onto base 51834bc8c486b61e84cb5d0d3777f75bedc4d11a
  • run https://git.bitp.cz/bitpartner/tt-stack/actions/runs/9714

A later event with the same fingerprint reuses this verdict instead of booting the cards.

## Cards verdict: success - fingerprint `d9c1edc24d4d853cc87817a0f26b27c351b6d0f7dec7e8c67a6bc0ed646d67cb` (CONTROL `prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5`, arms `prod`, 547 card files `fe4c360b86685264`) - measured tree: head `0ea1955966aede52e2311bf210ed4690afc18130` merged onto base `51834bc8c486b61e84cb5d0d3777f75bedc4d11a` - run https://git.bitp.cz/bitpartner/tt-stack/actions/runs/9714 A later event with the same fingerprint reuses this verdict instead of booting the cards. <!-- tt-cards-verdict {"arms": ["prod"], "base_sha": "51834bc8c486b61e84cb5d0d3777f75bedc4d11a", "control": "prod-g2-c86-colpar2-rz3-sl-pfw2-gf-ab-so-dn-d8k16-nhp-tail-k8v4-mtp-stack-warm-kb-cm-so1-kda2-lmlofi-csplit-t0-gdc-cpk-wy-kvd-sddec-cph32-kvfold-dx-w2t-mx-b8k3c48-gpgob-dfr-s5", "files_sha": "fe4c360b8668526447ebcc3d93894e6462e27a988312d8d6bc900f0add020013", "fp": "d9c1edc24d4d853cc87817a0f26b27c351b6d0f7dec7e8c67a6bc0ed646d67cb", "head": "0ea1955966aede52e2311bf210ed4690afc18130", "run_id": "9714", "run_number": "923", "run_url": "https://git.bitp.cz/bitpartner/tt-stack/actions/runs/9714", "tree": "2e169712b701de30a758af1f444043f8f1f83a58", "v": 1, "verdict": "success"} -->
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 3m56s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 11m42s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 16m46s
tt-stack-ci / Serialized card gate (pull_request) Successful in 35m26s
cards-fresh cards: stale, verdict run 923 fp=d9c1edc24d4d853c != merged fp=9ff4e9d2abdad648; push or add cards:go
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/pphost-probe-mml:fix/pphost-probe-mml
git switch fix/pphost-probe-mml
Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set

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