Re review report · NVIDIA/hyperflare-inference #628

Raw Markdown for agents: https://autobot.eidonix.com/p/27812ee4-7875-47f0-92c1-c5b831052f59.md

Recommendation: Ready To Merge

Head fdd898b cleanly resolves all Round 2 blockers and should-fix items: multi-process peer ranks (serve_rank) now defer READY while active peer-copy frames drain for a waiting offload wave, Reply.elapsed restores honest wall-clock timing for Selene admission pricing, the redundant *_with_gate constructors and batch-sync duplication are collapsed into offload::open, offload::shard::join_peer, and GatedCopies, and all 8 ignored SM120 CUDA offload::transfer:: tests plus the Qwen3.8-Flash-Next TP2 A/B run passed on hardware. Adversarial verification confirmed that CopyEngineGate, PeerGraphLeases, lock ordering (gpu.codec → CopyEngineGate), stream drains on error, and executor.close()-before-store.close() teardown are sound, with zero overhead on single-GPU and non-peer-copy models.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

None.

Subtract / Simplify

  1. Store copy_gate on RankCodec instead of threading it through 5 signatures (helios/src/offload/transfer/codec.rs:44-72, 160, 227, 536, 585, 961, helios/src/offload/transfer.rs:408-421, 459): RankCodec::new is called from a single site (transfer.rs:410) where copy_gate is already in scope, and RankCodec already owns counters, write_mode, cpu, and gpu. Holding copy_gate: Option<Arc<CopyEngineGate>> as a struct field removes ~16 pure pass-through arguments, six super::super::CopyEngineGate spellings, and two #[allow(clippy::too_many_arguments)] attributes while preserving gpu.codec → CopyEngineGate lock ordering via disjoint field borrows.
  2. Return copy_gate from Binding::take() (helios/src/offload/mod.rs:78-82, helios/src/server/runtime.rs:718-724): Widening Binding::take(&self) to Option<(Prepared, Vec<Arc<Vec<u8>>>, Option<Arc<CopyEngineGate>>)> eliminates the intermediate closure and 3-tuple shuffle in server/runtime.rs:718-724.
  3. Deduplicate the starvation threshold predicate and narrow visibility (helios/src/offload/copy_gate.rs:28, 55-68, 94-100, 258-264): Extract State::offload_owed_turn(&self) -> bool for the shared offload_batches_waiting > 0 && peer_entries_while_offload_waiting >= MAX_PEER_STREAK_WHILE_OFFLOAD_WAITING check used by both maybe_arm_offload_wave and should_yield_to_offload. Neither PEER_GRAPH_GATE_TIMEOUT (:28) nor CopyEngineGate::should_yield_to_offload (:94) has any caller outside copy_gate.rs, so both can be module-private. (Optionally, the two ~55-line simulated fairness loops at copy_gate.rs:439-496 and :578-644 can also be consolidated into one test.)

Nits

  1. Stale PR description: Update the PR body to remove superseded names (has_peer_copies, open_with_gate) and old test counts (5/5, 6/6, 19/19) so the merge commit summary matches fdd898b.
  2. Rebase onto current main before merging: Current main includes #645 (GraphKind::pipelines() now includes GraphKind::Prefill at helios/src/execution/manifest.rs:89-91); rebasing before merge lets CI (Helios lifecycle and --release CPU suites) validate the exact merge tree.
  3. Minor polish: In helios/src/execution/parallel.rs:639, 676, passing graph into a graph-aware should_drain_for_offload(graph) would avoid deferring non-peer-copy frames when only a subset of graphs carry peer copies. In helios/src/offload/copy_gate.rs:580, clarify the comment that the unit test simulates the serve_rank deferral state transitions (since serve_rank constructs a CUDA GraphExecutor::new_unstarted). In docs/prefix-cache-offload.md:920-922, optionally note that hitting the 120 s drain bound fails the submission and stops the worker (consistent with §2.12 at :1030-1031).

Dropped on verification