Subtraction, Simplicity & Conventions review — #672
Key findings
- Provenance caveat resolved, and it changes the verdict. For most of this review my tools served the stale
c582b10snapshot (4 files). At head5fa291d6the tree now visible atpr/672is the pushed one, and the three big simplification targets from my earlier passes are gone:roce_ctx_t.gid_indexno longer exists (helios/native/roce_proxy.c:262-269),Fabriccarries onlygid_indices(helios/src/execution/roce_fabric.rs:223-228),Topologylikewise (: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 storesgid_indexonInterface(flare-cli/src/doctor/spark.rs:277) with one sharedformat_gid_indicesused in both the Pass and Warn paths (:190,:246, helper:259-272). Net: this lens has no blocking finding. - Medium — the b12x
inspect.signatureprobe is a fallback layer that should be deleted, not shipped.ignition/preparation/collectives.py:83-93now 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()onceflashinfer#209is pinned; if it cannot be pinned, the probe cannot be validated and should not be added. - Low — the same GID/HCA length invariant is guarded in two Rust layers.
roce_fabric.rs:1029-1035androce.rs:181-187both enforce it;gid_indicesis cloned fromendpointsin the same function, so one of the two is removable. - 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. - 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:
- an untested branch (prep RoCE tests are GPU-gated in this repo; the branch is chosen by whatever
b12xhappens to be installed, so CI cannot cover both), - a scalar fallback (
roce_gid_index()) that still returns exactly one device's index, i.e. the preparation-vs-serving split this PR is fixing persists silently on mixed-index hosts, - plus two now-legacy support shims that exist only for that branch:
roce_gid_index()(heliopause/src/python.rs:693-706, docs rewritten to say "Preferroce_devices…") andFabric::gid_index()(roce_fabric.rs:1004-1010, whose only non-test consumer is that PyO3 function).
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)
format_gid_indices(flare-cli/src/doctor/spark.rs:259-272) is a genuine shared helper used in both the Pass path (:190) and the Warn fallback (:246) — the earlier "Warn prints one scalar" duplication is closed. The residuallet ready_gids: Vec<u32> = ready.iter().map(|port| port.gid_index).collect();(:189) exists only to feed&[u32]; changing the helper to take an iterator would save one line and cost clarity — not worth it.Interfacenow ownsgid_index: u32(spark.rs:277), so the lockstep parallel-Vec invariant is gone.roce_fabric.rsdiscovery: thepick_gid_indexclosure is 6 lines, single-use, and reads better than an inlined chain infilter_map; the old host-wideall()/any()double scan is removed. Roughly line-neutral overall.- No new flags, config knobs, or environment variables;
PREFERRED_GID_INDEXand the existing GID-table parsing are reused rather than duplicated. roce_create_with_gidsvalidation (roce_proxy.c:536-549) is compact and correctly at the ABI boundary;open_hcanow takes the index as a parameter (:423) instead of reading context state.heliopause/src/python.rs:710-727derivesroce_devices()from a singlediscover()call and reusesFabric::gid_indices— no duplicated discovery.
Open questions
- Is
local-inference-lab/flashinfer#209merged/pinned at a named SHA? That single fact decides finding 1 (delete the probe vs. delete nothing and document the limitation).pyproject.toml:47(not opened) tracked FlashInfermainat my last check. - Does the pushed PR description carry the corrected
cargo test --manifest-path helios/Cargo.toml (not opened) --features roce --lib execution::rocecommand and the 35-test count? The readable copy still lacks--features roce, and the new FFI test (roce.rs:537) is human-run only — the--features roceCI job iscargo checkonly. - Was
#209also updated to droproce_create, or does upstream keep the shim? That determines whether finding 3 can be acted on in this repo alone.