Final review report · NVIDIA/hyperflare-inference #707

Raw Markdown for agents: https://autobot.eidonix.com/p/964328e2-5652-4b2e-a2d5-3fdd98a2944c.md

Recommendation: Changes Requested

The per-HCA GID plumbing, the mesh relay-plan derivation with its Rust preflight, the CI parity guard, and the new execution::roce CI step are well built and verified clean at 81ef561 — I found no defect in roce_fabric.rs discovery/planning, roce.rs preflight/ordering, heliopause, flare doctor, or cluster.rs. Three blockers remain: a verified state-machine defect in the vendored proxy's cross-family credit holding (roce_proxy.c:1536-1538), the unrun mandatory multi-GPU collective gate that docs/design-review.md:252-259 names for exactly these files, and a default-on relay data path shipped with no measurement, reversing a documented decision from merged #279.

Merge Risk

Level: High

Walkthrough

Pre-merge Checks

Blockers

  1. credit_phases() holds only one phase across a pipe↔1-hop transition, leaving the other phase of a two-phase op unguarded — silent peer-row/flag corruption. helios/native/roce_proxy.c:1536-1538.

    if (kind_1hop(prev) != kind_1hop(kind)) {
      return (cur_p & PIPE_PHASE_RS) != 0 ? CREDIT_RS : CREDIT_AG;   // one bit, not both
    }
    

    Verified callees and masks: kind_phases (:1508-1522) maps KIND_TWOSHOT(1) and KIND_RING_RSAG(9) → PIPE_PHASE_RS|PIPE_PHASE_AG, KIND_REDUCE_SCATTER(3)/KIND_RING_RS(7) → RS, KIND_GATHER_SHARDS(4)/KIND_RING_AG(8) → AG; kind_1hop at :1524; CREDIT_RS 1u/CREDIT_AG 2u at :185-186. Verified consumers: run_pipe_op gates RS at :1668, AG at :1676, relay forward at :1684; run_ring_bidir_op gates AG forwarding at :1823, RS at :1846, AG step 0 at :1867. So for prev = KIND_GATHER_SHARDS, cur = KIND_RING_RSAG the function returns CREDIT_RS only and every AG post in run_ring_bidir_op runs ungated from the first iteration.

    The overlap the mask exists to guard is real, verified at the layout level: pipe flags occupy rows phase*world + s (:1457, read at :1470-1472), while 1-hop RS uses flag rows dir (:1855) and 1-hop AG uses rows W + dir (:1834, :1872) — so a peer's pipe AG rows are shared with the previous 1-hop AG rows (at W = 4, pipe rows 1/3/5 are 1-hop AG rows 3/4/5). pipe_recv shows the same aliasing: pipe rows are s*2 + phase wide shard_cap (:1452-1454) while 1-hop slots are shard_cap/2 (:1749-1752, slot 2(W-1)+dir(W-1)+(s-1) ≤ 11 at W=4 → full rows 3..5), so a peer still gathering pipe phase 1 from row 3 can have it overwritten by our ungated AG write. That is exactly the hazard the file's own normative statement forbids — :78-81 "holds the hazardous phase until every peer's credit reached the op" and the newly added :92-93 "Cross-family transitions … exchange start-of-op credits because their pipe_recv layouts overlap." The mask is cleared wholesale once every peer's credit lands (run_pipe_op:1665-1667, run_ring_bidir_op:1816-1818), so holding both bits cannot deadlock.

    I confirmed the same-family pipe-only path is not a regression: old (prev==RS && kind∈{RS,TWOSHOT}) / (kind==GS && prev∈{TWOSHOT,GS}) produces the same bits as the new body, so this defect is introduced only by the cross-family branch.

    Fix (hold every phase the new op performs):

    if (kind_1hop(prev) != kind_1hop(kind)) {
      uint32_t need = 0;
      if (cur_p & PIPE_PHASE_RS) need |= CREDIT_RS;
      if (cur_p & PIPE_PHASE_AG) need |= CREDIT_AG;
      return need;
    }
    

    Because the file is byte-identical vendoring enforced by tests/preparation/test_roce_proxy_parity.py:35-65, this must be fixed in local-inference-lab/flashinfer and re-vendored — do not hand-edit. It is currently dormant (no in-tree code posts kinds 7/8/9; helios/src/execution/roce.rs:695-746 only tests roce_set_relay rejection), but the author's own merge step 4 lands hyperflare-recipes#114, which enables KIND_RING_RSAG. Shipping a silent data-corruption race in the shared ABI-14 transport immediately before the PR that turns it on is not mergeable.

  2. The mandatory multi-GPU collective gate is unrun for a transport-ordering change it names by path. docs/design-review.md:252-259: "Replacing or reordering cross-rank launch, commit, cancellation, or drain paths in helios/src/execution/{threaded,parallel,roce}* requires an explicit before/after cross-rank happens-before analysis and live multi-GPU execution of real collective graphs … Disclosing busy or unavailable GPUs does not waive this requirement."

    This PR reorders exactly that path: roce_create_with_gids replaces roce_create (roce.rs:243-260) and roce_set_relay is inserted between roce_connect and roce_start (roce.rs:344-353). What was executed is one host, one active HCA (rocep82s0f0), 38 unit tests plus a live-HCA FFI smoke call that proves the call links and returns — not that a relaying plan orders correctly against peer commits. The PR itself lists "Multi-node RDMA serving, 4-node DGX Spark (SM121) prefill/decode throughput, and live switch-traffic reduction with roce_set_relay were not run". There is also no cross-rank happens-before analysis for the new default-on relay path, and principle 13's "Validate previous cores through loading and serving" (:116-123) is satisfied only at the descriptor level — no previously exported ABI-14 core was loaded and served against the 1176-byte handshake.

    Fix: a 2–4 rank run of a multi-GPU exported core through flare run with relay enabled (and one with --roce-switch-only as the baseline), plus the written before/after happens-before analysis.

  3. roce_set_relay is enabled by default with no measurement, reversing a documented decision from merged #279 without maintainer sign-off. roce_fabric.rs:1128-1131 + roce.rs:344-353; docs at docs/roce-ring.md:166-169.

    The benefit is stated as "expected to reduce switch-traversed mesh all-gather traffic by 25%" with no derivation and no measurement of any kind; every accompanying number is inherited from #649/#577 on 4× DGX Spark, on hardware different from the author's single-host SM120, and the prefill figure additionally depends on unmerged hyperflare-recipes#114. Charter "Bring real evidence" (#210) and design-review.md principle 12 ("Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements") are not met for the change actually being enabled. This also flips a merged invariant: the pre-PR text of docs/roce-ring.md (the removed lines at diff hunk 158-170) read "Serving does not enable FlashInfer's all-gather relay", and #279's description records the same decision — reversing it is legitimate only through "an explicit maintainer decision on the design" (AGENTS.md:203-207), which is not in evidence. docs/roce-ring.md:164-169 now also asserts the behaviour in the present tense with no qualification statement, contrary to AGENTS.md:52-58.

    Fix: either land an A/B on a served workload (flare run, 4 ranks, relay on vs --roce-switch-only), or gate relay behind an explicit opt-in until one exists; add a qualification sentence to docs/roce-ring.md and record the maintainer decision for the #279 reversal.

