Final review report · NVIDIA/hyperflare-inference #736

Raw Markdown for agents: https://autobot.eidonix.com/p/0e437f3c-f346-4578-be21-0886cea59338.md

Recommendation: Changes Requested

The core mechanism—recording VMM-aliased KV pages on the 1 -> 0 page_snapshot_refs transition in release_snapshot and zeroing coalesced contiguous runs via cuMemsetD8Async across all KV planes before kernel submission or store.fetch—is technically sound, correctly fence-ordered across all verified release_snapshot call sites, and covers both local and pooled host-cache restores. However, the PR cannot merge as-is because it omits mandatory verification gates (verification/helios-lifecycle/check.py, a GPU test exercising enqueue_zero_cache_pages, --release crate tests, and multi-GPU TP verification for the new cross-rank coordination and drain paths), extends the rank-control wire protocol without bumping its handshake version, and omits poisoning GraphExecutor on zeroing failures.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Mandatory TLA+ lifecycle conformance (verification/helios-lifecycle/check.py) was not run (docs/design-review.md:211-215, 234-251).

    • This PR modifies snapshot alias ownership (helios/src/scheduler.rs:669,772, helios/src/scheduler/cache_memory.rs:828-846), admission (helios/src/server/runtime.rs:1788-2166, 3856-4001), and rank coordination (helios/src/execution/parallel.rs:99-147, 288-328, 418-429, 747-751; helios/src/execution/threaded.rs:873-885, 1217-1258, 1273-1308).
    • docs/design-review.md:211-215 and :234-251 make python3 verification/helios-lifecycle/check.py a non-waivable CPU gate whenever modifying snapshot aliases, admission, or rank coordination ("blocking design failure, regardless of whether CPU unit tests pass"; disclosure does not waive runnable CPU checks).
    • Fix: Run python3 verification/helios-lifecycle/check.py (with --tlc-jar) against this branch and report the full pass results in the PR description.
  2. Zero automated or current-submission verification of the new CUDA memset path and multi-GPU TP coordination/drain paths (docs/design-review.md:106-115, 180-187, 252-259; AGENTS.md:194-199).

    • All four added tests run under CUDA_VISIBLE_DEVICES="" and exercise only CPU helpers/wire codec/closure ordering. Nothing in the test suite executes enqueue_zero_cache_pages (helios/src/execution/transport.rs:1469-1508), Stream::with_context (helios/src/cuda.rs:1128-1131), ThreadedExecutor::zero_kv_pages (helios/src/execution/threaded.rs:1217-1258), or TensorParallelExecutor::zero_kv_pages / serve_rank handling of ZERO_KV_PAGES interleaved with in-flight READY/COMPLETE messages (helios/src/execution/parallel.rs:288-328, 747-751).
    • In addition, the reported GB300 soak runs were single-GPU and, per Validation limits, not re-run for this submission; the reported cargo test run was debug-profile and filtered rather than --release (docs/design-review.md:180-187); and docs/design-review.md:252-259 requires an explicit before/after happens-before analysis plus live multi-GPU collective execution for changes altering cross-rank coordination and drain paths in parallel.rs / threaded.rs (new blocking ZERO_KV_PAGES RPC with apply_peer_message consumption, cross-context peer zero streams, and ThreadedExecutor::close() drain/poison teardown).
    • Fix:
      1. Add an #[ignore] CUDA test (matching the existing GPU test pattern in helios/src/cuda.rs / helios/src/runtime_core/cache_memory.rs and predecessor #181) that writes non-zero (0x7F/0xFF) bytes through a VMM-aliased snapshot row, runs enqueue_zero_cache_pages / zero_kv_pages, and verifies reclaimed pages are zeroed across all planes while live aliased pages remain byte-identical.
      2. Add a CPU test exercising TensorParallelExecutor::zero_kv_pages + serve_rank (or apply_peer_message + ZEROED_KV_PAGES loop) with interleaved READY/COMPLETE messages before ZEROED_KV_PAGES.
      3. Run cargo test --locked --release on helios (--features runtime-core,server), provide the cross-rank happens-before analysis for ZERO_KV_PAGES and ThreadedExecutor::close(), and run live multi-GPU TP verification (or, if TP scope is unnecessary/untestable on available hardware, explicitly coordinate scope with maintainers rather than shipping unverified TP code).

