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
- Host prefix-cache KV-codec regression (
--prefix-cache-memory): Deferringprefer_high_capacity_cpus()pastcrate::offload::open(helios/src/server/runtime.rs:696,724) protects eagerly spawned offload/disk/image threads, but misses the lazyflare-kv-codec-*rayon pool (selene/src/shared/codec.rs:37-60), which on cold-start async host compression is built from the narrowedflare-modelthread with half the threads and P-core-only affinity. - No x86_64/Windows runtime regression, but zero aarch64 CI execution: On homogeneous or non-
cpu_capacityLinux hosts and Windows (eos/src/windows.rs:220), the helper is a clean no-op with zero hot-path overhead; however,.github/workflows/native-serving.yml:16-22(not opened) runs only x86_64 Linux and Windows, so neither the Linux sysfs narrowing path nor the C proxy helper runs in CI. - Cross-PR rebase overlap: Open PR #625 modifies
eos/src/unix.rs(includingmod tests) and sibling PR #577 modifieshelios/native/roce_proxy.c; coordinate merge/rebase order.
Walkthrough
eos/src/unix.rs:188-330&eos/src/windows.rs:219-220: addsselect_high_capacity_cpus(≥ 90% of max allowed capacity with midpoint fallback and ≥ 2-CPU floor), Linuxprefer_high_capacity_cpus(strictly intersecting currentsched_getaffinityvia/sys/devices/system/cpu/cpu<N>/cpu_capacity), non-Linux/Windows no-op stubs, and three isolated pure-function unit tests.helios/src/server/runtime.rs:721-724: callsflare_eos::prefer_high_capacity_cpus()onflare-modelafterRankExecutor::new(:585),crate::offload::open(:696), andImagePreparation::new(:719), immediately beforeworker.run(&mut executor)(:729).helios/src/execution/worker.rs:86,helios/src/execution/threaded.rs:683,helios/src/execution/parallel.rs:573, &helios/src/replay.rs:174: narrowsflare-execution(afterRankExecutor::new), eachflare-rank-*peer thread (afterGraphExecutor::new_unstarted),serve_rank(afterGraphExecutor::new_unstarted), andflare-cuda(on worker entry).helios/native/roce_proxy.c:1505-1577: vendorspin_high_capacity_cpus()andpthread_setname_np(pthread_self(), "flare-roce")atproxy_mainentry verbatim from mergedlocal-inference-lab/flashinfer#156(335459b2), compiled throughhelios/native/roce_proxy_dlopen.c:236.
Pre-merge Checks
- [PASS] Security / malicious screen: Read-only
/sys/devices/system/cpu/cpu<N>/cpu_capacityinteger parsing and standardsched_getaffinity/sched_setaffinity/pthread_setname_npcalls; no new env vars, network I/O, or untrusted input handling. - [PASS] Charter & value fit: Targets DGX Spark (GB10), a named charter platform, via a single model-agnostic runtime OS primitive; upstream RoCE proxy sync follows
@original-el8's Round 1 direction once Blocker 1 stops pinning offload codec workers. - [WARN] Related / duplicate / conflict check: No competing affinity change on
main; open PR #625 editseos/src/unix.rsand sibling PR #577 editshelios/native/roce_proxy.c, so merge order will require a minor rebase. - [WARN] Tests & verification evidence: Unit tests (
eos/src/unix.rs:270-330) are isolated and pass on ARM64 per author report (5/5eos,1,728/1,728helios --features roce,runtime-core,server), but CI (.github/workflows/native-serving.yml:16-22(not opened)) runs x86_64 Linux/Windows only (never executing thecpu_capacityor C proxy paths), and the author's GB10/procand throughput evidence omits--prefix-cache-memorywhere Blocker 1 triggers.
Blockers
- Lazy
flare-kv-codec-*rayon pool is still sized and pinned on the narrowedflare-modelthread (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-723states that narrowing aftercrate::offload::open(:696) leaves host offload/codec/disk threads on the full process cpuset. Whileflare-offload-*(helios/src/offload/transfer.rs:509-536) andflare-offload-disk(selene/src/disk.rs:372,732) are spawned eagerly insideoffload::open,selene::shared::codec::cpu_pool()(selene/src/shared/codec.rs:37-57) is a lazyOnceLockthat is not touched duringoffload::open(AsyncCompressor::newatselene/src/memory.rs:1986-1998,2313creates 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 triggersWorker::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-narrowedflare-modelthread. - Inside
cpu_pool(),std::thread::available_parallelism()(selene/src/shared/codec.rs:41-43) reads the calling thread'ssched_getaffinitymask, andrayon::ThreadPoolBuilder::build()spawns allflare-kv-codec-*workers from that thread. On GB10 (0-19narrowed to5-9,15-19), this both halves the codec pool (10 / 2 = 5workers instead of20 / 2 = 10), pins all codec compression workers exclusively to P-cores where they contend withflare-model/flare-roceinstead of using efficiency cores (violatingdocs/prefix-cache-offload.md:919-928and contradictingruntime.rs:721-723), and incurs pool thread-creation latency insidestore.poll(). (It also creates a startup race withhelios/src/offload/transfer/codec.rs:353,514,751, where whichever offlare-modelorflare-offload-0hitscpu_pool()first permanently fixes the pool size and affinity for the process.) - Fix: Eagerly warm
crate::shared::codec::cpu_pool()duringMemoryStore::openwhencodec_enabled/async_encoder.is_some()(e.g., insideAsyncCompressor::newor right before returning fromselene/src/memory.rs:2307-2315, or insidecrate::offload::openwhen CPU KV compression is active), which runs on the unnarrowedflare-modelthread beforehelios/src/server/runtime.rs:724and avoids spawning codec threads when offload compression is disabled.
- Verified behavior & impact: The comment at
Should Fix
None.
Subtract / Simplify
- Remove dead
min_cap == max_capcheck inselect_high_capacity_cpus(eos/src/unix.rs:201-203): Whenmin_cap == max_cap(with positive capacities), every CPU satisfiescap * 10 >= max_cap * 9, soselected.len() == allowed_with_capacity.len()and the final guard at:221(selected.len() < allowed_with_capacity.len()) already returnsNone. Deleting:201-203preserves exact behavioral parity withroce_proxy.c:1510-1569. - Tighten visibility and collapse the Unix cfg stub (
eos/src/unix.rs:188,231-264): Becauseeos/src/lib.rs:12doespub use unix::*;, markingselect_high_capacity_cpusasfn(private toeos/src/unix.rs, where its only caller:253and tests:270-330live) avoids exporting an internal helper onflare_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 thepub fndeclaration.
Nits
NOTICE:16-19: WhileNOTICE'sf5f5341dFlashInfer commit link was already stale across priorroce_proxy.csyncs (#251,#279,#325), updatingNOTICE:17to335459b2(matching the syncedlocal-inference-lab/flashinfer#156hunk) keeps attribution accurate for the file this PR modifies.
Dropped on verification
- Correctness #2 / Discovery A3 ("vendored
roce_proxy.cbreaks byte-identity contract across 4 witnesses; move pin intoroce_proxy_dlopen.c"): Dropped as a Major/Blocker.@original-el8's Round 1 review explicitly authorized syncing throughlocal-inference-lab/flashinfer#156first, which is now merged (335459b2), soroce_proxy.c:8,roce_proxy_dlopen.c:7-9, anddocs/roce-ring.md:361-364are satisfied.docs/TODO.txt:80-86(ABI 10/11) andNOTICE:17(f5f5341d) were already stale from earlier syncs; reducedNOTICE:17to a 1-line Nit. - Correctness #3 ("90% filter has no relative-spread guard; 1–2% CPPC rounding like 1023/1024 pins to 1–2 CPUs;
cpu_capacityexists on x86 hybrid"): Dropped as factually and mathematically false. If capacities span 1–2% (e.g.,1023..1024, or GB10's997..1024tested ateos/src/unix.rs:303-308), 100% of CPUs passcap * 10 >= max_cap * 9, soselected.len() == allowed_with_capacity.len()and:221returnsNone. A >10% spread is already required to drop any CPU. Moreover, Linux x86_64 does not exposearch_topologysysfscpu_capacity(x86 hybrid uses ITMT/sched_asym_packing). - Correctness #4 ("≥ 2-CPU floor piles 8+ hot threads onto 2 CPUs under
taskset -c 0-3on a 1-prime + 3-efficiency SoC"): Dropped. On 1-prime + 3-efficiency ([1024, 500, 500, 500]), both the 90% pass and the midpoint fallback select only 1 CPU (< 2) and returnNone. Multi-GPU asymmetric big.LITTLE topologies are not in the supported hardware matrix, and@original-el8already approved theeos/src/unix.rsselector in Round 1. - Correctness #5 ("silent affinity with no env flag or logging; aborts on first unreadable
cpu_capacity"): Dropped. Environment-variable behavior switches are explicitly prohibited bydocs/design-review.md:91, fail-closed on missingcpu_capacityis intentional so x86_64/homogeneous hosts exit immediately without partial-topology assumptions, andeosis a low-level crate without logging. - Correctness #6 ("add injectable sysfs root, C-side test, and aarch64 CI execution"): Dropped as Round 2+ scope creep (CI runner matrix is repo-wide infrastructure; kept factual CI coverage note in
Pre-merge Checks). - Correctness #7 ("
helios/src/replay.rs:174narrows beforeStream::openat:114"): Dropped as speculative/untouched since Round 1 (Stream::opencallscuStreamCreateon a pre-existingbundle.context). - Correctness #8 ("
docs/prefix-cache-offload.md:919-928violated for RoCE proxy;flare-rocerename undocumented"): Dropped.docs/prefix-cache-offload.md:919-928governs prefix-cache offload threads (not the RoCE TP collective proxy), and is fully respected once Blocker 1 stops pinningflare-kv-codec-*. Naming the proxy"flare-roce"matches existingflare-*thread names. - Subtraction S1(b)-(c) ("delete
cap == 0guard and 3-tier midpoint fallback") & S3 ("fix lazy pool insidestart_handler"): Dropped S1(c) because removingcap == 0changes behavior on&[(0, 0), (1, 1024), (2, 1024)]and diverges fromroce_proxy.c:1534; dropped S1(b) to preserve exact behavioral parity with vendoredroce_proxy.c:1555-1565; dropped S3'sstart_handlersuggestion becauseavailable_parallelism()runs beforestart_handleron the calling thread andstart_handlercannot recover the unnarrowed process mask.