Recommendation: Changes Requested
The core change is well-targeted at DGX Spark (GB10, explicitly in the Charter's vision), preserves operator cpusets without adding flags or environment variables, and demonstrates real placement-variance improvements. However, two concrete defects block merge: the PR silently diverges the vendored helios/native/roce_proxy.c from its pinned FlashInfer source (making NOTICE factually false while duplicating 66 lines of untested C), and calling prefer_high_capacity_cpus() at the top of flare-model leaks the P-core-only mask onto prefix-cache offload, disk, and image-preparation background threads.
Blockers
-
Vendored
helios/native/roce_proxy.cdiverges from its pinned FlashInfer source, falsifiesNOTICE, and duplicates 66 lines of untested C.- Evidence:
helios/native/roce_proxy.c:6-8("Keep the source below identical so preparation and serving share the transport ABI"),docs/roce-ring.md:360-364("keep the vendored source identical to the dependency after its provenance header"), andNOTICE:16-19("Its implementation is unchanged from that revision; Flare adds a license and provenance preamble") all require the vendored proxy body to remain unchanged relative to the pinned FlashInfer commit. - This PR adds 71 lines of Flare-local C (
helios/native/roce_proxy.c:1505-1577:pin_high_capacity_cpus()pluspthread_setname_npand the call inproxy_main) without updatingNOTICEordocs/roce-ring.md, duplicates the Rust capacity-selection logic fromeos/src/unix.rs:172-245with zero tests (compiled only under--features roce, enabled on Linux aarch64 inflare-cli/Cargo.toml:43-44), and introduces lockstep coupling with an unmerged FlashInfer PR (#156). - Fix: Remove all changes to
helios/native/roce_proxy.c. Becauseroce_startcreates the proxy thread viapthread_create(&c->thread, NULL, proxy_main, c)(helios/native/roce_proxy.c:1674) with no thread-local setup (roce_proxy.c:1661-1681), a new pthread inherits its creator's CPU affinity mask on Linux. Pin the proxy from Rust around the soleroce_startcall inRoceTransport::connect(helios/src/execution/roce.rs:295) — either by saving/restoring the calling thread'scpu_set_taroundprefer_high_capacity_cpus()+roce_start, or by invokingroce_starton a short-lived starter thread that narrows its own affinity first. Do not simply callprefer_high_capacity_cpus()directly onconnect's caller thread, asconnect()runs on the process main thread (flare-cli/src/main.rs:549,613,flare-cli/src/cluster.rs:203,250) before HTTP/dashboard/offload threads are spawned. Leave"flare-roce"thread naming for an upstream FlashInfer change and normal re-vendor.
- Evidence:
-
Affinity mask inheritance leaks from
flare-modelonto offload transfer, disk, and image-preparation threads, contradictingdocs/prefix-cache-offload.md.- Evidence:
helios/src/server/runtime.rs:568callsprefer_high_capacity_cpus()at the start of the"flare-model"thread. Later inside that same thread closure:helios/src/server/runtime.rs:698callscrate::offload::open(prepared, gpu_cubins)→helios/src/offload/mod.rs:109→flare_selene::offload::open(selene/src/offload.rs:645,653,663,676), which spawns the"flare-offload-{rank}"transfer threads (helios/src/offload/transfer.rs:509-536) and the"flare-offload-disk"checksum/direct-I/O thread (selene/src/disk.rs:358-370);helios/src/server/runtime.rs:720-721callsImagePreparation::new(worker_input_store)(helios/src/server/runtime.rs:1011), which spawns the image decoding/resizing worker thread.
- Because Linux
pthread_createinherits the parent thread's CPU affinity mask, all of these background CPU/I/O threads are silently confined to the same high-capacity P-cores reserved forflare-modelandflare-roce, preventing the scheduler from running checksums, offload transfers, and image preparation on the efficiency cores. - This directly contradicts
docs/prefix-cache-offload.md:863-867, which keeps offload transfer and disk threads onSCHED_BATCH+ positive nice across the full allowed cpuset to reduce contention with the model worker and states: "Adding CPU affinity requires a serving-latency measurement that shows a benefit." - Fix: Move the
prefer_high_capacity_cpus()call inhelios/src/server/runtime.rsto aftercrate::offload::openandImagePreparation::new(immediately beforeworker.run(&mut executor)at line 726), and add an explicitcrate::os::prefer_high_capacity_cpus()call inside the same-process TP peer threads (helios/src/execution/threaded.rs:655,"flare-rank-N"), which currently rely on implicit inheritance fromflare-modelviaRankExecutor::new(runtime.rs:585→helios/src/execution/ranks.rs:34-36). This keeps background offload/disk/image threads on the full process cpuset (preservingdocs/prefix-cache-offload.md:863-867) while explicitly pinning every critical execution thread.
- Evidence:
Should Fix
- Benchmark evidence omits baseline identification, reproduction commands, and the complete cold-prefill ladder (
AGENTS.md:103-112).- The GB10 measurements are substantive and the
+17.2%C8 64k decode result is appropriately labeled as a controlled same-server placement A/B. However, perAGENTS.md:103-112("Reproduction commands must identify the required inputs and configuration directly or through a precise reference") and the Charter ("benchmarks showing an actual speedup overmainon a served workload"):- State the exact baseline commit/binary for the 4 unpinned launches (confirming
mainvs PR on the same exported core) and how the same-server C8 A/B arm switched placement (e.g.,taskset -cp); - Include the concrete reproduction commands (Orbit launch flags, decode/prefill benchmark invocations, and the
nsys --cuda-graph-trace=nodecommand); - List the remaining 32k/64k/128k points of the 8k–128k cold-prefill ladder (the description quotes
+2.6%to+17.3%but only shows 8k+17.3%and 16k+9.2%, leaving where+2.6%occurred unstated).
- State the exact baseline commit/binary for the 4 unpinned launches (confirming
- The GB10 measurements are substantive and the
Subtract / Simplify
- Delete
pin_high_capacity_cpus()(helios/native/roce_proxy.c:1505-1570, −66 C lines) and pin the proxy from Rust aroundroce_start(helios/src/execution/roce.rs:295).- Eliminates the untested duplicate C implementation and removes the cross-repo coupling to FlashInfer PR #156 (resolving Blocker #1).
Nits
- Route Helios calls through
crate::os::and keepselect_high_capacity_cpusprivate (helios/src/os.rs:8,eos/src/unix.rs:172).- All existing Helios OS calls use
crate::os::*(helios/src/offload/transfer.rs:282,helios/src/runtime_core/protection.rs:356(not opened), etc.) rather thanflare_eos::*directly; switching the new Helios call sites tocrate::os::prefer_high_capacity_cpus()keeps them consistent. - Change
pub fn select_high_capacity_cpus(eos/src/unix.rs:172) tofn select_high_capacity_cpus. Becauseeos/src/lib.rs:12re-exportspub use unix::*;only on Unix andeos/src/windows.rsdefines no matching function, making this internal helper private keepsflare_eos's public API symmetric across platforms while keeping its unit tests intact.
- All existing Helios OS calls use
- Defer
prefer_high_capacity_cpus()past manifest validation inserve_rank(helios/src/execution/parallel.rs:539-550).serve_rankis apub unsafe fnthat currently narrows the caller thread's affinity at line 539 before rejecting invalid manifests at lines 540–550 (including in unit tests such ashelios/src/execution/parallel/tests.rs:698(not opened)). Moving the call below validation (and adding one line to the doc comment noting the thread-affinity adjustment) avoids mutating caller affinity on rejected inputs.
Verified passes
- Selection arithmetic and bounds safety (
eos/src/unix.rs:172-245):u64::from(cap)widening prevents overflow in both the 90% and midpoint comparisons;selected.len() >= 2 && selected.len() < allowed_with_capacity.len()guarantees no single-core collapse and strict no-op on homogeneous or single-tier cpusets;0..size_of::<cpu_set_t>() * 8matchesCPU_ISSET/CPU_SETbounds. - Operator cpusets preserved:
nextis constructed strictly from CPUs already set insched_getaffinity(0, ...), so operatortaskset/cgroup/systemd cpusets are never widened and single-tier cpusets are untouched. - No ABI, Protobuf, core-format, or env-var regressions: Proxy ABI stays 14 (
helios/src/execution/roce.rs:23), no environment variables are read (AGENTS.md:449-452), no per-model branches are introduced, andeos/src/windows.rs:220+eos/src/unix.rs:247-248preserve cross-platform compilation. - Unit tests (
eos/src/unix.rs:254-314): Cleanly verify GB10 two-tier (718–731vs997–1024), homogeneous, efficiency-only, performance-only, single-CPU, zero-capacity, and three-tier topologies.
Dropped on verification
- Upstream B1 (Default-on unconfigurable heuristic / magic 90% constant / no arch guard): Refuted —
eos/src/unix.rs:67-101already uses default-on best-effort OS scheduling/advisory hints (lower_prioritywithSCHED_BATCH,release_page_cache,MADV_HUGEPAGE,raise_open_file_limit),AGENTS.md:188-190discourages unnecessary configuration switches, operator cpusets are strictly preserved, and relying on the kernel's topology-agnosticcpu_capacitysysfs ABI without hardcodingtarget_archis sound. - Upstream S2 (Silent failure /
let _ = sched_setaffinity/ "unfalsifiable in field"): Refuted — returning()matcheslower_priorityandrelease_page_cacheineos/src/unix.rs:67-83, bailing out on unreadablecpu_capacityis the safe no-op contract for x86_64/hotplug races, and live thread affinity is directly observable via/proc/<pid>/task/<tid>/status,taskset, andps. - Upstream S3 (Untested syscall wrapper in
eos/src/unix.rs): Dropped as a standalone Should Fix — the untested 66-line C duplicate is eliminated by Blocker #1, while the 28-line Rust glue ineos/src/unix.rs:216-245is clean and its selection logic is covered by three unit tests (unix.rs:254-314). - Upstream S4 (Python callers reuse the thread after
serve_rank): Refuted for production callers — bothignition/preparation/host_ranks.py:701-720andignition/preparation/rank_group.py:119-140immediately close resources and exit afterserve_rankreturns; only the pre-validation call ordering and doc note remain as Nit #2. - Value Prop #4 (Rewrite
docs/prefix-cache-offload.md:863-867as a repo-wide affinity gate): Refuted —docs/prefix-cache-offload.md:863-867specifically governs offload transfer and disk threads; fixing Blocker #2 so those threads do not inherit the narrowed mask keeps the existing doc accurate without edits. - Upstream SUB1 (Delete 10-line three-tier midpoint fallback and its test): Dropped — 10 lines of pure, zero-overhead defensive Rust with a valid unit test (
eos/src/unix.rs:195-204,298-314) is neither dead code nor substantial duplication. - Upstream SUB2 (Delete
worker.rsandreplay.rscall sites): Dropped — only 4 net lines, andExecutionWorkerbacksflare_heliopause.GraphExecutor(heliopause/src/python.rs:360-414), which drivesignition benchand qualification on GB10 where consistent P-core placement is beneficial. - Upstream N1 sub-items ("redundant"
#[cfg(not(target_os = "linux"))]arm ineos/src/unix.rs:247-248, placement ineos/): Refuted —unix.rscompiles on allcfg(unix)targets (including macOS/BSD) wheresched_getaffinityis absent, so:247-248is disjoint fromwindows.rs:220and required for non-Linux Unix builds;eos/is the designated host-OS crate perAGENTS.md:20-21. - Upstream N2 (Doc comments disagree with code /
performance_onlytest passes for wrong reason): Refuted —eos/src/unix.rs:196-197,212-214accurately describe the behavior, andperformance_only(997/1017/1024) passes for the right reason (all CPUs clear the 90% band, soselected.len() == allowed_with_capacity.len()returnsNone). - Upstream N3 ("more than an order of magnitude" vs
61×): Dropped —61×is more than an order of magnitude; the omitted cold-prefill points are folded into Should Fix #1. - Upstream N4 (8 KiB stack arrays in C & sysfs page-cache misses): Dropped — the C stack arrays vanish with Blocker #1, and
sysfsreads are virtual kernfs reads once at thread startup, not disk page-cache misses.