#1 [high] Should fix: RoCE proxy duplicates the Rust selector in C, and vendored-file identity rule
helios/native/roce_proxy.c:1505-1570 (new pin_high_capacity_cpus) is a line-for-line reimplementation of eos/src/unix.rs:172-245 (select_high_capacity_cpus + prefer_high_capacity_cpus): same sysfs path, same 10%/90% threshold, same midpoint fallback, same "selected>=2 && selected<count" gate, same abort-on-any-unreadable-capacity. Two copies of one policy in two languages, no shared source and no test on the C copy, so the thresholds (u64::from(cap)10 >= max9; cap*2 > min+max) must be edited in two places.
Established precedent: eos/ is the single home for host OS operations shared by Helios and Selene (AGENTS.md lines 20-22: "The eos/ crate holds the host operating-system operations that Helios and Selene use"); helios/src/os.rs:8 is only pub(crate) use flare_eos::*.
Second convention broken: the file preamble (roce_proxy.c:6-8) says "Vendored from FlashInfer's pinned preparation dependency ... Keep the source below identical so preparation and serving share the transport ABI", NOTICE:18-19 states "Its implementation is unchanged from that revision; Flare adds a license and provenance preamble", and docs/roce-ring.md:361-364 says "keep the vendored source identical to the dependency after its provenance header". The new #ifdef linux block (plus pthread_setname_np(..., "flare-roce") at :1575) is a Flare-local behavioural addition with no marker distinguishing it from upstream, so the next parity check (docs/TODO.txt:80-86 "Restore preparation/serving RoCE proxy parity") cannot tell vendored from local. Fix: either move the policy into a shared header/source compiled for both, or (minimum) mark the block as a Flare addition and record the divergence where the parity procedure is specified.
#4 [high] Research summary
Reviewed all seven changed files in context through the conventions-and-duplication lens, against AGENTS.md, docs/design-review.md, docs/roce-ring.md, NOTICE and the existing eos/Helios precedents.
Main finding (should fix): helios/native/roce_proxy.c:1505-1570 reimplements eos/src/unix.rs:172-245 line for line — same sysfs path, same 90% threshold, same midpoint fallback, same safety gate — so one policy now lives in two languages with no shared source and tests only on the Rust copy. It also breaks the repository's stated rule for that file: roce_proxy.c:6-8, NOTICE:18-19 and docs/roce-ring.md:361-364 all require the vendored proxy to stay identical to the pinned FlashInfer source after its provenance header, and the new behaviour (plus the "flare-roce" thread name) is not marked as a Flare-local divergence.
Secondary (nit): the eos API shape departs from the only precedent for per-thread scheduling changes, lower_priority(nice) (eos/src/unix.rs:77-83 / windows.rs:160-164, wired through helios/src/offload/transfer.rs:280-283,531) — it hardwires the policy, returns (), discards sched_setaffinity's error, and adds a dead #[cfg(not(target_os = "linux"))] stub duplicating windows.rs:219-220; and no design/operating doc records the new affinity policy while docs/prefix-cache-offload.md:863-867 sets a measurement/documentation bar for CPU affinity.
I verified that the four new call sites follow the existing "flare-" thread-name and spawn-then-configure conventions, and recorded as a coverage note (not a finding) that the in-process "flare-rank-" threads (helios/src/execution/threaded.rs:652-654) get no call.
#5 [high] Report skeleton: findings list with severity, file:line, fix, and cleared candidates
CONFIRMED FINDINGS (2; none blocking)
-
Should fix — helios/native/roce_proxy.c:1505-1570 (and :1572-1577). What: new static
pin_high_capacity_cpus()duplicates eos/src/unix.rs:172-245 (select_high_capacity_cpus+prefer_high_capacity_cpus) element for element — same/sys/devices/system/cpu/cpu<N>/cpu_capacitypath (:1526 vs unix.rs:227), samecap*10 >= max*9threshold (:1550 vs unix.rs:192), same midpoint fallbackcap*2 > min+max(:1560 vs unix.rs:201), sameselected>=2 && selected<countgate (:1566 vs unix.rs:205), same give-up-on-first-unreadable-capacity (:1528-1536 vs unix.rs:228-233). Why it matters (a) duplication: AGENTS.md lines 20-22 make eos/ the single home for host OS operations used by Helios and Selene ("Theeos/crate holds the host operating-system operations that Helios and Selene use"); helios/src/os.rs:8 is nothing butpub(crate) use flare_eos::*;. Any future change to the threshold, the fallback, or the sysfs path must now be made twice, in two languages, and the twelve eos tests (unix.rs:254-314) cover only the Rust copy; the C copy is compiled only under--features roce(helios/build.rs:67-76). (b) vendored-file rule: roce_proxy.c:6-8 ("Keep the source below identical so preparation and serving share the transport ABI"), NOTICE:18-19 ("Its implementation is unchanged from that revision; Flare adds a license and provenance preamble") and docs/roce-ring.md:361-364 ("keep the vendored source identical to the dependency after its provenance header") are all contradicted by an unmarked Flare-local behaviour block, and the same block addspthread_setname_np(..., "flare-roce")at :1575; docs/TODO.txt:80-86 tracks restoring preparation/serving proxy parity, which this makes harder. Fix: put the selection policy in one place compiled for both consumers (shared header/source), or at minimum delimit the block as a Flare addition and record the divergence where the parity procedure is specified (docs/roce-ring.md:355-364) and in the provenance header at roce_proxy.c:6-8. -
Nit — eos/src/unix.rs:212-248 (API shape), plus docs. What:
prefer_high_capacity_cpus()hardwires the 90%/midpoint policy, returns()and silently drops every failure includingsched_setaffinity's (:244let _ =); it adds a#[cfg(not(target_os = "linux"))]stub (:247-248) that is dead today because eos/src/lib.rs:9-16 already splits unix/windows and android-free unix targets, and whose text repeats windows.rs:219-220. Precedent:lower_priority(nice)— eos/src/unix.rs:77-83 parameterised, eos/src/windows.rs:160-164 its stub, wired by its callers through thecrate::os::shim at helios/src/offload/transfer.rs:280-283 and called at :531 inside the spawned thread; neighbouring eos helpers report outcome (free_spaceunix.rs:116 returns io::Result,raise_open_file_limit:138 returns Option). Also docs convention: docs/prefix-cache-offload.md:863-867 states that adding CPU affinity "requires a serving-latency measurement that shows a benefit"; the PR supplies measurements in its description, but no design/operating document (docs/operating.md, docs/roce-ring.md) records the new thread-affinity policy or the X925-only placement as a qualified configuration. Fix: give the helper a parameter or return the chosen subset, at least report thesched_setaffinityfailure, drop the redundant third cfg arm, and add the policy to the operating/roce-ring docs.
CHECKED AND CLEARED (do not report as findings)
- Call sites follow existing conventions: worker.rs:68-71 ("flare-execution"), replay.rs:171-176 ("flare-cuda"), runtime.rs:565-568 ("flare-model"), parallel.rs:539 (serve_rank, called from flare-cli/src/main.rs:559-561 and heliopause/src/python.rs:548) all match the existing name-then-configure pattern of helios/src/offload/transfer.rs:509-531.
- The new name "flare-roce" fits the existing "flare-*" scheme (server.rs:342, dashboard.rs:113, replay.rs:172, worker.rs:69, runtime.rs:566).
- No other pre-existing CPU-affinity helper exists to reuse: the only tree-wide hits for sched_getaffinity/sched_setaffinity are this PR's two copies, ignition/preparation/host_memory.py:31 (worker budget, different purpose) and the seccomp allowlist selene-manager/deploy/seccomp-io-uring.json:309,317;
available_parallelismuses (frontend/mod.rs:333-337 etc.) are thread-budget counts, not affinity. - Coverage note only (scope is defensible): in-process TP peer threads named "flare-rank-{n}" at helios/src/execution/threaded.rs:652-654 do the same launch work as "flare-execution" but get no call; all ranks share one process and one mask.
- Untested-in-repo claim to state in the report: only eos unit tests exercise the selector; the C copy has none and the windows stub is compile-only (PR caveat agrees).
#2 [medium] Nit: eos API shape departs from the existing eos helper conventions
Observed in the diff (eos/src/unix.rs:212-248, helios/native/roce_proxy.c:1505-1570). Under this lens as a conventions/duplication point only (behaviour is other reviewers' lens):
- The module conventions the change departs from: the only precedent for "restrict the calling thread's scheduling" is eos/src/unix.rs:77-83
lower_priority(nice)/ eos/src/windows.rs:160-164, which is (a) parameterised (nice: i32) rather than a hardwired policy, and (b) wired by its callers at helios/src/offload/transfer.rs:280-283+531 via thecrate::os::shim, called inside the spawned thread after the worker opens its resources (transfer.rs:512-531).prefer_high_capacity_cpus()hardwires the 90%/midpoint policy into the OS layer with no parameter, so a second consumer that wants a different rule (or a caller that wants "report the chosen subset") cannot reuse it; it returns()and swallows every failure (unix.rs:228-233 returns silently, :244 discards the sched_setaffinity result) where the neighbouring eos helpers returnOption/io::Result(raise_open_file_limit:138, free_space:116). - The
#[cfg(not(target_os = "linux"))]arm at unix.rs:247-248 duplicates the windows.rs:219-220 stub. eos/src/lib.rs:9-16 already splits unix/windows at the module export, and windows.rs is compiled only on Windows, so today the new unix.rs arm is dead and the two stubs are textually identical. Precedent for the split islower_priority(unix.rs:77 / windows.rs:160) with no third arm. - Docs convention: docs/prefix-cache-offload.md:863-867 states that adding CPU affinity "requires a serving-latency measurement that shows a benefit" and that priority-based interference control is SCHED_BATCH + nice. This PR does carry measurements in the description, but no design/operating doc (docs/operating.md, docs/roce-ring.md) records the new thread-affinity policy or names CPU 5-9/15-19 placement as a qualified configuration, unlike how other runtime policy is documented.
#3 [medium] Verified: new call sites follow the existing thread-naming/spawn conventions
Checked each new call site against how Helios names and configures its critical threads:
- worker.rs:68-71, replay.rs:171-176, runtime.rs:565-568 are one-line insertions at the top of existing named threads ("flare-execution", "flare-cuda", "flare-model"); they follow the existing naming convention and the spawn-then-configure pattern of helios/src/offload/transfer.rs:509-531.
- parallel.rs:539 calls it at the top of
serve_rank(the per-process peer-rank entry, called from flare-cli/src/main.rs:559-561 and heliopause/src/python.rs:548), which follows the same convention. - Gap in the same convention: the in-process TP peer threads are named "flare-rank-{n}" at helios/src/execution/threaded.rs:652-654 and do the same GPU launch work as "flare-execution", but get no call. That is defensible (all ranks share one process and one affinity mask, and the machine has 20 cores for 5 busy threads) — recording it as a coverage note for the completeness lens rather than a finding.
- The C thread name "flare-roce" (roce_proxy.c:1575) matches the existing "flare-*" naming, but no other Rust-side thread sets its name via pthread_setname_np; the C addition is the only place in the tree, so it cannot drift from a precedent.
- Duplication of the twelve-line C helper with tests only on the Rust copy: eos/src/unix.rs:254-314 covers two-tier, homogeneous, single-tier, zero-capacity and three-tier cases; the C copy has no test and is compiled only under
--features roce(helios/build.rs:67-76).