Architecture scratchpad · NVIDIA/hyperflare-inference #576

Raw Markdown for agents: https://autobot.eidonix.com/p/3ae366cf-4f2c-412c-a2c1-278d1c7442ac.md

#1 [high] Rules: charter + AGENTS + design-review excerpts relevant to lens

PR #576 "Pin Helios execution and RoCE proxy threads to high-capacity CPUs on asymmetric Linux topologies" (fork: fordbmorris, head 4b41ddc, 7 files +226/-1).

Charter (NVIDIA/hyperflare-inference):

AGENTS.md:

#2 [high] PR 576 diff summary (all 7 files)

eos/src/unix.rs (+145): new pub fn select_high_capacity_cpus(&[(usize,u32)]) -> Option<Vec> (threshold cap10 >= max9; fallback cap*2 > min+max; returns None when <2 cpus, any cap==0, min==max, or selected>=len); new pub fn prefer_high_capacity_cpus() cfg(target_os="linux") reading sched_getaffinity then /sys/devices/system/cpu/cpu/cpu_capacity for each allowed cpu (returns early on any read/parse failure), then sched_setaffinity with let _ = (error ignored). Plus 3 unit tests (gb10 tiers, homogeneous/single-tier/zero caps no-op, three-tier avoid collapse). eos/src/windows.rs (+3): no-op stub pub fn prefer_high_capacity_cpus() {}. helios/native/roce_proxy.c (+71): #ifdef linux static pin_high_capacity_cpus() re-implementing same policy in C (CPU_SETSIZE arrays, fopen/fscanf per allowed cpu, 90% threshold, midpoint fallback, sched_setaffinity result ignored); called at top of proxy_main together with pthread_setname_np(pthread_self(), "flare-roce"). helios/src/execution/parallel.rs (+1): prefer_high_capacity_cpus() first line of pub unsafe fn serve_rank(manifest, ..., rank, world). helios/src/execution/worker.rs (+1): first stmt inside spawn closure of "flare-execution" thread. helios/src/replay.rs (+4/-1): wraps run(...) in closure calling prefer_high_capacity_cpus() first; thread name "flare-cuda". helios/src/server/runtime.rs (+1): first stmt inside spawn closure of "flare-model" thread.

#3 [high] Blocking: unrequested, unconfigurable host-scheduling default (magic 90% constant) in the serving path

Severity: blocking.

eos/src/unix.rs:212-248 (prefer_high_capacity_cpus) and helios/native/roce_proxy.c:1504-1570 (pin_high_capacity_cpus) install one hard-coded host scheduling policy into the default serving path of every Linux build: threads are restricted to CPUs with capacity*10 >= max*9 (Rust eos/src/unix.rs:192, C roce_proxy.c:1547), with an undocumented midpoint fallback (unix.rs:195-204), no configuration input, and no way to turn it off.

Rules it breaks:

Fix: make it an explicit setting (config file / CLI flag carried into Helios, per AGENTS.md l.452-457) with the CPU set stated by the operator, or drop the change and document the taskset/systemd cpuset recommendation in docs/multi-host.md or docs/runtime-core-design.md. A default-on heuristic cannot be justified by "no environment variables are introduced".

#4 [high] Blocking: performance claims have no main-vs-head baseline as the charter requires

Severity: blocking.

No measurement of this branch against main is reported. Every number in the description compares CPU placements within the change:

Rules: charter "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)"; AGENTS.md l.165-169; docs/design-review.md principle 12 ("Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements").

Also unstated: whether both arms used the same exported core (the description mentions "Cold prefill (same core, no re-export)" for one experiment only), how many launches and their spread for the headline CV numbers, and that the workload uses "Inkling 2 Small NVFP4", a recipe that lives outside this repository (AGENTS.md l.9-13, local-inference-lab/hyperflare-recipes), so the serving path is not reproducible from this repo alone.

Fix: report a paired flare run comparison of main vs head on the same exported core and host, with run counts, and state the recipe/core identity and configuration.

#5 [high] Should fix / Nit: silent failure paths, untested C helper, public-API side effect, eos placement

Smaller verified items.

  1. Should fix — error handling is silent in both implementations:

    • eos/src/unix.rs:228-233: let Ok(text) = std::fs::read_to_string(&path) else { return; } and the parse else { return; } abort the whole selection on the first unreadable/invalid cpu; helios/native/roce_proxy.c:1513-1520 return; does the same, and roce_proxy.c:1567 ignores sched_setaffinity's result, as does unix.rs:244 (let _ =). A partial failure leaves the thread on the full mask with no diagnostic, while the PR claims "no-op when cpu_capacity is absent, unreadable, zero". AGENTS.md l.182-186 "Do not ... suppress errors". Fix: treat an unreadable CPU as "no policy" deliberately and log once (a single startup line, as #280 does with "frame completion wait: WFET"), or propagate the failure.
    • The per-CPU loop does one file open per allowed CPU at thread start (20 opens on GB10) on the latency-critical startup path, and prefer_high_capacity_cpus is called before the thread validates anything (parallel.rs:539 precedes the persistent-worker rejection and manifest.validate(); runtime.rs:568 precedes the offload/rank checks), so rejected ranks still pay it.
    • Silent behavior change for a diagnostic caller: serve_rank is public API (helios/src/execution.rs:25), used by flare-cli/src/main.rs:560 and heliopause/src/python.rs:548 for the diagnostic qualification path (docs/same-process-tp.md:128-134). It now permanently narrows the calling thread's affinity as a side effect, though its contract (parallel.rs:527-533) documents only resource lifetime. Needs a behavior note.
  2. Nit — policy edge cases (unix.rs:172-210):

    • selected.len() < allowed_with_capacity.len() (l.205) is what makes an already-single-tier cpuset a no-op; the test at l.287-292 passes for a different reason than the doc comment claims.
    • A two-tier set whose high tier is one CPU falls back to the midpoint rule and can select only that one CPU, then returns None — the comment at l.196-197 ("Avoid collapsing multiple busy threads onto a single prime core") is not what the code guarantees.
    • Duplicated constant and duplicated heuristic in Rust and C (unix.rs:172-210 vs roce_proxy.c:1510-1570) is a maintenance defect on its own.
  3. Nit — placement: AGENTS.md l.20-21 defines eos/ as "the host operating-system operations that Helios and Selene use"; this is a Helios serving policy, not a generic host OS operation, and Selene would inherit it. A Helios module would also remove the Windows stub (eos/src/windows.rs:216-219).

  4. Verified as fine: no env var, no Protobuf/core/ABI change, proxy ABI stays 14 (roce_proxy.c:134), existing cores load unchanged, and the cpuset intersection preserves operator restrictions (the new mask is a subset of the thread's own affinity). Tests unix.rs:254-314 cover only the pure selector: prefer_high_capacity_cpus itself (sysfs read + sched_setaffinity) and the whole C helper have no test and are only claimed qualified on GB10; the Windows stub was never compiled (the description does disclose this).