Should Fix

  1. The FlashInfer pin points at an unmerged branch commit, which the new CI parity test turns into a main-branch failure. pyproject.toml:47 → 524799c47fca54229c15b6db12261171854a7b7d is still-open FlashInfer #213. tests/preparation/test_roce_proxy_parity.py:35-65 byte-compares helios/native/roce_proxy.c lines 10..EOF against whatever uv sync installed (python-cpu.yml:29-33), and there is no uv.lock in the repository (verified: list_files *lock* at main returns only Cargo.lock files), so the rev in pyproject.toml is the entire lock. A force-push or squash-merge of #213 breaks CI on main, and the PR's own merge step 2 admits the repin is outstanding. Fix: repin to the merged main SHA before this PR merges (the author's step 2), and — while here — record the upstream commit and body SHA-256 in helios/native/roce_proxy.c:6-8, which currently names the upstream path and ABI but no revision, unlike #643.

  2. The operator-facing cross-node document was not updated and now contradicts docs/roce-ring.md. docs/multi-host.md:94, :344 and :574-577 still describe relays only in the ring/chain sense and never mention that mesh all-gather relay is on by default. A reader of multi-host.md cannot learn that their 4-node direct-cable mesh changed collective routing, and docs/roce-ring.md:422-424 ("enables the ring or mesh all-gather relay") now contradicts multi-host.md:574. AGENTS.md:52-58 requires support to be stated as present qualification. Fix: add the mesh relay-on-by-default behaviour (and the --roce-switch-only opt-out) to the docs/multi-host.md transport sections.

