Subtraction and simplicity report · NVIDIA/hyperflare-inference #672

Raw Markdown for agents: https://autobot.eidonix.com/p/587ff09a-2c64-42b7-a0f5-b885428fb79f.md

Subtraction, Simplicity & Conventions review — #672

Key findings

  1. Provenance caveat resolved, and it changes the verdict. For most of this review my tools served the stale c582b10 snapshot (4 files). At head 5fa291d6 the tree now visible at pr/672 is the pushed one, and the three big simplification targets from my earlier passes are gone: roce_ctx_t.gid_index no longer exists (helios/native/roce_proxy.c:262-269), Fabric carries only gid_indices (helios/src/execution/roce_fabric.rs:223-228), Topology likewise (:308-320), the three copies of the "half-populated fallback" are gone (roce_fabric.rs:1013-1015, :1040, helios/src/execution/roce.rs:206), and the doctor now stores gid_index on Interface (flare-cli/src/doctor/spark.rs:277) with one shared format_gid_indices used in both the Pass and Warn paths (:190, :246, helper :259-272). Net: this lens has no blocking finding.
  2. Medium — the b12x inspect.signature probe is a fallback layer that should be deleted, not shipped. ignition/preparation/collectives.py:83-93 now has two live prep paths keyed on the installed library, no test in this repo, and the legacy branch still reports one device's index — which is exactly the #369 divergence this PR exists to close. Delete the probe + legacy branch + roce_gid_index + Fabric::gid_index() once flashinfer#209 is pinned; if it cannot be pinned, the probe cannot be validated and should not be added.
  3. Low — the same GID/HCA length invariant is guarded in two Rust layers. roce_fabric.rs:1029-1035 and roce.rs:181-187 both enforce it; gid_indices is cloned from endpoints in the same function, so one of the two is removable.
  4. Low — roce_create() shim now has no in-tree caller and cannot express per-HCA indices (roce_proxy.c:585-595). Keep only as an explicit ABI/vendored-parity decision; otherwise it is dead code.
  5. Low — convention: the PR body's "0 diff bytes" byte-identity check is a process assurance about a file that cannot be verified in-repo; the durable statement belongs in docs/roce-ring.md:362-363, which this PR does not touch.

1. Medium — the version-sniffing prep path duplicates the serving path and cannot be tested here

ignition/preparation/collectives.py:80-93 (verbatim):

    # Each host uses the HCAs and per-device GID indices native serving discovers for it. Pass
    # aligned `hca_names` and `gid_indices` when the pinned b12x RoCE runtime supports them
    # (local-inference-lab/flashinfer#209), otherwise fall back to the first device's `gid_index`.
    import inspect

    gid_kwargs: dict[str, object]
    if "gid_indices" in inspect.signature(roce.AllReduce.__init__).parameters:
        devices = flare_heliopause.roce_devices()
        gid_kwargs = {
            "hca_names": [name for name, _ in devices],
            "gid_indices": [gid for _, gid in devices],
        }
    else:
        gid_kwargs = {"gid_index": flare_heliopause.roce_gid_index()}

The mechanism itself is idiomatic for this repo — there is precedent at ignition/preparation/tensor_metadata.py:138 (not opened) (if "descriptor_type" in inspect.signature(expand_signature).parameters:). The objection is not the probe, it is the third execution path. It carries:

Concretely: when local-inference-lab/flashinfer#209 is pinned at a named revision, replace lines 83-93 with the unconditional two-key form and delete roce_gid_index (python.rs:669 registration + :693-706), Fabric::gid_index (roce_fabric.rs:1004-1010) and the .map(|fabric| fabric.gid_index()) call. Net ≈ −30 lines and one fewer path. If #209 cannot be pinned, the honest alternative is to document the limitation and add nothing.

Related micro-dead branch in the same chain, roce_fabric.rs:1004-1010:

    /// The first selected device's RoCEv2 GID index, or `PREFERRED_GID_INDEX` when empty.
    pub fn gid_index(&self) -> u32 {
        self.gid_indices
            .first()
            .copied()
            .unwrap_or(PREFERRED_GID_INDEX)
    }

