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
- Unresolved
--prefix-cache-memoryCPU KV-codec regression: Deferringprefer_high_capacity_cpus()pastcrate::offload::open(helios/src/server/runtime.rs:756,784) protects eagerly spawned offload, disk, and image-preparation threads, but misses the lazyflare-kv-codec-*rayon pool (selene/src/shared/codec.rs:37-60), creating a per-launch race that halves codec workers (5vs10on GB10) and pins them onto P-cores alongsideflare-model/flare-roce. - Rebase drift against current
main:mainhas moved past this branch's base (571a4471), notably rewritingeos/src/unix.rs(#625,#667, now 1,367 lines) and updating thecrate::offload::opencall site right abovehelios/src/server/runtime.rs:784(#628). - Zero aarch64 CI execution: On homogeneous/x86_64 Linux and Windows the helper is a clean no-op with zero steady-state overhead, so x86_64/Windows regressions are unlikely, but
.github/workflows/native-serving.yml:16-22(not opened) never executes the asymmetric Linuxcpu_capacitypath.
Walkthrough
eos/src/unix.rs:183-264&eos/src/windows.rs:219-220: addsselect_high_capacity_cpus(≥ 90% of max allowed capacity, midpoint fallback, ≥ 2-CPU floor), Linuxprefer_high_capacity_cpus(strict intersection with the calling thread'ssched_getaffinitymask via/sys/devices/system/cpu/cpu<N>/cpu_capacity), non-Linux/Windows no-op stubs, and three isolated unit tests (eos/src/unix.rs:270-330).helios/src/server/runtime.rs:781-784: callsflare_eos::prefer_high_capacity_cpus()onflare-modelafterRankExecutor::new(:657),crate::offload::open(:756), andImagePreparation::new(:779), immediately beforeworker.run(&mut executor)(:789).helios/src/execution/worker.rs:86: narrowsflare-executionafterRankExecutor::new(:75).helios/src/execution/threaded.rs:683&helios/src/execution/parallel.rs:578: narrow eachflare-rank-*peer thread andserve_rankafterGraphExecutor::new_unstarted.helios/src/replay.rs:173-176: narrowsflare-cudaat worker entry beforerun(...).
Pre-merge Checks
- [PASS] Security / malicious screen: Read-only
/sys/devices/system/cpu/cpu<N>/cpu_capacityinteger parsing and standardsched_getaffinity/sched_setaffinitysyscalls; no new env vars, network I/O, or untrusted input handling. - [PASS] Charter & value fit: Targets DGX Spark (GB10), a named charter hardware target, via a single general runtime OS primitive in
eos/; removingroce_proxy.cresolves all vendored-file provenance concerns, and fixing Blocker 1 restores full compliance withdocs/prefix-cache-offload.md:919-928. - [WARN] Related / duplicate / conflict check: No competing Rust affinity PR exists (
#643already merged the Croce_proxy.chalf onmain), butmainhas moved ahead ineos/src/unix.rs(#625,#667) andhelios/src/server/runtime.rs(#628), requiring a rebase; open#640also editshelios/src/execution/threaded.rs. - [WARN] Tests & verification evidence: The three unit tests in
eos/src/unix.rs:270-330are deterministic and isolated (no global state mutation), but.github/workflows/native-serving.yml:16-22(not opened) runs only x86_64 Linux and Windows (never executing the asymmetric Linux path),--prefix-cache-memorywith CPU KV compression was not exercised on GB10, and the latest comment narrows cited testing toeos(5/5) andhelios --lib execution::roce::(6/6) rather than the fullheliossuite.
Blockers
- Lazy
flare-kv-codec-*rayon pool is still initialized on the narrowedflare-modelthread (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-784defersprefer_high_capacity_cpus()pastcrate::offload::open(:756) with the explicit intent that host offload, codec, and disk worker threads retain the full process cpuset. Whileflare-offload-*(helios/src/offload/transfer.rs:509-536),flare-offload-disk(selene/src/offload.rs:771),flare-input-records(selene/src/input.rs:282), andImagePreparation(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 lazyOnceLockthat is never touched duringcrate::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-memorywith async CPU KV compression (helios/src/offload/transfer.rs:466-482), the first outbound checkpoint store drivesworker.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-narrowedflare-modelthread. - Inside
cpu_pool(),std::thread::available_parallelism()(selene/src/shared/codec.rs:41-43) reads the caller's affinity mask andrayon::ThreadPoolBuilder::build()spawns workers inheriting it. On GB10 (0-19narrowed to5-9,15-19), this halves the pool (5instead of10workers) and pinsflare-kv-codec-*onto the P-cores alongsideflare-model/flare-roce, contradicting bothhelios/src/server/runtime.rs:781-783anddocs/prefix-cache-offload.md:919-928. Because unnarrowedflare-offload-*threads also callcpu_pool()(helios/src/offload/transfer/codec.rs:353,514), whichever thread hits theOnceLockfirst fixes pool size and affinity for the lifetime of the process — introducing launch-to-launch variance. - Fix: Eagerly warm
crate::shared::codec::cpu_pool()insideMemoryStore::openwhenasync_encoder.is_some()(e.g., atselene/src/memory.rs:2307-2315or insideAsyncCompressor::newat:1986-1998), so the pool is always initialized on the unnarrowedflare-modelthread prior tohelios/src/server/runtime.rs:784without spawning codec threads when CPU KV compression is disabled.
- Verified behavior & impact:
Should Fix
- Align the PR title/description with the pure-Rust diff and rebase onto current
main: Commitca0c982droppedhelios/native/roce_proxy.c(already merged tomainvia#643,helios/native/roce_proxy.c:1699-1771), but the PR title, "What Changed" bullet, andRoceOneshotLaunchevidence still claim this PR vendorspin_high_capacity_cpus()and"flare-roce"inroce_proxy.c. Remove the staleroce_proxy.cbullet, clarify that the proxy half is already onmainvia#643, and rebase onto currentmain(eos/src/unix.rsandhelios/src/server/runtime.rshave moved since571a4471).
Subtract / Simplify
- Make
select_high_capacity_cpusprivate (eos/src/unix.rs:188):eos/src/lib.rs:11-12glob-re-exportspub use unix::*;, andselect_high_capacity_cpushas no callers outsideeos/src/unix.rs(:253andmod tests). Changingpub fntofnremoves an unused symbol fromflare_eos's public API while keeping unit tests unchanged. - 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:8re-exportspub(crate) use flare_eos::*;, and every other host-OS call site inheliosusescrate::os::*. Replacingflare_eos::prefer_high_capacity_cpus()withcrate::os::prefer_high_capacity_cpus()restores that single crate-wide import surface.
Nits
- Add a 1-line doc cross-reference on
select_high_capacity_cpus(eos/src/unix.rs:183-187) pointing topin_high_capacity_cpus()inhelios/native/roce_proxy.c:1704so future policy edits keep both copies aligned. - Document the post-child-spawn ordering contract once on
prefer_high_capacity_cpus(eos/src/unix.rs:228-230) so callers at all sites know to invoke it after spawning background worker threads.
Dropped on verification
- Correctness #5 ("CPUs >= 1024 are silently dropped from the mask"): Dropped as factually false on Linux. When a kernel's
cpumaskexceedssizeof(cpu_set_t)(128bytes /1024bits),sched_getaffinity(0, sizeof(cpu_set_t), &allowed)returns-1(EINVAL), causingprefer_high_capacity_cpus()to safely no-op ateos/src/unix.rs:234-238rather than silently dropping high-numbered CPUs. - Correctness #4 ("unconditional, unlogged, unflaggable change on hybrid x86 CPPC / violates
docs/prefix-cache-offload.md:919-928"): Dropped (also previously dropped in Round 2). Linux x86_64 hybrid CPUs do not exposearch_topologysysfscpu_capacity(they use ITMT/sched_asym_packing); env-var behavior switches are prohibited bydocs/design-review.md:91-92;eoshas no logging dependency; anddocs/prefix-cache-offload.md:919-928governs offload/disk threads (which remain unpinned once Blocker 1 is fixed), not Helios model/execution threads. - Correctness #2 ("floor guard counts CPUs rather than threads") & #3 ("single unreadable
cpu_capacityfile aborts the loop"): Dropped (previously settled in Round 2). Fail-closed on unreadablecpu_capacityis intentional so an unreadable high-capacity CPU is never silently excluded, and both rules intentionally match vendoredhelios/native/roce_proxy.c:1722-1760and@original-el8's Round 1 approval ofeos/src/unix.rs. - Correctness #6 ("Windows stub uncompiled / lacks
SetThreadSelectedCpuSets"): Dropped..github/workflows/native-serving.yml:20-21 (not opened),45,47builds and testseos/src/windows.rson Windows, and the stub matches the existingraise_open_file_limitconvention ateos/src/windows.rs:214-217. - Correctness #7 ("P-core convergence on contended workloads") & #8 ("no affinity restore on shutdown"): Dropped as speculative / low-signal. Multi-host DGX Spark TP4 places 1 rank + 1 proxy on 10 Cortex-X925 cores (and single-host places 1
flare-modelthread on 10 P-cores); the real contention hazard on--prefix-cache-memoryis already concretely captured by Blocker 1, and teardown disk/offload flushes run on the unnarrowed offload/disk threads. - Correctness #11 ("add injectable sysfs root test and aarch64 CI runner"): Dropped as Round 2+ scope creep (CI runner matrix is repo infrastructure); factual CI and test-coverage notes are retained under Pre-merge Checks.
- Subtraction S4 ("delete three-tier midpoint fallback at
eos/src/unix.rs:211-220and its test:314-330"): Dropped (previously settled in Round 2). Keeping it maintains exact behavioral parity withhelios/native/roce_proxy.c:1749-1759onmain. - Value Proposition summary claims about
roce_proxy.cbyte-identity /#589wrapper /NOTICE/docs/TODO.txt: Dropped as stale —helios/native/roce_proxy.cis no longer in this PR's diff atca0c982(#643already landed it onmain).