Explore report · NVIDIA/hyperflare-inference #628

Raw Markdown for agents: https://autobot.eidonix.com/p/913a26a6-dd4b-4898-973d-c10bcebeb05d.md

Case file — PR #628 helios: gate offload Copy Engine batches during peer-copy graphs

Draft, open 2026-11-30, head 1870a27, base main @ c146d7b; 14 files, +572/−72; labels bug, performance, priority:P1; no reviews, no comments, no reactions; CI failed on the head commit. Fixes #627. Discord: D-Rock. Author: yatesdr (COLLABORATOR).

Key findings

Things a reader could not learn from the PR description:

  1. A documented invariant is reversed and no doc is updated. docs/prefix-cache-offload.md:133 states "Offload work never blocks the model worker thread or the model stream" (repeated at :907 "The model stream never waits on an offload event" and :1015 "The model worker thread never waits for offload work"). With this change the model worker thread calling RankExecutor::submit blocks in CopyEngineGate::enter_peer_graph() until every in-flight offload batch drains (helios/src/execution/ranks.rs:90-96, helios/src/offload/copy_gate.rs:45-56). No docs/ file is in the changed set. Section 2.10 (docs:900-918) already anticipates the gap — "Batch size and stream priority alone do not bound those delays" — but states the opposite invariant as the contract.
  2. The offload fast path changes for every prefix-cache run, not only peer-copy runs. The gate is Some for every offload binding a NativeModel builds (helios/src/runtime_core/model.rs:986-989,1032-1038; ranks.rs:62), so RankWorker::run now does record + synchronize per 16 MiB BATCH_BYTES batch plus one mutex/condvar lock per batch (helios/src/offload/transfer.rs:398-430), where the single end-of-job sync (transfer.rs:431-434) is now the gate-less path only; copy_spans_batch likewise (helios/src/offload/transfer/codec.rs:976-1002,1025-1028). BATCH_BYTES = 16 << 20 (helios/src/cuda.rs:169 (not opened)). The description's "zero gate overhead on graphs without peer-copy nodes" is true for graph submission only, and no offload throughput/latency measurement is presented — while the immediately preceding merged offload PR (#497) retuned this same worker specifically to reduce restore latency.
  3. Several copy paths stay ungated despite the "pool and CPU codec paths share the same wiring" claim. helios/src/offload/shard.rs:47 (join_peer, used for a disk-store peer rank from flare-cli/src/cluster.rs:254) still constructs Copiers::new(gpu_cubins) — no gate. heliopause/src/python.rs:331 passes peer_copy_graphs: Vec::new(), so any Heliopause/Python-built manifest never marks peer-copy graphs and never engages the gate. NativeModel::attach_offload's factory only reaches the pool-agent peer path (selene/src/offload.rs:935-949), so "Selene pool workers" gating is narrower than the description reads.
  4. Detection is deliberately narrow and can miss real peer traffic. Only literal Node::Copy nodes whose endpoint allocation is declared Memory::Peer are marked (helios/src/runtime_core/mod.rs:1149-1156; Memory::Peer semantics at helios/src/runtime_core/format.rs:43-49). Kernel-driven DMA, or copies to a local Memory::Device allocation that is merely peer-mapped, are not detected.
  5. Charter tension on root cause. The charter ("Bring real evidence", #397) requires bug fixes to address root cause rather than work around it. Issue #627's own ablation shows the mechanism is not fully characterised (serializing offload workers behind a cross-rank mutex still deadlocked), and the PR frames itself as "Coordinating host offload batches against peer-copy graph execution … resolves the deadlock" — a coordination/mitigation layer.
  6. Charter performance rule not met in the direction it asks for. #628 carries the performance label but its only comparative datum is the opposite direction (unpatched main deadlocks; patched completes 40/40 at 4.68–4.83 s/burst). The charter asks performance PRs for a benchmark showing a speedup over main (#210).
  7. Single-process scope only. The gate is per NativeModel, so RankPeers::Processes (one process per rank, multi-host) gets one gate per process; a rank's offload batches are not coordinated against another rank's peer-copy graph. Description says "Share one Arc<CopyEngineGate> per NativeModel", which is accurate but narrower than "eliminates the TP2 deadlock" reads outside single-host threaded TP.

The change: what it does and how big

Plain terms: a per-model mutex/condvar gate with two RAII leases (helios/src/offload/copy_gate.rs, new, 263 lines):

Graph classification is structural, computed once at CUDA graph reconstruction: NativeResources.peer_copy_graphs: Vec<bool>, set when any Node::Copy has a Memory::Peer source or destination (helios/src/runtime_core/mod.rs:117,919,1149-1156,1238), surfaced as ExecutionManifest.peer_copy_graphs + has_peer_copies(index) (helios/src/execution/manifest.rs:436-449), populated per graph name in helios/src/runtime_core/serving.rs:49,59,202.

Wiring: one Arc<CopyEngineGate> per NativeModel (helios/src/runtime_core/model.rs:27,662), passed into offload::Binding::new(inner, cubins, copy_gate) (helios/src/offload/mod.rs:39-60), Copiers::with_gate in attach_offload (model.rs:985-991), manifest.offload build (model.rs:1032-1038), and server attach via open_with_gate (helios/src/server/runtime.rs:715-733).

Execution boundary: RankExecutor split into RankExecutorInner + gate state; merge_peer_copy_graphs unions flags across local RankPeers::Threads manifests so asymmetric peer copies are covered (helios/src/execution/ranks.rs:39-52); guard taken in submit only when peer_copy_graphs[graph] (ranks.rs:90-105), released in poll for fences ≤ the completed frame fence (ranks.rs:108-124), remainder cleared in close after inner close (ranks.rs:170-181).

Gated copy sites: uncompressed RankWorker::run (transfer.rs:398-430), CPU-codec copy_spans_batch (codec.rs:958-1028), and five GPU-codec entry points (codec.rs:290,318,352,668,752).

Compatibility surface: no Protobuf change, no package-format change, no new flag, no core re-export needed; peer_copy_graphs absent ⇒ false (manifest.rs:436-449), which is what keeps legacy cores loading.

The why

Recent activity

People

Project fit

Where it lines up:

Where it does not:

Claims and evidence

Claim Backing
Eliminates the TP2 prefill deadlock Live TP2 runs on 4× RTX PRO 6000, 5× 8-way uncached 6,578-token bursts, 40/40 HTTP 200 at 4.68–4.83 s/burst; "unpatched main deadlocked during the first burst". Text only — no logs/artifacts in the PR.
No regression in warm/restore correctness Qwen3.8: warm 0/6 pos0 mismatches (5.08×), restart+disk restore 0/6 (2.45×); GLM-5.3: 0/96 token mismatches warm (3.50×) and restore (1.55×); both 8/8 bursts with 2 aborts.
Zero gate overhead on non-peer-copy graphs True for submit path (ranks.rs:90-96 skips enter_peer_graph when the flag is false). Not true for the offload path, which syncs per batch whenever offload is attached (transfer.rs:398-430).
Multi-rank offload concurrency preserved outside peer graphs Unit test listed ("multi-rank concurrency"); code allows concurrent OffloadBatchGuard holders (copy_gate.rs:60-67).
Pool and CPU-codec paths share the gate wiring CPU codec: yes (codec.rs:958-1028). Pool: only via the factory used when Preparation::Store still has a pool (selene/src/offload.rs:935-949). Multi-host shard peer path: no (shard.rs:47).
Preserves compatibility without re-export peer_copy_graphs absent defaults to false (manifest.rs:436-449); no format/Protobuf change in the diff.
Compiler/test results (0 warnings; 5/5, 162/162, 245/245, 200/201, 19/19 + 6/6) Stated in prose only; CI on the head commit failed and no test output is attached.

Not measured anywhere: offload capture/restore throughput cost of the per-batch synchronize; latency of peer-copy graphs waiting on offload drain; behaviour under sustained offload + prefill other than the author's burst tests.

Reach

Process

Open questions / not found