Re review report · NVIDIA/hyperflare-inference #576

Raw Markdown for agents: https://autobot.eidonix.com/p/0fd0a85e-7776-4d72-836b-7ab987ef88ed.md

Recommendation: Changes Requested

This rework resolves two of the three prior blockers cleanly: helios/native/roce_proxy.c now syncs the exact hunk merged upstream in local-inference-lab/flashinfer#156 (335459b2, satisfying @original-el8's upstream-first option), commit metadata and sign-offs are updated, and eagerly spawned background threads (RankExecutor/flare-rank-*, flare-offload-*, flare-offload-disk, ImagePreparation) now stay on the full process cpuset. One concrete regression remains from the prior Round 2 blocker: selene::shared::codec::cpu_pool() is a lazy OnceLock whose first use on --prefix-cache-memory with CPU KV compression occurs inside worker.run on the already-narrowed flare-model thread, halving the flare-kv-codec-* pool and pinning all codec workers exclusively to the P-cores. Eagerly initializing cpu_pool() during offload startup before narrowing resolves this and unblocks merge.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Lazy flare-kv-codec-* rayon pool is still sized and pinned on the narrowed flare-model thread (helios/src/server/runtime.rs:721-729, selene/src/shared/codec.rs:37-60, selene/src/memory.rs:1898-1901,2005-2013,2341-2370,3064-3075)
    • Verified behavior & impact: The comment at helios/src/server/runtime.rs:721-723 states that narrowing after crate::offload::open (:696) leaves host offload/codec/disk threads on the full process cpuset. While flare-offload-* (helios/src/offload/transfer.rs:509-536) and flare-offload-disk (selene/src/disk.rs:372,732) are spawned eagerly inside offload::open, selene::shared::codec::cpu_pool() (selene/src/shared/codec.rs:37-57) is a lazy OnceLock that is not touched during offload::open (AsyncCompressor::new at selene/src/memory.rs:1986-1998,2313 creates only channels and an empty queue).
    • When host prefix offload uses async CPU KV compression (helios/src/offload/transfer.rs:466-482, selene/src/memory.rs:2286-2314), the first outbound checkpoint store triggers Worker::run -> service_store (helios/src/server/runtime.rs:2380-2388) -> MemoryStore::poll (selene/src/memory.rs:3064-3075) -> drain_compressed (:2368-2370) -> AsyncCompressor::pump_spawns (:2005-2013) -> host_compress_pool() (:1898-1901) -> 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 calling thread's sched_getaffinity mask, and rayon::ThreadPoolBuilder::build() spawns all flare-kv-codec-* workers from that thread. On GB10 (0-19 narrowed to 5-9,15-19), this both halves the codec pool (10 / 2 = 5 workers instead of 20 / 2 = 10), pins all codec compression workers exclusively to P-cores where they contend with flare-model/flare-roce instead of using efficiency cores (violating docs/prefix-cache-offload.md:919-928 and contradicting runtime.rs:721-723), and incurs pool thread-creation latency inside store.poll(). (It also creates a startup race with helios/src/offload/transfer/codec.rs:353,514,751, where whichever of flare-model or flare-offload-0 hits cpu_pool() first permanently fixes the pool size and affinity for the process.)
    • Fix: Eagerly warm crate::shared::codec::cpu_pool() during MemoryStore::open when codec_enabled / async_encoder.is_some() (e.g., inside AsyncCompressor::new or right before returning from selene/src/memory.rs:2307-2315, or inside crate::offload::open when CPU KV compression is active), which runs on the unnarrowed flare-model thread before helios/src/server/runtime.rs:724 and avoids spawning codec threads when offload compression is disabled.

Should Fix

None.

Subtract / Simplify

  1. Remove dead min_cap == max_cap check in select_high_capacity_cpus (eos/src/unix.rs:201-203): When min_cap == max_cap (with positive capacities), every CPU satisfies cap * 10 >= max_cap * 9, so selected.len() == allowed_with_capacity.len() and the final guard at :221 (selected.len() < allowed_with_capacity.len()) already returns None. Deleting :201-203 preserves exact behavioral parity with roce_proxy.c:1510-1569.
  2. Tighten visibility and collapse the Unix cfg stub (eos/src/unix.rs:188,231-264): Because eos/src/lib.rs:12 does pub use unix::*;, marking select_high_capacity_cpus as fn (private to eos/src/unix.rs, where its only caller :253 and tests :270-330 live) avoids exporting an internal helper on flare_eos's public API. Likewise, prefer_high_capacity_cpus (:231-264) can use a single signature with #[cfg(target_os = "linux")] inside the function body instead of repeating the pub fn declaration.

Nits

Dropped on verification