Architecture and scope review — PR #576 "Pin Helios execution and RoCE proxy threads to high-capacity CPUs on asymmetric Linux topologies"
Key findings
- Blocking — an unconfigurable, default-on host-scheduling policy with a magic threshold is installed in the shared
eoscrate and the vendored proxy.prefer_high_capacity_cpusrestricts every Linux serving build's critical threads tocapacity*10 >= max*9with no configuration home, no way to disable it, and an undocumented midpoint fallback. This is exactly what the charter's "Be explicit and pin everything. No magic defaults",AGENTS.md's three-homes rule for settings, andAGENTS.md's "reject unsupported abstractions and churn" rule prohibit. The policy is also implemented twice (Rust and C) and must be kept in sync by hand. - Blocking — there is no measurement of this branch against
main. Every claimed number compares CPU placements within the change (X925-placed vs A725-placed launches of the same tree), not pinned-vs-unpinned or main-vs-head withflare runon the same exported core, which is what the charter and design-review principle 12 require. - Should fix — silent error suppression in both implementations (
returnon the first unreadable sysfs file, ignoredsched_setaffinityresults), which makes the claimed no-op semantics unverifiable and violates "Do not ... suppress errors". - Should fix — a persistent, undocumented side effect on the public
serve_rankentry point used by the peer-rank serving path. - Should fix — no test covers the function that actually touches the system (
prefer_high_capacity_cpus) or the entire C helper; only the pure selector is tested. - Nits — placement in
eos/rather than a Helios module, doc-comment/behaviour mismatches in the fallback logic, one sysfs open per allowed CPU on the startup path (also paid by ranks that are rejected immediately), and an unrelated thread-name change bundled into the same hunk.
Nothing in my lens is a correctness or compatibility problem: the change adds no environment variable, no Protobuf field, no core-contract or ABI change, and its new mask is a subset of the thread's existing affinity, so operator cpusets are preserved.
Blocking
B1. Blanket, unconfigurable affinity default with a magic 90% constant in the serving path
Files: eos/src/unix.rs:172-245 (select_high_capacity_cpus, prefer_high_capacity_cpus), eos/src/windows.rs:220, helios/native/roce_proxy.c:1505-1570 (pin_high_capacity_cpus), call sites helios/src/execution/parallel.rs:539, helios/src/execution/worker.rs:71, helios/src/replay.rs:174, helios/src/server/runtime.rs:568, helios/native/roce_proxy.c:1576.
What is wrong. The PR installs one hard-coded host scheduling policy into the default serving path of every Linux build: model, peer-rank, execution, replay, and RoCE proxy threads are narrowed to the set selected by the rule cap * 10 >= max_cap * 9 (eos/src/unix.rs:192, mirrored at roce_proxy.c:1550), with a second, different rule (cap * 2 > min + max, eos/src/unix.rs:198-203, roce_proxy.c:1558-1564) when the first selects fewer than two CPUs. Nothing in the recipe declaration, configuration file, or CLI selects this behaviour, and nothing can select it off. The Rust function has no parameters, no return value, and no error path; it is simply invoked at thread start.
Why it matters (rules cited).
- Charter, How We Work: "Be explicit and pin everything. No magic defaults". A capacity threshold of 90% of the maximum and a 50% midpoint fallback are precisely magic numbers, and they decide which cores a latency-critical serving thread is allowed to use on every ARM Linux launch.
AGENTS.md:453-457: "A setting has one of three homes: the recipe declaration, the configuration file, or a command-line flag." This is a setting with none of the three. The PR's own justification inverts the rule: it advertises "without environment variables, systemd overrides" as a virtue, but the only way an operator can override the code-level default is an externaltaskset/systemd cpuset — the operator is handed the workaround for a policy the code chose silently.AGENTS.md:188-193: "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement." The midpoint fallback is a fallback layer motivated by a topology (three-tier prime/big/little) that the PR has not demonstrated on any named supported host — the description's only hardware is GB10, which is two-tier, and the three-tier case appears only in a unit test (eos/src/unix.rs:298-314).docs/design-review.md:89-92(principle 10, Use explicit configuration): "Settings belong in recipe declarations, configuration files, or CLI flags; explicit user values win over defaults." Here there is no user value at all.- The repository's only prior statement on thread CPU affinity,
docs/prefix-cache-offload.md:863-867, admits affinity only per thread and only with evidence: offload threads stay onSCHED_BATCHand "Adding CPU affinity requires a serving-latency measurement that shows a benefit." The PR does bring measurements for the threads it pins (see B2 for why they are insufficient), but it does so as a blanket default for the whole runtime and the vendored proxy, not as an evidenced, scoped decision.
Secondary defect of the same change: the same ~60-line heuristic now exists twice, in Rust (eos/src/unix.rs:172-210) and in C (roce_proxy.c:1510-1569), with two threshold expressions, two CPU_SETSIZE loops, and two copies of the fallback. They must be kept in sync by hand across two build systems; any future fix to one is a latent divergence in the other.
Fix. Either (a) make it an explicit setting with one of the three sanctioned homes — a CLI flag on flare run/Helios carried into the runtime, or a typed config field — stating the CPU set the operator wants (an explicit set is also easier to reason about than a capacity heuristic, and removes the magic constant and the midpoint fallback), or (b) drop the code change and document the taskset/systemd-cpuset recommendation in the multi-host or runtime-core design doc. If a heuristic is to survive at all, the threshold and the fallback must be justified by named hardware and stated in the docs, not embedded as literals. A default-on heuristic cannot be justified by "no environment variables are introduced".
B2. Performance claims have no main-vs-head baseline
Files/claims: PR description, "Claimed Benefit" and "Supporting Evidence" sections.
What is wrong. No measurement of this branch against main is reported. Every number compares CPU placements within the change on the same tree:
- "Controlled A/B on the same live server": Cortex-X925 placement
144.88 tok/svs Cortex-A725123.66 tok/s— a comparison of where the OS happened to place threads, not pinned-vs-unpinned, and not head-vs-main. - "48/48 vs 4/4" placement counts,
batch=1, width=8graph-time CV4.82% → 0.72%,batch=1, width=1CV1.50% → 1.07%,RoceOneshotLaunch2.77 → 1.91 ms, verify p90 wake gap1,880.3 µs → 30.9 µs, cold prefill+2.6% … +17.3%— all described as pinned vs unpinned launches on 4× DGX Spark. None is aflare runof the same exported core onmainversus on this head. - Also unstated: how many launches each arm used and their spread for the headline CV figures; whether both arms used the identical exported core (the description mentions "same core, no re-export" for the cold-prefill experiment only); and that the served workload is "Inkling 2 Small NVFP4", a recipe that lives in
local-inference-lab/hyperflare-recipes, not in this repository (AGENTS.md:9-16), so the serving path is not reproducible from this repo alone.
Why it matters (rules cited).
- Charter, How We Work: "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)." docs/design-review.md:106-114(principle 12): "Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements. Comparisons against other runtimes must use exported cores withflare run… keep raw measurements and disclose unrun checks and material limitations."AGENTS.md:165-169(contribution must address a "measured performance … problem") andAGENTS.md:194-199(validation must exercise the affected behavior and "identify missing hardware, inputs, and unrun checks explicitly").
The measurements are substantial and appear honestly reported for what they are (placement effect on one host family, with x86_64 explicitly declared a no-op path), and that honesty is worth acknowledging. But under this project's standard, "placement A is faster than placement B on my branch" does not establish that merging the change improves main, and it does not show what the change costs. A default-on affinity mask also has a cost the description never measures: threads that were previously free to migrate across 20 CPUs are now confined to 10, and while the proxy is idle it still naps on a restricted CPU set alongside the model thread (roce_proxy.c:1578-1585).
Fix. Report a paired comparison of main and this head on the same host with the same exported core via flare run, with launch counts and dispersion, and state the recipe/core identity and configuration. If the intent is only to demonstrate the placement effect, then the change should not be a default — see B1.
Should fix
S1. Silent failure paths make the documented no-op semantics unverifiable and suppress errors
Files: eos/src/unix.rs:218-222, 228-233, 244; helios/native/roce_proxy.c:1513-1515, 1528-1536, 1567.
prefer_high_capacity_cpus bails out of the whole computation on the first CPU whose cpu_capacity cannot be read or parsed (unix.rs:228-233: let Ok(text) = … else { return; }, same for the parse), and the C helper does the same (roce_proxy.c:1528-1530, 1534-1536). Both ignore the final sched_setaffinity result (unix.rs:244 let _ =; roce_proxy.c:1567 (void)). The doc comment and the PR description claim a no-op "when cpu_capacity is absent, unreadable, zero, homogeneous" — but the whole file is skipped silently, including the readable CPUs, and a failed sched_setaffinity (for example under a seccomp or container restriction on sched_setaffinity) leaves the thread on the full mask with no diagnostic whatsoever. There is no way to tell from a serving log whether the policy applied, which also makes B2's placement claims untestable in the field.
AGENTS.md:182-186 explicitly rejects weakened guarantees: "Do not remove validation, suppress errors, silently substitute execution paths…". The charter adds: "Bug fixes need to address the root cause; don't just swallow, skip, or retry an unexplained error (#397)."
Fix. Either treat the "no policy" case as a deliberate decision and emit one startup diagnostic line (the pattern the repository already uses for WFET parking, see #280), or return a Result/status so callers and tests can observe whether the mask was applied. Do not merge with let _ =.
S2. A public API's contract now includes a persistent thread-affinity side effect
Files: helios/src/execution/parallel.rs:527-539 (serve_rank, exported at helios/src/execution.rs:25 (not opened)), callers flare-cli/src/main.rs:560 and heliopause/src/python.rs:548.
serve_rank is public API, documented only in terms of resource lifetime (parallel.rs:527-532), and reached from flare-cli's serve_peer and from the Python qualification path via heliopause (py.detach(|| … serve_rank(…)), heliopause/src/python.rs:548). After this PR the first statement of the function permanently narrows the calling thread's CPU affinity (parallel.rs:539), before the persistent-worker rejection (540-547) and before manifest.validate() (548). Two consequences worth stating in the contract: (a) an embedding caller that reuses that thread for other work (notably the Python path, where the calling thread returns to general use after py.detach) inherits a narrowed mask it never asked for; (b) ranks that are rejected immediately still pay the probe. AGENTS.md:194-199 requires the problem and resulting behaviour to be described, and the charter's "solve the right problem in the right place" applies: if placement is a serving decision, it belongs where serving is started, with the decision visible, not buried in a library entry point documented only for resource lifetime.
Fix. Document the affinity side effect in serve_rank's doc comment, and move the call after validation (or into the caller) so it is a deliberate action of the process that owns the serving thread. If B1 is resolved by an explicit setting, this becomes moot because the call takes an argument.
S3. The only code that touches the system is untested, and the untested arm is the latency-critical one
Files: eos/src/unix.rs:254-314 (tests), helios/native/roce_proxy.c:1510-1569 (no test), eos/src/windows.rs:220 (never compiled, per the description).
The four new unit tests exercise only select_high_capacity_cpus, the pure selector: the GB10 two-tier split, homogeneous/single-tier/zero-capacity no-ops, and the three-tier fallback. prefer_high_capacity_cpus itself — sysfs enumeration, sched_getaffinity, sched_setaffinity — has no test at any layer, and the entire pin_high_capacity_cpus C helper has no test and is only claimed to have been exercised implicitly on GB10 by 6 launches and a soak. That is the function the PR blames for its headline effect (the flare-roce proxy thread). AGENTS.md:194-199: "Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness… Identify missing hardware, inputs, and unrun checks explicitly." The description does disclose the Windows gap, which is to its credit, but not the C gap as a gap.
A test is feasible without a GB10: factor the sysfs root into a parameter (or read capacities through a small injectable function) and assert the mask applied to the calling thread with sched_getaffinity, plus a negative case with a synthetic three-tier root. The C helper could at minimum be exercised by a host-side test that sets its own affinity and reads it back.
Fix. Add a test for prefer_high_capacity_cpus that verifies the applied mask and the no-op path, and either add a host-side test for the C helper or state plainly in the PR that the C path is unverified by any automated check.
Nits
-
Placement of the policy.
AGENTS.md:20-21defineseos/as "the host operating-system operations that Helios and Selene use", exported wholesale (eos/src/lib.rs:10-16,pub use unix::*). A serving-affinity policy is not a generic host OS operation and is now inherited by Selene and anything else linkingeos. A Helios module would express the same behaviour, keep the scope visible, and remove thewindows.rsstub (eos/src/windows.rs:220) entirely. -
Doc comment does not match the code, and one test passes for the wrong reason.
eos/src/unix.rs:195-197says the midpoint fallback exists to "Avoid collapsing multiple busy threads onto a single prime core", but if the high tier contains exactly one CPU the fallback can still select just that one CPU and then returnNoneat line 205. Likewise the "already restricted to one tier is a no-op" claim is enforced byselected.len() < allowed_with_capacity.len()at line 205, not by themin_cap == max_capcheck at line 185 — which is why theperformance_onlycase atunix.rs:287-292passes, despite being a set with two distinct capacities (997…1024). The comment and the tests should name the actual mechanism. -
Cost paid before validation.
prefer_high_capacity_cpusopens one sysfs file per allowed CPU (20 opens on GB10) in the first statement of each thread's closure (worker.rs:71,replay.rs:174,runtime.rs:568,parallel.rs:539), before any manifest validation or rejection check;runtime.rs:568precedes the host-prefix-store check at569-581, andparallel.rs:539precedes the persistent-worker rejection at540. Cheap in absolute terms, but it is work done on the startup path for ranks that are about to fail. -
Unrelated change in the same hunk.
roce_proxy.c:1575addspthread_setname_np(…, "flare-roce"), which is a debugging improvement with no relation to the pinning policy; it is described in the PR body but is bundled into the same#ifdef __linux__block.AGENTS.md:194-199asks for one coherent outcome per PR. (The name itself is fine and matches theflare-*convention of the Rust threads.) -
C helper's stack footprint.
roce_proxy.c:1516-1517allocatesint cpus[CPU_SETSIZE]anduint32_t caps[CPU_SETSIZE](8 KiB withCPU_SETSIZE1024) on the proxy thread's stack; harmless here but worth noting if the policy is kept andCPU_SETSIZEgrows.
Verified as fine (no finding)
- No configuration-surface violation via the environment. No environment variable is read anywhere in the diff;
AGENTS.md:449-452is respected in letter. - No compatibility break. No Protobuf field, no recipe or model-contract change, no transport ABI change — the proxy ABI remains 14 (
roce_proxy.c:134), existing exported cores load and serve unchanged, and the new mask is a strict subset of the thread's currentsched_getaffinity, so operator cpusets and cgroups are honoured (eos/src/unix.rs:218-244,roce_proxy.c:1513-1567).docs/design-review.md:116-123(core compatibility) is satisfied. - Model-agnostic. No per-model branch, alias, or flag is added;
docs/design-review.mdprinciple 1 and the charter's "Keep the runtime small and model-agnostic" are not violated by the mechanism itself, only by its default-on, unconfigurable nature (B1). - Honest limitation reporting. The description discloses the x86_64 no-op path and the uncompiled Windows stub, which is what
AGENTS.md:194-199and principle 12 ask for; the gap is that the missing evidence is amain-vs-head baseline (B2), not that the limitations were hidden.
Open questions and what could not be found
- Is there a maintainer request behind this? I could not find an issue or maintainer statement authorizing CPU-affinity policy in Helios or in the vendored proxy; the related items in the local index (#577, #575, #574 — same author; #280 WFET parking; #556 DispatchRing) do not cover it.
AGENTS.md:165-169and:201-206require an explicit maintainer request for a change of this kind; if one exists it should be linked, since it would also likely settle B1's shape (flag vs documented recommendation). - Was the served dependency branch-identical? Only the cold-prefill experiment states "same core, no re-export". Whether the CV and tok/s figures compare the same exported core across arms cannot be determined from the description; a paired
flare runonmainand this head (per B2) would settle it. - Does the policy help or hurt on a homogeneous 20-core host or a many-core Xeon/EPYC server when someone exposes
cpu_capacity(for example a manually built kernel or a container image with a mounted sysfs)? The description calls x86_64 a guaranteed no-op, but that rests on the kernel not exposing the file, not on a guard in the code.eos/src/unix.rs:237would happily narrow a 128-core EPYC to whatever CPUs sit within 90% of its maximum. This is a consequence of B1's lack of configuration, and only a test on such a host (or the explicit-setting fix) would settle it. - No review comments or CI results exist on the head commit (0 reviews, no checks), so there is no repository-side discussion to weigh against this analysis.
Recommendation
Request changes. The mechanism is small, well-contained, and demonstrably effective at the placement effect it targets, and the author has been candid about host coverage. But as submitted it makes a magic-numbered host-scheduling decision for every Linux deployment with no configuration home (AGENTS.md:453-457, charter "No magic defaults"), duplicates the policy in Rust and C, suppresses the errors that would let anyone verify it (AGENTS.md:182-186), and backs it with measurements that never compare against main (charter "Bring real evidence", docs/design-review.md:106-114). The cleanest resolution is an explicit, operator-supplied affinity setting (or documentation of the cpuset recommendation), with a paired main-vs-head measurement and one test that covers the sysfs/sched_setaffinity path.