Case file — PR #727: helios: gate PCIe peer-access graphs and fix teardown, AsyncTransfer, and startup drain races
Link: https://github.com/NVIDIA/hyperflare-inference/pull/727 · Fixes #722 · Head 224fb40, base main (branched at cc0a49d) · open, ready for review, opened and last updated 2026-12-04 · 16 files, +1973/−221 · no labels, no reviews, CI pending.
Key findings
- It is a same-day self-follow-up, and part of it fixes code merged hours earlier. #727 rewrites four things introduced by #721 (merged 2026-12-04, same author, 11 files in common): the SQE flush path, the DMA fault sentinel, the
async_transferpeer-copy guard, and #721's own two-phase teardown. The Prometheus wrong-rank-label defect that #727 "fixes" was introduced by #721 — #721'smetrics.rsalready used.enumerate()for theranklabel (pr/721server/metrics.rs:1557); #727 changes it tolet rank = s.rank(helios/src/server/metrics.rs:1567). Likewise thepeer_copy_graphspredicate that #722 attacks came from #628 (merged), which #727 narrows and re-uses rather than replaces. - The live "measured" evidence is not the #722 reproduction. #722 hung at 32,768-token inputs with concurrency 4,
--prefix-cache-memory 256G,--scheduler-policy balanced, on a 177-graph/rank core where 145 graphs were ungated. The PR's live run used ~13k-token requests, 20 concurrent,--prefix-cache-memory 4G, and a different exported core with 135 graphs/rank. The deadlock class is plausibly the same; the workload is not (#2, #7). - The watchdog's remedy is a bounded
std::process::abort(), not recovery —RankWedgeWatchdogfires afterTIMEOUT + 30 s(≈150 s) and callsstd::process::abort()(helios/src/execution/threaded.rs:23-25,:547-753, abort at:1027). The description says it "bounds wedged-rank hangs", which is accurate but does not say the process dies. This is a mitigation above #722's root cause, which is worth reading against the charter's "Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error". - Detection correctness for the #722 case rests on the reporter's graph inventory plus one live run, not on a test. The
copy_gate_policy_*tests exercise only a pure function of synthetic booleans (helios/src/runtime_core/model.rs:1653+); the author states no core combiningExecution.async_transferswithoutNode::Copy(Memory::Peer)existed locally, and that the local TP2 core was rejected at load as intended. - Behaviour changes operators can see: more graphs take the
CopyEngineGateon single-host PCIe multi-rank hosts without all-pairs NVLink (NVLink exemptions via NVMLP2P_CAPS_INDEX_NVLINK,model.rs:132-174);flare_async_transfer_*ranklabel semantics change (flat local index → true global rank id); a failed rank drain now deliberately leaks CUDA/host resources until process exit instead of freeing them; peerFinishStartupfailures now drain + error instead of unconditionally aborting. - Reported by an outsider, on a release, fixed by the person who wrote the broken code. #722 is from
egtoken-ai(Discord maxKonger) on flare 0.5.3, labelled bug / priority:P1; the reporter has not commented on #727, so the "fixes #722" claim is unacknowledged by the reporter. The author (lukealonso) is a charter-named priority contributor and, per the orientation packet, the only recent contributor in these files.
The change — what it does, in plain terms
Four logically independent defect clusters in one PR, on largely disjoint file sets:
1. PCIe peer-access gate (runtime_core + payload + docs). NativeResources used to flag graphs only for explicit Node::Copy with a Memory::Peer endpoint. It now records two vectors: peer_copy_graphs (strictly peer copies) and peer_access_graphs (peer copies, peer memsets, kernel argument/attribute relocations or inline fixed addresses into peer or peer-pointer-table allocations, peer-referencing module globals) — fields at helios/src/runtime_core/mod.rs:115-134, classification in node_peer_usage() (mod.rs:278, push at :1479), with the Node::Copy-only accessor kept for AsyncTransfer (:1597-1614). A pure policy decides gating: copy_gate_policy(local_ranks, all_nvlink, has_peer_copy_nodes, has_peer_access_graphs); enable_gate = has_peer_copy_nodes || (gate_peer_access && has_peer_access_graphs), gate_peer_access = local_ranks > 1 && !all_nvlink (model.rs:166-174), with all_nvlink_p2p from a pairwise NVML query (model.rs:132-165). Because the strict predicate is still what validate_async_transfer_peer_copy_compatibility uses (model.rs:181-204, called at model.rs:118-120, unit test model.rs:1613-1641), NVLink SM-P2P / kernel-P2P async_transfers cores are not falsely rejected by the widened gate. payload::load gained a scan that aligns per-rank chunk boundaries to 8 bytes (((CHUNK / ranks) & !7).max(8)) and flags allocations whose 8-byte-aligned stored words land inside a Memory::Peer interval (i.e. indirect peer-pointer tables such as rank_data) — payload.rs load() plus contains_interval_address/merge_sorted_intervals/peer_address_intervals/collect_peer_referencing_allocations helpers in mod.rs. Note this scan reads every 8-byte word of every allocation that has any peer interval, which is a load-time cost the description does not quantify.
2. Three-phase cross-rank teardown barrier (runtime_core/model + mod). stop_rank_workers evaluates both worker stops without || short-circuiting (mod.rs:2035-2042, test :2541-2567). teardown_model_ranks (model.rs:1275-~1310) runs phase 1 = drain workers + cuCtxSynchronize on every rank (drain_execution_context, mod.rs:2051-2079), phase 2 = join engram.clear() and offload.reset() while MappedHost mailboxes and contexts are live, then destroy_execution_resources per rank (mod.rs:2084-2140), phase 3 = destroy green contexts/VA reservations/primary contexts in reverse rank order. If any drain fails, all later phases abort and NativeModel::drop retains offload/engram/ranks (deliberate leak until process exit) — tests model.rs:1670, :1709. This replaces the two-phase structure #721 had introduced (release_execution_resources, pr/721 mod.rs:1530-1600).
3. AsyncTransfer SQE flush, hardware-signaled faulted DMA, true rank labels (+ TLA+). IoUringBackend::flush() now retries EINTR, drains partial submissions via flush_queued_sqes, and exposes pending_submissions() (io_backend.rs:146-161, :181-188); the worker flushes when submitted_io || pending_submissions() > 0. InflightIo tracks flushed; InflightDma/PendingEventDma/UntrackedFaultedDma track hardware_signaled (scheduler.rs:123, :708-742) so a fault after cuStreamWriteValue64_v2 was queued never overwrites a completion slot with COMPLETION_ERROR_BIT | error_code. ChannelConfig/AsyncTransferSnapshot carry true global rank ids rendered in server/metrics.rs:1566-1567. verification/helios-lifecycle/AsyncTransfer.tla grows to a 16-integer projection with FlushIo/UnflushedIoBounded and hwSignaledFaulted/HwSignaledFaultedSafe (+52/−8), plus cfg/README/check.py (not opened).
4. Startup drain handshake + rank-wedge watchdog (execution/threaded). Reply::Started now carries Result<()> (threaded.rs:1355-1356, :1431, :1435); a peer whose finish_startup fails stays in run_startup_phase to answer Command::Drain -> Reply::Drained (:1409-1445), so cleanup_failed_startup no longer reaches std::process::abort() (:1374-1405). best_effort_drain_peers uses one shared deadline (:1292-1308). RankWedgeWatchdog (:547-753, spawned :1015-1029) watches busy/closing/peer-exit stalls with zero activity-counter change using Condvar::wait_while, and aborts the process on a wedge.
Said but not done / done but not said. Everything the description lists is present in the 16 changed files (verified against pr_files and the head). Not mentioned: (a) the watchdog terminates via std::process::abort(); (b) the rank Prometheus label semantics change for existing scrapers; (c) the load-time scan cost noted above; (d) two CI workflow edits (helios-lifecycle.yml (not opened) cargo test --lib --no-run; native-serving.yml (not opened) native RoCE transport test) appear in the raw diff but are not in pr_files — most likely base drift from another PR rather than #727's own change, so attribution is unverified. Tooling caveat: the local main ref is stale (no helios/src/async_transfer, no PoolMemoryLimit/host_vmm), so the raw per-file diff includes drift from #669/#711/#721/#709; worker.rs even shows as a "new file". Only pr_files and comparison against pr/721 are trustworthy for scoping.
The why
Sole motivating report: issue #722, "helios: TP4 serving hangs under --prefix-cache-memory on SM120 PCIe; CopyEngineGate leaves 145/177 DeepSeek-V4.1-Flash graphs ungated", opened 2026-12-04 by egtoken-ai (Discord maxKonger), labels bug / performance / priority:P1 / triage:investigate, still open.
- Environment: 4× RTX 6000D (SM120/GB202, 85,651 MiB), PCIe Gen5, driver 580.178.04, flare 0.5.3 (9cd0cfad), 2× Xeon Gold 6530, 1 TiB RAM, Ubuntu 24.04.5, Broadcom PEX890xx switch, ACS disabled.
- Failure:
--prefix-cache-memory 256G, TP4, 32768-in/1024-out, concurrency 4 → >9-minute deadlock; GPUs 0-2 at 100 %, GPU 3 at 0 %;flare-modelinfutex_do_wait; ranks 1 and 2 already exited (consistent withrank_loop's 120 s TIMEOUT +executor.abandon()); no HTTP request fails or times out. - Reporter's code finding:
has_peer_copiesset only forNode::CopywithMemory::Peer(thenmod.rs:1158-1167); of 177 graphs on rank 0 (24Memory::Peerallocations), 32 gated, 145 ungated (allpacked-speculative*decode graphs andprefill256— 0 peer copy nodes, 5–38 localNode::Copynodes, plus b12xPCIeOneshotAllReducePool/PCIeTwoShotBF16kernel-based PCIe P2P). Second finding: no timeout recovery once CUDA blocks the model thread, since bothCopyEngineGateandThreadedExecutordeadlines live on the blocked thread. - Control:
--prefix-cache-memory 0completed the full 21-case/105-round matrix with 0 failures. Reporter candidly lists untested variables: the control used--scheduler-policy throughputwhile the hung run usedbalanced; 256G+throughput was not re-tested; no patched all-graphs-gated binary was tried. - Latency: latent since #628 introduced
CopyEngineGatekeyed on peer copies; the reporter notes the gate is "unchanged on main through 17961ccd". It is user-visible in a released binary (0.5.3), i.e. operators are exposed until a release carries this. - Breadth: one report, one topology. But the affected class — single-host PCIe multi-rank serving with
--prefix-cache-memory— is the documented target of the prefix-cache offload doc and the SM120 workstation class in the charter vision. Clusters 2–4 of this PR have no external report at all; they are self-found.
Related work
- #721 (merged 2026-12-04, same author) — most relevant. 11 files in common; #727 refines its flush path (no
pending_submissions()before), addshardware_signaled(itsmark_dma_faulted(op_id)had none), moves theasync_transfers+peer-copy rejection fromprepare_async_transfers(mod.rs:1495-1499on pr/721) up to load time, fixes the.enumerate()rank label #721 introduced, and replaces #721's teardown functions. Stacked/superseding in the teardown and metrics surfaces specifically. - #711 (merged) — introduced the domain-agnostic AsyncTransfer primitive and runtime-sized device pools that cluster 3 builds on.
- #628 (merged) — the original
CopyEngineGatethat #722 measures as covering 32/177 graphs; #727 narrows its predicate and widens what it gates. - #709 (merged), #669 (merged), #613, #640 (open), #507, #430, #674, #714, #720 — same-file overlaps only (
release_execution_resources,prepare_async_transfers, host VMM). #669 is the source of thehost_vmmpredicate appearing as drift in #727'smod.rsdiff. None competes with or is undone by #727. - #726 (open, same author) and #723 (open, same author) — siblings in the same-day series; #726 touches
release_execution_resources/prepare_async_transfers, so if both merge they should be serialised. No direct conflict found. - No competing or superseding PR for #722 exists; #727 is the only item that says "fixes #722". All orientation-packet leads were followed; none is a rival fix.
Recent activity
The repository's own history tooling is broken for these refs — search_history returns git: error: Could not read c513e46a79f3b6ac510235aaf09bcf055b841958 / cannot simplify commit ef38cb… for every path/ref tried, including pr/727; the orientation packet's per-area commit lists are likewise "not available" and it reports "People in these areas: no commits in these areas in the last 180 days". Commit-level history therefore could not be read; the reconstruction below comes from comparing pr/727 with pr/721, pr/723, and the packet's related-items list.
Established: helios/src/async_transfer/* saw three passes in ~24 h — #711 created the runtime, #721 hardened startup/DMA/teardown, #727 fixes the flush/sentinel/metrics gaps. runtime_core/model.rs + mod.rs: #628 introduced the gate wiring, #721 rewrote teardown into two phases, #727 rewrites into three and splits the gate predicate — so #727 partially reverses #721's structure while narrowing #628's predicate. verification/helios-lifecycle is being kept in lockstep with the Rust by the same author. No default-branch commits since branching are said to touch these files (could not be re-verified; local main is stale).
People
- Author
lukealonso(GitHub association COLLABORATOR; Discordlukealonsogiven in the PR). Named in the charter's priority-contributor list ("we never close their PRs out of hand as 'low value'"). 51 merged PRs in 180 days, 0 closed, 1 other open besides this (#723). Areas: helios/src (36), docs (31), ignition/preparation (20), tests/preparation (15), flare-cli/src (14). In this 24 h window alone: #707, #708, #709, #711, #716, #720, #721 merged; #723, #726, #727 opened. De-facto sole owner of the AsyncTransfer / teardown / CopyEngineGate area right now — and the author of both #628 and #721, i.e. of the code being fixed, which makes review independence the live question (stated as a fact, not a judgement). - Reporter
egtoken-ai(Discord maxKonger) — external operator, supplied a detailed P1 repro with graph inventory and a control run; has not engaged with #727. - No reviewers assigned; nobody else has commented. No other recent contributor in these files.
Community
Nothing. Zero comments, zero reviews, zero reactions, zero labels; CI pending on 224fb40; no linked discussion thread. #722's own discussion is empty; its Discord handle is the only outside voice on the problem. The "fixes #722" claim is unacknowledged by the reporter.
Project fit (charter and docs)
- Addresses a reproducible bug with a
priority:P1label — squarely inside the charter's "What gets merged" (charter line 35). - Keeps the runtime general: no per-model branches, and it deliberately does not gate NVLink SM P2P (charter line 12, "Keep the runtime small and model-agnostic"; the gate is topology-derived,
model.rs:132-174). - Serves the charter's supported-matrix commitment (line 21: serve captured CUDA graphs on SM103/SM120/SM121) — the fix targets the SM120 PCIe workstation class.
- Tensions to note: charter line 42 asks for interaction checks "across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs"; the PR concedes SM103/SM121 hardware and multi-host RoCE were not run. And the root-cause rule ("Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error") sits awkwardly with the watchdog, whose terminal action is a process abort rather than recovery.
- Documentation is updated in step with the code:
docs/prefix-cache-offload.md:992-1010now states both trigger sets for the gate (replacing the older "single-GPU and non-peer-copy models stay ungated" framing around:140-142), anddocs/runtime-core-design.md:686-711documents the three-phase teardown and the load-timeasync_transfersrejection. - PR description follows the project's four-part why/what/result/evidence shape.
Claims and evidence
| Claim | Backing | Gap |
|---|---|---|
Prevents single-host PCIe TP≥2 CopyEngineGate deadlocks for kernel-P2P graphs |
Code (copy_gate_policy, peer_access_graphs, payload scan) + copy_gate_policy_* tests (model.rs:1653+) |
Tests cover only the pure policy function with synthetic booleans; no test that a kernel-P2P graph is detected in a real core. Author states no suitable core was available. |
"Measured live SM120 PCIe TP4 result": 20 concurrent ~13k-token requests in 0.59–3.86 s, 1.09 GiB offloaded (37 records, 0 failures), clean SIGTERM status=0 in 3 s |
Described run, --prefix-cache-memory 4G --memory-limit 81G, 4× SM120, 135 graphs/rank |
Not the #722 reproduction (32k tokens/c4/256G/177 graphs/balanced policy). No patched-vs-unpatched comparison, and the author explicitly makes no throughput claim. |
| Formal + Rust suite green | check.py --mutations exit 0: 10 TLA+ models, 9 Rust↔TLA+ conformance suites (431 AsyncTransfer, 7,940 DispatchRing transitions), TLA+ and Rust mutations incl. UnflushedIoBounded / HwSignaledFaultedSafe; release tests per crate; helios --lib 1,920 passed with -D warnings 0 warnings; Python tests/cli 206 passed; one live live_cuda_async_transfer_end_to_end on SM120 |
The cited command embeds a machine-specific jar path (/home/luke/.cache/flare-formal/tla2tools-1.7.4.jar), so it is not reproducible as written. |
| New unit tests exist as named | Verified at head: mod.rs:2287/2541, model.rs:1653/1670/1709, io_backend.rs:413, scheduler.rs:1101 |
— |
best_effort_drain_peers uses one shared deadline |
Verified, threaded.rs:1292-1308 |
— |
| Unrun, declared | 6 helios --lib frontend template tests fail on HTTP 403 from gated HF repo meta-models/Muse-Spark-Open-816B-A42B-NVFP4; SM103/SM121 hardware; multi-host RoCE; Kani |
The cited "1,920 passed" run contains those 6 failures — a reviewer re-running it will see them without template setup. |
| Undeclared | Two CI workflow edits in the raw diff (helios-lifecycle.yml (not opened) --lib --no-run; native-serving.yml (not opened) native RoCE test) |
Not in pr_files; likely base drift, attribution unverified. |
Reach
- Who is affected: single-host PCIe multi-rank (TP≥2) serving on SM120/GB121-class cards with
--prefix-cache-memory > 0— including operators on release 0.5.3 today. NVLink hosts (all-pairs via NVMLP2P_CAPS_INDEX_NVLINK) and single-GPU deployments keep the old behaviour. - Observable changes: more graphs gated on PCIe hosts → offload work interleaves more coarsely around peer-access graphs; a rank that fails to drain or a coordinator stuck in a driver call now aborts the process after ~150 s instead of hanging (a supervisor such as Orbit must restart); peer
FinishStartupfailures become a clean drain + error;flare_async_transfer_*ranklabels change meaning from flat local index to global rank id — dashboards/alerts keyed onrankneed re-checking, anddocs/api.md:388-412(not opened) documents the series without calling out the semantics change. - Memory/deployment: on a failed drain, CUDA and host resources are retained until process exit (deliberate leak, documented in the teardown comment) instead of being freed and crashing.
- Compatibility: no core-format change;
NativeResourcesgains internal fields. Cores combiningExecution.async_transferswithNode::Copy(Memory::Peer)are now rejected at load rather than at prepare (same rejected set, earlier error). No new CLI flags or config keys in this PR. No new crates; NVML P2P query uses the existingcrate::nvml; io_uring stayscfg(target_os="linux")with thePreadBackendfallback.
Process
Open and marked ready for review (not a draft), hours old. No CI result yet on head 224fb40, no reviewers assigned, no labels, no comments. pr_files gives 16 files / +1973 −221; any larger figure taken from the raw diff overstates the change because the local main ref is stale. Four logically independent fix clusters touch largely disjoint files (runtime_core+payload+docs; runtime_core/model+mod; async_transfer+metrics+verification; execution/threaded), which matters to anyone deciding whether this must be reviewed and landed as one unit.
Open questions / not found
- Cannot confirm from any artifact that #727's gate actually detects the 145 previously-ungated graphs in the reporter's core: no patched-binary run exists on the #722 workload, and the reporter has not responded.
- Whether the widened gating imposes a measurable offload-latency cost on PCIe hosts is unmeasured; #722's own control run varied
--scheduler-policytoo, so even the reporter's before/after is confounded. - Commit-level history for these files could not be read (broken
gitrefs forc513e46/ef38cb9); "recent activity" is reconstructed from PR comparisons only. - Whether the two CI-workflow edits in the diff belong to #727 or to base drift could not be established.
- No reviewer, maintainer request, or roadmap item is linked; there is no independent signal yet on whether the maintainers want the watchdog (bounded abort) as the answer to #722's second finding.