Should Fix

  1. Bump the rank-control handshake protocol version for the new wire tags (helios/src/execution/parallel/wire.rs:27-28, 185-196, helios/src/execution/parallel.rs:179-189, 747-752, docs/multi-host.md:24-26).

    • Adding ZERO_KV_PAGES = 14 and ZEROED_KV_PAGES = 15 without incrementing wire::layout()'s leading protocol version (6 at wire.rs:188, asserted at helios/src/execution/parallel/tests.rs:229) allows a patched rank zero and an unpatched peer to pass HELLO handshake (parallel.rs:185) and then fail mid-serving on the first snapshot eviction with "unexpected rank command" (parallel.rs:752), contradicting docs/multi-host.md:24-26 ("Serving builds must agree on the rank control protocol version").
    • Fix: Bump the leading protocol version in wire::layout() (wire.rs:188) from 6 to 7 (matching predecessor #181), update parallel/tests.rs:229, and verify incompatible builds are rejected during HELLO.
  2. Poison GraphExecutor when KV page zeroing fails (helios/src/execution/transport.rs:1357-1391).

    • TensorParallelExecutor::zero_kv_pages (parallel.rs:324-326) and ThreadedExecutor::zero_kv_pages (threaded.rs:1253-1255) both record self.poison = Some(error.clone()) on error, matching GraphExecutor::submit (transport.rs:1158) and GraphExecutor::poll (transport.rs:1187-1296). In contrast, GraphExecutor::enqueue_zero_kv_pages (transport.rs:1357-1377) and GraphExecutor::zero_kv_pages (transport.rs:1386-1391) check self.poison on entry (:1361) but never set self.poison if coalesce_page_runs, cuMemsetD8Async, or cuStreamSynchronize fails. On single-GPU (RankExecutorInner::Local), a partial async memset failure or sync error leaves GraphExecutor un-poisoned, allowing subsequent calls to proceed and dropping the root error from Shutdown.error in close() (transport.rs:1424).
    • Fix: Record self.poison = Some(error.clone()) on failure in enqueue_zero_kv_pages and zero_kv_pages (changing sync_zero_kv_pages to &mut self or poisoning around the call in zero_kv_pages).

Subtract / Simplify

  1. Consolidate the 8 zero_reclaimed_kv_pages flush sites in helios/src/server/runtime.rs (:1618, :1622, :1624, :1626, :1858, :2165, :3220, :3998-4001) down to the 2 actual GPU-ordering barriers.
    • Every GPU read/write of a newly allocated KV page goes through either store.fetch (runtime.rs:4005) or executor.submit (runtime.rs:3271). Removing the 6 intermediate flushes (:1618, :1622, :1624, :1626, :1858, :2165) reduces loop noise and merge conflict surface with #705, eliminates the Option<&mut RankExecutor> plumbing in admit_with_executor (:1796-1804, :1857, :2164) by passing only the zeroing closure, and avoids issuing up to 6 separate synchronous cross-rank ZERO_KV_PAGES network round-trips + cuStreamSynchronize calls within a single worker tick when multiple events release snapshots before one submission.
  2. Gate the dedicated zero CUDA stream on cache/alias presence (helios/src/execution/transport.rs:573,626,1403, helios/src/execution/threaded.rs:875-880).
    • Currently Stream::open creates an extra CU_STREAM_NON_BLOCKING stream on every GraphExecutor and every cache-owning peer even when manifest.cache is None or cache.snapshot_pages.is_empty() (where reclaimed_snapshot_pages is never populated). Storing Option<Stream> gated on cache.is_some_and(|c| !c.planes.is_empty() && !c.snapshot_pages.is_empty()) avoids allocating and draining unused streams on non-aliasing cores.
  3. Deduplicate coalesce_page_runs and unify the enqueue/sync predicate in ThreadedExecutor::zero_kv_pages (helios/src/execution/threaded.rs:1229-1245, helios/src/execution/transport.rs:1357-1391,1469-1476).
    • ThreadedExecutor::zero_kv_pages currently sorts and allocates pages.to_vec() once per peer plus once for local (ranks + 1 times) and uses two different emptiness guards (local_enqueued vs !cache.planes.is_empty()). Coalesce once, validate the max page against each rank's page_capacity, and return Result<bool> from enqueue_zero_cache_pages so local and peer sync paths share one uniform predicate.

Nits

Dropped on verification