Subtract / Simplify

  1. roce_gid_index is a dead export whose fallback arm can never execute. heliopause/src/python.rs:697-706 plus its registration at :669; helios/src/execution/roce_fabric.rs:1094-1100 (Fabric::gid_index, whose unwrap_or(PREFERRED_GID_INDEX) is likewise unreachable). The only call site is the legacy fallback ignition/preparation/collectives.py:97, where distinct derives from devices = flare_heliopause.roce_devices() (:83), and discover_in errors rather than returning an empty device list (roce_fabric.rs:429-431). So distinct is never empty and the else flare_heliopause.roce_gid_index() arm is unreachable in production; Fabric::gid_index() survives only through roce_fabric.rs:1242,1276,1303 tests. Deleting the export, its add_function line, Fabric::gid_index(), and simplifying collectives.py:97 to {"gid_index": distinct[0]} removes ~35 lines and stops advertising a twice-documented API whose own doc comment says "Prefer roce_devices".
  2. format_gid_indices's empty arm is unreachable. flare-cli/src/doctor/spark.rs:259-262: both call sites guarantee non-empty input — :189 is inside if !ready.is_empty() (:183) and :246 formats fabric.gid_indices, which a successful discover_in has proven non-empty (roce_fabric.rs:429-431). Take first: u32, rest: &[u32] (or drop the arm) so emptiness is unrepresentable, and the "index (none)" wording stops disagreeing with its "index N"/"indices [..]" siblings.
  3. relay_plan() re-plans routes the caller just planned. roce_fabric.rs:1128-1131 calls plan_shape_routes and then relay_plan, which calls partners (:1032), which constructs a second Planner (:988) and issues planner.peer(rank, peer) for all world × world pairs (:996). The sibling direct_peers (:957) already takes routes as a parameter and reuses them — pass &routes into partners/relay_plan and drop the extra Planner plus the rails/links parameters. Once per connect, never per collective step (I verified health()/posting never reads relay_plan), so this is a simplification, not a hot-path defect.
  4. hcas and gid_indices are parallel vectors whose invariant is re-checked in three places with three different policies. roce_fabric.rs:309-310 → checked at :1119-1125 (error), roce.rs:214-220 (error), and heliopause/src/python.rs:717-721 where zip silently truncates instead of erroring. Fabric already holds endpoints: Vec<Endpoint> whose Endpoint.name is the HCA name (:77, populated at :459-460), so gid_indices shadows a vector that carries its own key. Folding the pair into Vec<(String, u32)> — or into Endpoint — deletes two validation blocks and the truncation hazard.
  5. validate_relay_plan restates a predicate the C proxy already enforces. roce.rs:102-132 mirrors roce_proxy.c:838-849 clause for clause, and roce_set_relay already returns -1 with a message for each condition. Only the shape != Shape::Mesh and plan.len() != 2 * world checks are Rust-only (and earn their place by running before roce_create touches the region). Consider keeping just those two and letting C own the per-entry loop; if the loop is kept deliberately for an earlier error, note why.

Nits

Dropped on verification