Simplicity report · NVIDIA/hyperflare-inference #576

Raw Markdown for agents: https://autobot.eidonix.com/p/49667ca6-0df0-49bc-a811-3dc4aa1ec264.md

Key findings

Reviewed PR #576 (7 files, +226/−1, head 4b41ddc) through lens D, simplicity — what can be deleted. Two findings, both should fix, no blockers.

  1. The tier-selection policy is written twice (eos/src/unix.rs:172-245 and helios/native/roce_proxy.c:1505-1570), and the second copy puts 66 lines of local policy into a file the repo requires to stay byte-identical to its vendored upstream. A single implementation, in the creating thread, deletes all 66 C lines.
  2. Two of the four Rust call sites only narrow preparation/qualification threads (helios/src/execution/worker.rs:71, helios/src/replay.rs:174), while a genuinely latency-critical serving thread (helios/src/execution/threaded.rs:652, flare-rank-{n}) gets no call. The set of narrowed threads looks arbitrary and is stated as a file list rather than a rule.

Rules this review judges against:

Coverage: every changed hunk was read in context, and every call site was followed (eos/src/unix.rs 150-336 and 250-336 incl. tests; eos/src/lib.rs:10-16; eos/src/windows.rs:220; helios/native/roce_proxy.c 1-25, 1495-1580 and the diff; helios/src/execution/worker.rs:55-90; helios/src/replay.rs:160-190; helios/src/execution/threaded.rs:630-680; plus grep of all four Rust call sites and of every ReplayWorker::new / ExecutionWorker::new_threaded construction).


Finding 1 — should fix: the tier-selection policy is implemented twice, and one copy is in a file that must stay identical to vendored upstream

Files/lines: eos/src/unix.rs:172-210 (select_high_capacity_cpus) + eos/src/unix.rs:215-245 (prefer_high_capacity_cpus) vs helios/native/roce_proxy.c:1505-1570 (pin_high_capacity_cpus), called from helios/native/roce_proxy.c:1576.

What is wrong. Both copies encode the same non-obvious policy, number for number:

step Rust C
read own mask unix.rs:218 roce_proxy.c:1513
per-CPU cpu_capacity unix.rs:227 roce_proxy.c:1526
abort on read/parse/zero unix.rs:228-233 (return) roce_proxy.c:1528-1536 (return)
< 2 CPUs or min == max → no-op unix.rs:173-187 roce_proxy.c:1543
keep cap*10 >= max*9 (the magic 0.9) unix.rs:192 roce_proxy.c:1550
<2 survivors → keep cap*2 > min+max unix.rs:195-204 roce_proxy.c:1555-1565
apply only if 2 <= selected < count unix.rs:205 roce_proxy.c:1566

The 90% threshold exists nowhere but in these two expressions. Any future tuning (0.9 → 0.95, a different three-tier rule) has to be made twice, by hand, in two languages, and only the Rust copy has tests (eos/src/unix.rs:254-314); nothing in CI or the PR compares the two behaviours. That satisfies the "fallback layers / parallel paths" prohibition in AGENTS.md:188-189 and principle 1 of docs/design-review.md:16 only if the duplication is genuinely forced. It is not obviously forced — and, worse, the C copy directly contradicts docs/roce-ring.md:362-364 and roce_proxy.c:6-8, which require the vendored proxy to stay identical to the pinned FlashInfer source after its provenance header. This PR makes it diverge, so the repo's own provenance invariant now has a silent exception.

Why the C copy exists (so the fix is not naive deletion): the proxy thread is created by pthread_create(&c->thread, NULL, proxy_main, c) at roce_proxy.c:1674 inside roce_start, reached from RoceTransport::connect (helios/src/execution/roce.rs:295), which flare-cli calls from cluster::peer (flare-cli/src/main.rs:549) and cluster::rank_zero (main.rs:613) — i.e. before serve()/serve_peer() ever reach the narrowed threads (helios/src/execution/parallel.rs:539, helios/src/server/runtime.rs:568). The child therefore inherits the un-narrowed main-thread mask, which is the only reason proxy_main narrows itself.

Fix (smaller version). Narrow the creating thread immediately before roce_start, so the proxy inherits the mask through pthread_create:

// helios/src/execution/roce.rs, in RoceTransport::connect, before roce_start
flare_eos::prefer_high_capacity_cpus();

and delete roce_proxy.c:1505-1570 (66 lines including the #ifdef) plus the pin_high_capacity_cpus() call at roce_proxy.c:1576. Total: −66 C lines, −1 Rust line, one implementation, one tested copy, and the vendored file stays identical to upstream so docs/roce-ring.md:362-364 keeps holding. If narrowing the calling thread is unacceptable (e.g. connect runs on a thread that must keep its full mask for other work), the alternative is to spawn a short-lived transport-opener thread that narrows itself and then calls roce_start — still no C changes.

If the C copy must stay for some reason I could not see from the code, then the PR must say so explicitly and record why the vendored-identical rule is being broken; today neither the PR description nor roce_proxy.c:6-8 is updated to acknowledge the divergence.


Finding 2 — should fix: two of the four Rust call sites narrow only preparation/qualification threads, and a genuinely critical serving thread is missing

Files/lines: helios/src/execution/worker.rs:71, helios/src/replay.rs:174 (added, arguably unnecessary) versus helios/src/execution/threaded.rs:652-678 (missing).

What is wrong. The four added call sites are not the same population:

Since the calls are unconditional on entry to the worker closure (worker.rs:70-71, replay.rs:173-174), they are silent behaviour changes in paths with no stated benefit — exactly the "churn" AGENTS.md:188-189 asks reviewers to reject.

Missing site, which makes the set look arbitrary. The same-process TP rank threads format!("flare-rank-{}", index + 1) at helios/src/execution/threaded.rs:652-653 own GraphExecutor (threaded.rs:656) and launch CUDA graphs in rank_loop (threaded.rs:668) — precisely the "execution thread" the PR says it is pinning — yet they get no call. So threaded TP narrows neither its rank threads; only the process-TP path (parallel.rs:539) and the numeric-path executor (server/runtime.rs:568) are narrowed.

Fix. Either

Either way, state the rule — "the thread that owns the CUDA execution/WFET worker, the RoCE proxy, and the same-process TP rank threads" — instead of listing files, so the next execution-thread type knows whether it qualifies. That is both smaller prose and a smaller diff than the current file list.


Nits

None. The doc comments on select_high_capacity_cpus (unix.rs:167-171), prefer_high_capacity_cpus (unix.rs:212-214) and pin_high_capacity_cpus (roce_proxy.c:1506-1509) are 2-4 lines, state the no-op invariants, and contain no history; the eos/src/windows.rs:220 stub is one line and matches the file's existing style. The unit tests at unix.rs:254-314 each assert a distinct behaviour the PR claims (two-tier split, homogeneous/single-tier/zero-capacity no-op, three-tier collapse avoidance) and are not redundant — with the caveat in open questions below.

Open questions / what could not be settled