Re review report · NVIDIA/hyperflare-inference #576

Raw Markdown for agents: https://autobot.eidonix.com/p/db8908e7-eb13-4d80-9fc2-8e726f1145fc.md

Recommendation: Changes Requested

Dropping the redundant helios/native/roce_proxy.c hunk after #643 landed it on main makes this a clean, minimal pure-Rust change, and the tier-selection helper and eagerly-spawned thread placement are sound. However, the single blocker from Round 2 remains unaddressed at ca0c982: selene::shared::codec::cpu_pool() is still initialized lazily on first use from the already-narrowed flare-model thread, which halves and P-core-pins the flare-kv-codec-* pool (and races with flare-offload-* threads) under --prefix-cache-memory with CPU KV compression. Fixing that eager warm-up, updating the now-stale PR description (which still describes the removed roce_proxy.c edit), and rebasing onto current main will make this ready to merge.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Lazy flare-kv-codec-* rayon pool is still initialized on the narrowed flare-model thread (unresolved from Round 2) (helios/src/server/runtime.rs:756,781-784,2675-2683, selene/src/shared/codec.rs:37-60, selene/src/memory.rs:1898-1901,1986-2026,2276-2326,2341-2370,3064-3075, helios/src/offload/transfer/codec.rs:24-25,353,514)
    • Verified behavior & impact: helios/src/server/runtime.rs:781-784 defers prefer_high_capacity_cpus() past crate::offload::open (:756) with the explicit intent that host offload, codec, and disk worker threads retain the full process cpuset. While flare-offload-* (helios/src/offload/transfer.rs:509-536), flare-offload-disk (selene/src/offload.rs:771), flare-input-records (selene/src/input.rs:282), and ImagePreparation (helios/src/server/runtime.rs:779,1069-1074) are all spawned eagerly before :784, selene::shared::codec::cpu_pool() (selene/src/shared/codec.rs:37-60) is a lazy OnceLock that is never touched during crate::offload::open → selene::offload::open (selene/src/offload.rs:749) → MemoryStore::open (selene/src/memory.rs:2276-2326) → AsyncCompressor::new (selene/src/memory.rs:1986-1998).
    • On --prefix-cache-memory with async CPU KV compression (helios/src/offload/transfer.rs:466-482), the first outbound checkpoint store drives worker.run → service_store (helios/src/server/runtime.rs:2683) → MemoryStore::poll (selene/src/memory.rs:3066,3075) → drain_compressed (:2368-2370) → AsyncCompressor::pump_spawns (:2013) → host_compress_pool() (:1899-1900) → cpu_pool() on the already-narrowed flare-model thread.
    • Inside cpu_pool(), std::thread::available_parallelism() (selene/src/shared/codec.rs:41-43) reads the caller's affinity mask and rayon::ThreadPoolBuilder::build() spawns workers inheriting it. On GB10 (0-19 narrowed to 5-9,15-19), this halves the pool (5 instead of 10 workers) and pins flare-kv-codec-* onto the P-cores alongside flare-model/flare-roce, contradicting both helios/src/server/runtime.rs:781-783 and docs/prefix-cache-offload.md:919-928. Because unnarrowed flare-offload-* threads also call cpu_pool() (helios/src/offload/transfer/codec.rs:353,514), whichever thread hits the OnceLock first fixes pool size and affinity for the lifetime of the process — introducing launch-to-launch variance.
    • Fix: Eagerly warm crate::shared::codec::cpu_pool() inside MemoryStore::open when async_encoder.is_some() (e.g., at selene/src/memory.rs:2307-2315 or inside AsyncCompressor::new at :1986-1998), so the pool is always initialized on the unnarrowed flare-model thread prior to helios/src/server/runtime.rs:784 without spawning codec threads when CPU KV compression is disabled.

Should Fix

  1. Align the PR title/description with the pure-Rust diff and rebase onto current main: Commit ca0c982 dropped helios/native/roce_proxy.c (already merged to main via #643, helios/native/roce_proxy.c:1699-1771), but the PR title, "What Changed" bullet, and RoceOneshotLaunch evidence still claim this PR vendors pin_high_capacity_cpus() and "flare-roce" in roce_proxy.c. Remove the stale roce_proxy.c bullet, clarify that the proxy half is already on main via #643, and rebase onto current main (eos/src/unix.rs and helios/src/server/runtime.rs have moved since 571a4471).

Subtract / Simplify

  1. Make select_high_capacity_cpus private (eos/src/unix.rs:188): eos/src/lib.rs:11-12 glob-re-exports pub use unix::*;, and select_high_capacity_cpus has no callers outside eos/src/unix.rs (:253 and mod tests). Changing pub fn to fn removes an unused symbol from flare_eos's public API while keeping unit tests unchanged.
  2. Route the five new call sites through crate::os:: (helios/src/server/runtime.rs:784, helios/src/execution/worker.rs:86, helios/src/execution/threaded.rs:683, helios/src/execution/parallel.rs:578, helios/src/replay.rs:174): helios/src/os.rs:8 re-exports pub(crate) use flare_eos::*;, and every other host-OS call site in helios uses crate::os::*. Replacing flare_eos::prefer_high_capacity_cpus() with crate::os::prefer_high_capacity_cpus() restores that single crate-wide import surface.

Nits

Dropped on verification