P/D stack to master: arena free-list + router/connector lineage running in prod #373
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitpartner/tt-stack!373
Loading…
Reference in a new issue
No description provided.
Delete branch "opus/pd-stack-to-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?
Lands the P/D lineage that runs on cfx-llm1 today (opus/pd → pd-cutover → pd-adaptive → pd-arena-freelist
b4907a4d) on master, so #368 (delta export) and later P/D PRs diff against what is deployed.What is new vs master
tools/pd-split/(router, connector, transport, broker, sims),bench/runs/records, docs (PD-SPLIT-DESIGN, PD-TRAFFIC-BENCH, RTX-DRAFTER, PD-BUILD-CONTRACT). No TT serving change:modules/tenstorrent-serving.nix+3 lines (unit comment), TT export side taken from master.b4907a4d: broker arena is now an address-ordered first-fit free list with coalescing (the FIFO ring pinned every later free behind one live region: 2026-11-08 09:58–10:09 UTC,arena full ... waited 120.5 s, two fallbacks at TTFT 144/165 s). Receiver: claim on poll,drop(unclaimed_only=), pressure eviction of the oldest complete unclaimed handoff ≥60 s. Router drops unclaimed exports at request end.Merge with master (
18ddbdb7)8 conflicts, all from #363 landing snapshots of this lineage:
pd_export.py,kv_host_tier.py,test_pd_export.py,s12phv-pd-export{,-mtp}arms + nix json): master kept (#363-reviewed hardening supersedes the branch copies).transport/ring.py,receiver.py: branch kept (free list supersedes master's5fe25a91snapshot).Test fix: two router drop tests ran on a per-request TestClient loop that was torn down with the response, cancelling the background drop (≈1/3 flaky, also on
b4907a4dalone). They now hold one loop (with c:).Verification
tools/pd-split/test_pd_export.py+tests/test_pd_export_hardening.py: 79 passedb4907a4dbroker/router running on cfx-llm1 since 2026-11-08 11:30 CET with no arena stall since.Independent review: pending (opus-reviewer), result posted here before merge.
🤖 Generated with Claude Code
Design 8.6 step 4. Before: the plan assumed the router could floor its RTX-held estimate to vLLM's 832-token hybrid block. Live check on the svc-final RTX service: a 4,401-token prompt re-sent with ~870 tokens appended hit 3,328 tokens (4 x 832, one 4096-budget chunk), not 4,160, so mamba-align hits land on chunk ends. An 832 floor would have made TT export from 4096 while the RTX held 3328, and the connector would have refused every such handoff. The router now floors to 3328 (its estimate then equalled the server's hit counter). - router.py: /v1/chat/completions, /v1/completions (SSE passed through byte for byte), /v1/models, /health, /router/stats; HF tokenizer + chat template (ids equal to the RTX /tokenize on 7 cases); per-session prefix tracker (LCP with what was last sent, LRU within the 341k KV pool); uncached >= 5120 -> TT export (stream C's pd_export API: prompt[:-1], max_tokens 1) -> broker poll -> RTX with kv_transfer_params {tt_handoff, n_tokens, prefix_tokens}; every failure falls back to a plain RTX request; one PD_ROUTER JSON log line per request. The TT path is off by default and UNVERIFIED end to end. - replay.py: agent-sessions / agentic-pi / JSONL traces through the same policy and tracker under the 8.4 cost model with FIFO TT, link and RTX-prefill queues (ESTIMATE record). - 22 unit tests with mock backends, plus BrokerProbe against stream B's real broker/receiver/sender on loopback. - PD-BUILD-CONTRACT: the router's calls, and proposals to A (prompt-tokens details), B (TCP status) and C (export outcome in the response). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>An invalid RTXOPT_ATTN_SPLITKV raised inside sitecustomize. site.py swallows that ('Error in sitecustomize'), so the worker booted with no rtxopt patch at all (no overlay, no draft vocab) instead of refusing. The hook is now always registered when the flag is set and attn_splitkv.parse_mode raises in the worker's FlashInfer import. The kernel's tl.dot takes bf16 Q and the loads assume unit-stride rows; the builder now refuses a non-bf16 decode q dtype and forward refuses non-bf16 or strided Q/O instead of failing in a Triton compile during graph capture or reading the wrong elements. Host-side checks rerun (ref, interpreter, AOT, flag-off registry); no GPU number. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>Expected: a8 would add a few % at B8 on the D+E1 combo, and kvf-a/1 (lower val loss) would lift AL. Evidence: a8 on the combo emits garbage ('terasteras...', first GSM8K wave all hit 8192 tokens), so it has no speed number. kvf-a/1 on the combo: AL flat (2.99 vs 3.00), TG B8 4k -2.2%, B4 32k -5.9%, B1 32k -5.8% (2-vs-2 ABBA); the bf16-native head shows the same loss (-3.8/-2.5/-5.8%), so the cost is the bf16 mtp.* overlay (+0.7-1 ms/step) and the training adds no acceptance on this corpus. Gates for kvf-a/1 pass (GSM8K T=1 58/60, retrieval 1.0). Combo vs ctl over 6 vs 5 boots: B8 4k 94.8 vs 81.8, B8 32k 70.9 vs 61.6. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>Needs pd-split/rtxopt/thinkingcap-freq-rank-agentic.{npy,json} (opus/pd-draft-tune, sha256 fdbdda55...). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>- arrival: adaptive.choose("arrival") on every tokenized request before the C5 decision runs; "tt-direct" serves the client's request end to end on TT, else the C5 path unchanged - prefill-done: after a complete export, adaptive.choose("prefill-done"); "tt-resubmit" sends the whole request to TT and drops the export in the broker (new BrokerProbe.drop, the broker's existing "drop" op) - live signals: RTX /metrics running/waiting/KV (parse_vllm_load), TT /metrics (logged cross-check), router counters (rtx in-flight with streamed tokens, tt decoding, tt prefill busy excl. self), UtilMeter, OutEstimator - failure safety: any TT failure before the first client byte falls back to the RTX (with the export for resubmit) - sticky sessions (margin_stay), TT-decoded turns not recorded in the RTX tracker - PD_ROUTER records carry adaptive {stage, route, reason, pred, live, ...}; /router/stats adaptive block - flags --adaptive --tt-decode-cap --adaptive-margin-in/-stay --adaptive-out-default --adaptive-rtx-max-seqs (off; with it off the bodies, logs, stats and banner are unchanged); commented variant in router.env.template - test_adaptive_router.py: 18 tests on mock backends; whole router suite 98 passed, 1 skipped Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>b4907a4d) for landing on masterIndependent review (opus-reviewer) on
18ddbdb7: FIX, 3 findings, all fixed in413a2b59:Merge resolution and the test_router with-c fix: checked fine by the reviewer.
Tests: 4 new (each must-fail on the old code); transport+export 83 passed, router 144 passed/1 skipped, connector test_cpu 9 passed on cfx-llm1.
Prod still runs
b4907a4d; the fixes need a broker + connector restart in an RTX window.verdict: request_changes
tier: T2
(model:
ollama/agent-dense— this session is already running it)rationale: Lineage landing that mirrors what runs on cfx-llm1 in prod; the production surface is clean and net-inert, but the head build is RED, which blocks merge.
concerns:
.forgejo/workflows/ci.ymlbuild job (run 11721, head18ddbdb7) failed inscripts/check-cited-records.py— dangling evidence citations indocs/PD-SPLIT-DESIGN.md:1469(pd40g-hold-20261104T2357Z) and:1651(bench/runs/pd40g/pd40g-iter-t4-.../handoff-audit.json) reference records that are archived/branch-only without a[branch]marker. The nixfmt + build steps passed before this lint tripped, so this is docs-bookkeeping, not a code defect — but the red head build makes the PR not-mergeable as-is, and the card gate is blocked behind it.bench/runs/*2,758,tools/pd-split733,tools/rtx-drafter98, docs). Production surface is small and I verified it:modules/tenstorrent-serving.nixis byte-identical base↔head (net-zero),.forgejo/workflows/ci.ymlis byte-identical (688=688), root delta is README-only. So nothing changes about how TT serves on merge.swa_sitecustomize.pyis inert unlessPD_MTP_SWAis set (only wraps MTP attention backend);pd_recv.py --no-verifyis a data-checksum flag, not a git bypass.rtx-drafter/prompts.py SECRET=...is a leak detector regex, not a leak. Secret/exec/shell-True red-flag sweep: clean (no leaked tokens, no shell-True injection, no--no-verifygit bypass, nomagicRollback=false).Action for the drafter: fix the two dangling citations (mark branch-only records
[branch]or restore/move the records) and push; the levers themselves are approvable once the head build goes green and the card gate produces its A/B number. I have not appliedhuman-approvedand have left the PR in its current (non-draft) state.Cards skipped
Cards unavailable on
cfx-llm0for PR #37304dc8e8658f53663b5d90a33755d7c520673affd.systemctl is-active tenstorrent-serving.service=active(needinactive)18640648kB (need >= 4000000)No slot taken, no boot. This skip is green.
Re-review of
413a2b59: APPROVE (opus-reviewer). Nit fixed in1126bd17(reaped complete handoffs reported gone). CI #11727 on04dc8e86: build + host module success, card gate success; 'Report upstream drift' fails on github.com credentials (infra, unrelated; also fails on other PRs). Deployed to cfx-llm1 00:32 CET (with the delta connector,678a8f9e): smoke agentic B4 5/5, handoff_wait 0.05-0.15 s, 0 arena full / evictions. Merging.agent-gateway closeout (merged): cleared
agent:*labels.Hermes kanban card (if any) is left for Hermes to archive/complete.