P/D export arm servable by tenstorrent-serving (s12phv-pd-export-mtp) #363
No reviewers
Labels
No labels
cards:go
hermes-approved
human-approved
human-approved
iter
0
iter
1
iter
2
iter
3
prio:high
prio:low
prio:med
priority/high
state
blocked
state
doing
state
done
state
review
state
todo
x280
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitpartner/tt-stack!363
Loading…
Reference in a new issue
No description provided.
Delete branch "opus/pd-export-arm-master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds the smallest set of files that lets nixos-llm set
services.tenstorrentServing.arm = "s12phv-pd-export-mtp"for the P/D cutover (#334). Every file is byte-identical toopus/pd-adaptive; that branch's other 167 commits (bench records, the router and other tools) stay out.Files
bench/arms/s12phv-pd-export.toml: the production arms12-prefix-host-vsplit-sfplusQWEN36_PD_EXPORT=1.bench/arms/s12phv-pd-export-tc.toml: pins the model tothinkingcap-g2-bfp4-packed, which is the model production already serves.bench/arms/s12phv-pd-export-mtp.toml: addsQWEN36_PD_EXPORT_MTP=1(wire v1.1 MTP_KV frames),QWEN36_MTP_WARM_TAIL_SPAN=16andQWEN36_PREFIX_CKPT_DEFER=0. The defer pool does not fit in device DRAM next to the span-16 warm tail.patches/prod-local-plugin/src/vllm_tt_plugin/pd_export.py(new): the exporter, with a boot self-test that must match exactly and a must-fail variant.patches/prod-local-plugin/src/vllm_tt_plugin/model_runner.pyandkv_host_tier.py: the export hooks. They do nothing unlessQWEN36_PD_EXPORT=1.patches/prod-local-metal/models/demos/blackhole/qwen36/tt/mtp_batch.py: thePD_EXPORT_MTPhook (does nothing when off) and the MTP warm-anchor fix (4b45f2dd). That fix stopsbegin()from clearing the previous user'sfinish()anchors. The fix is on the production path too.nix/serve-arms/s12phv-pd-export-mtp.json(new) and the three existing specs, regenerated. Each now mountspd_export.py, becausemodel_runner.pyimports it on every boot.ttx nix-spec --checkpasses for all four.modules/tenstorrent-serving.nix: the samepd_export.pymount on the path without an arm (3 lines).Image
No new image is needed. The export arm runs on
vllm-tt:k2-mr-pk3rwith the same model, keyed tensor cache, store overlays and container argv as production. The only argv differences are environment variables:QWEN36_PD_EXPORT=1andQWEN36_PD_EXPORT_MTP=1are added;QWEN36_MTP_WARM_TAIL_SPANgoes from 4 to 16;QWEN36_PREFIX_CKPT_DEFERgoes from 1 to 0.Effect on production before the cutover
Bumping the nixos-llm lock to this PR also changes the production arm's argv: it gains the
pd_export.pymount and the new hook code, which does nothing while the flags are off. Production also picks up the warm-anchor fix, which does change behaviour. Gate window cutg2 below covers this.Gates
Existing: pd-r3 G9 window 3 (2026-11-03,
bench/runs/pd-r3-20261101/g9-results.jsonl), run end to end through P/D:That run used the arm before 11-05, when it did not yet inherit the L1–L4 cold-prefix levers and still had
CKPT_DEFERon. No gate record exists yet for the current chain withPREFIX_CKPT_DEFER=0.Running now (ttx gates equiv, gsm8k, retrieval and agent-sessions, on code identical to this PR):
s12phv-pd-export-mtp, served directly from TT. This is the path for tt-direct and tt-serve requests and for the tt-only rollback.s12-prefix-host-vsplit-sfwith this PR's code, for the effect on production.The records will be added to this PR. Do not land it before both pass.
Service evidence on hardware: live windows adw2 and adw4–adw6 on 2026-11-07 used this arm. The router logs record no export failures and no TT hangs in those windows.
Not in this PR
/mnt/bulk/pdrtx, not from nix. The unit files are real files in~/.config/systemd/userand depend onpd-bulk-wait.service, so a nixos-llm deploy does not touch them. Only/etc/pd40g.envand the 18731 firewall rule (#930) are managed by Nix.opus/pd-adaptive. Unit tests forpd_export.pyare intools/pd-split/test_pd_export.pyon that branch.🤖 Generated with Claude Code
Review fixes are in
e1033e75. All six findings are addressed. Host tests: test_pd_export_hardening 8/8 (new), test_kv_host_tier 19 OK with 3 skipped (were 3 errors), test_mtp_warm + test_mtp_batch_host 72 OK._startnow validates every request parameter (target,prefix_tokens,next_token,req_id): it must be an int or decimal string where an integer is expected, never a bool or float, and within bounds. A malformed request is refused and logged (not exported: ...) and is served normally without an export.after_prefillis now a wrapper that never raises. If something unexpected fails, every session in that step gets an ERROR, every pin taken in the step is released, andhook_errorsis counted.mtp_hookvalidatesnext_tokenthe same way.QWEN36_PD_EXPORT_SEND_S(default 30 s). A timeout fails the session without a resume attempt, because a stuck receiver is not a dropped connection, and releases everything still queued.QWEN36_PD_EXPORT_MAX_SESSIONS(default 16) caps live sessions; requests beyond it are refused.QWEN36_PD_EXPORT_MAX_QUEUED_MB(default 8192) caps the bytes queued for the wire across all sessions; a data item over the cap fails its session and is released at once without being queued. The FIFO wait is therefore bounded by the send timeout. Each session's end log line now reportspins_nowandqueued_mb.QWEN36_PD_EXPORT_TARGETor an entry ofQWEN36_PD_EXPORT_TARGET_ALLOW. The arm setsQWEN36_PD_EXPORT_TARGET_ALLOW=10.10.0.2:18731(the cfx-llm1 broker on 40 GbE); everything else is refused. The serve spec is regenerated andnix-spec --checkpasses for all four specs.TierBackend._export_state_init()is shared by the backend's init and the test fake._MTPWarm.finish()now clears_anchorwhen a warm is skipped or fails, at the same point where the success path replaces it. That point comes after the request's blocking logits readback, so every anchored write has drained. A deferred finish runs before the next user's first gather (ph_flush_deferred), so it cannot drop that user's anchors.On cards:
cutg1r:
s12phv-pd-export-mtpate1033e75. Gates equiv and retrieval, plus adversarial checks against :8001:prefix_tokensthat is not an int, a target outside the allowlist, a badnext_token,pd_exportthat is not a dict;Pass criteria: the engine stays up, the stuck session fails with
timed out, andpins_now=0.cutg2r: prod
s12-prefix-host-vsplit-sfwith this code, gates equiv, gsm8k, retrieval and agent-sessions. It needs a rerun becausemtp_batch.pychanged. Its 11-03 cold-pp gate record is stale by design (ttx lintblocks the boot), so the new records will replace it in the arm's[gate]list.I'll post the results here.
🤖 Generated with Claude Code
Gates are done, all pass, in
00b884fc. Each arm was gated on its own boot (ttx run <arm> --suite ...), and the records are stamped for gate parity bybench/probes/pd_export/gate_stamp.py. The stamp checks that each card record names the arm and served exactly this tree'spd_export.py,model_runner.py,kv_host_tier.pyandmtp_batch.py.ttx lint s12-prefix-host-vsplit-sffails on origin/master today.ttx lintpasses fors12-prefix-host-vsplit-sfands12phv-pd-export{,-tc,-mtp}.nix-spec --checkpasses for all four specs.s12-prefix-host-vsplitands12-prefixfail lint on master in exactly the same way, and this PR doesn't change them.--attachruns):bench/runs/pd363-adversarial-20261107.txt. All 5 bad requests were refused while the engine kept serving. The stuck receiver (broker SIGSTOPped mid-export) hit the 30 s send timeout withpins_now=0. A good export afterwards sent normally;e1033e75. The only changes were to the[gate]lists and records.Ready to land on your side.
🤖 Generated with Claude Code
Cards skipped
Cards unavailable on
cfx-llm0for PR #36300b884fc388e0ca4b40ea6016cc2cba1f3b660f7.systemctl is-active tenstorrent-serving.service=active(needinactive)86213876kB (need >= 4000000)No slot taken, no boot. This skip is green.
Landing note: cards-fresh is red because CI's card job requires tenstorrent-serving to be inactive on cfx-llm0, so it measured nothing ('not measured (serving active)'). That is the same state as the production PRs #344 and #345. The card evidence comes from tonight's own-boot windows, stamped into the arm gate lists in
00b884fc:The Opus re-review verdict is LAND-WITH-NITS. Nits 2 and 3 (pin removal by identity, MAX_QUEUED_MB 4096) and the LAN allowlist entry go in a follow-up PR; tonight's LAN guard is in pd40g.sh
5aede92d.agent-gateway closeout (merged): cleared
agent:*labels.Hermes kanban card (if any) is left for Hermes to archive/complete.