discover() errors rather than returning an empty Fabric, so the unwrap_or(PREFERRED_GID_INDEX) arm is unreachable in production and re-introduces a silent "index 3" default in the one place the PR is trying to remove host-wide defaults. Remove it with the function.

2. Low — the GID-index/HCA count invariant is enforced twice on the Rust side

helios/src/execution/roce_fabric.rs:1029-1035:

        if self.gid_indices.len() != self.endpoints.len() {
            return Err(failure(format!(
                "RoCE fabric has {} GID indices for {} devices",
                self.gid_indices.len(),
                self.endpoints.len()
            )));
        }

and helios/src/execution/roce.rs:181-187:

        if topology.gid_indices.len() != topology.hcas.len() {
            return Err(failure(format!(
                "RoCE topology has {} GID indices for {} HCAs",
                topology.gid_indices.len(),
                topology.hcas.len()
            )));
        }

Topology::gid_indices is cloned from self.gid_indices and hcas from self.endpoints in the same constructor (roce_fabric.rs:1039-1040), so once the fabric check passes the topology vectors are aligned by construction. The C side must keep its own guard (roce_proxy.c:538-549, including the NULL and 0..=255 checks) because it is a public ABI boundary — that one is correct and should stay.

Simplification: keep exactly one Rust-side check. I recommend keeping the roce.rs:181-187 preflight (it runs before write_bytes(region, …) at :205, i.e. before the region is modified, and it is the FFI boundary), and deleting roce_fabric.rs:1029-1035 along with its dedicated test case (roce.rs:484 popping gid_indices, case 10 of rejects_incompatible_core_and_routes_before_modifying_region). The alternative direction works too; shipping both is the subtraction to avoid.

3. Low — roce_create() is now a shim with no in-tree caller

helios/native/roce_proxy.c:585-595:

roce_ctx_t* roce_create(int world, int rank, const char* const* hca_names, int n_hca, int gid_index,
                        int traffic_class, int n_lane, void* region, uint64_t region_bytes,
                        uint64_t slot_bytes, uint64_t pipe_bytes, uint64_t varlen_bytes, char* err,
                        uint64_t err_len) {
  int gids[ROCE_MAX_HCAS];
  for (int h = 0; h < ROCE_MAX_HCAS; h++) {
    gids[h] = gid_index;
  }
  return roce_create_with_gids(world, rank, hca_names, n_hca, gids, traffic_class, n_lane, region,
                               region_bytes, slot_bytes, pipe_bytes, varlen_bytes, err, err_len);
}

search_code roce_create at pr/672 returns this definition only; the Rust FFI block declares and calls roce_create_with_gids exclusively (roce.rs:46-61, call at :208), and roce_proxy_dlopen.c never names it. Good news: the duplicated n_hca < 1 || n_hca > ROCE_MAX_HCAS guard I previously flagged is already removed, and the fill loop now covers ROCE_MAX_HCAS rather than n_hca, so the shim is correct as written.

This is an ABI entry point (PROXY_ABI 14, roce.rs:23) and a vendored file, so deletion is a parity decision rather than pure cleanup: either delete it here and upstream in flashinfer#209, or keep it deliberately and say why in the header comment. Do not leave it as an undocumented legacy surface that no code in this repo calls.

4. Low — conventions: keep the durable claim in docs, not in the PR body

Per repo conventions (AGENTS.md:129-132, "Remove process assurances that add no technical evidence", and AGENTS.md:513, do not create provenance bundles/hash inventories), the description's verification item "verified roce_proxy.c lines 10..EOF are byte-for-byte identical … (0 diff bytes)" is exactly a process assurance about a file whose identity cannot be checked from inside this repo. docs/roce-ring.md:362-363 already states the vendored-identity rule; if the provenance header at roce_proxy.c:6-8 needs updating for the new signature set (roce_create_with_gids), that doc/header is where the durable statement belongs. This PR touches neither.

Also note: the recorded pr_files/pr_diff/description are still the stale 4-file c582b10 view, while the tree at pr/672 changes at least 7 files. Reviewers must open the diff on GitHub, not the tool summary.


Checked and found already lean (no action)

Open questions