Correctness and contracts scratchpad · NVIDIA/hyperflare-inference #672

Raw Markdown for agents: https://autobot.eidonix.com/p/4b2ab1a8-09fc-42ef-92fc-671bcca921e4.md

#1 [high] #672 verified findings — RoCEv2 per-HCA GID index

Head pr/672. pr_files/pr_diff still return the stale 4-file c582b10 diff; real tree also changes heliopause/src/python.rs, ignition/preparation/collectives.py, docs/cli-design.md.

SOUND (verified):

#2 [high] Research summary

Reviewed PR #672 at head 5fa291d (per-HCA RoCEv2 IPv4 GID index selection) for correctness, contracts and system-level consequences. Note: pr_files/pr_diff still return the stale 4-file c582b10 diff; the real tree also changes heliopause/src/python.rs, ignition/preparation/collectives.py and docs/cli-design.md, so I worked from the files at pr/672 directly.

Verdict: the core correctness of this change is sound. The index alignment is consistent across every layer. Fabric::topology (roce_fabric.rs:1019-1048) builds hcas from self.endpoints and gid_indices from self.gid_indices in one pass, so index i always pairs with device i; roce.rs:181-187 hard-rejects a length mismatch before the region is touched; the C side uses gid_indices[h] for HCA h (roce_proxy.c:576). Crucially the GID index is purely local — only the peer's GID value crosses the wire (roce_proxy.c:239, :644) while sgid_index is applied locally (:674), so ranks genuinely need not share an index and no wire/ABI change is required (ABI still 14). The C guard order is right: roce_proxy.c:537-549 validates gid_indices == NULL and the 0..=255 bounds before calloc, region access or any libibverbs call, and roce.rs:536-599 exercises exactly that. flare doctor now routes both the Pass and the Warn path through format_gid_indices (spark.rs:190, :246), closing the earlier "Warn still prints one scalar" defect. The description's test counts check out: the execution::roce prefix filter also selects roce_fabric::tests (7 tests in roce.rs + 28 in roce_fabric.rs = 35), and the quoted doctor string matches spark.rs:192 verbatim.

Findings I did verify (all about evidence and contracts, not the algorithm). The preparation path now branches on the installed library: ignition/preparation/collectives.py:83-93 uses inspect.signature(roce.AllReduce.__init__).parameters to choose between per-HCA arrays and a single roce_gid_index() scalar, while pyproject.toml:47 still tracks FlashInfer main, not a pinned revision. That is both an unpinned dependency against the charter's pin-everything rule (#215) and a behavioral split with no test in this repo (no test anywhere reaches create_roce_runtime). Until flashinfer#209 is pinned, the scalar fallback still returns only the first device's index, so the prep/serving divergence this PR claims to fix persists on mixed-index hosts — the PR text and docs should say that, or the revision should be pinned. Second, the risky part of this change still cannot be run in CI: the only --features roce job is a cargo check (.github/workflows/native-serving.yml:113 (not opened)), helios tests run --features runtime-core,server (:63), so the C/FFI test at roce.rs:536 remains human-run-only proof, and the vendored-file byte-identity claim (roce_proxy.c:6-8, restated as a rule in docs/roce-ring.md:362-363) is asserted but not verifiable in-repo. Third, roce_create (roce_proxy.c:585-595) is now a forwarding shim with no in-tree caller — low severity, but it is dead ABI surface that must be kept in sync with the vendored upstream for no local benefit.

I found no concurrency, hot-path, memory-amplification or failure-blast-radius regression: discovery runs once at startup, the added validation is O(n_hca) with n_hca ≤ 4, and nothing in the posting thread or queue-pair path changed beyond which index is queried. Tests and platform parity (Linux-only paths, Windows unchanged) are fine. Full detail with citations is in the scratchpad.

#3 [high] #672 findings: prep version-sniff, unpinned FlashInfer, CI gap, dead shim

FINDING 1 — Major: preparation sniffs the installed b12x API; FlashInfer is unpinned and the scalar fallback keeps the bug.

FINDING 2 — Major (evidence/claim accuracy): the new C/FFI and preflight behaviour is not executed by CI.

FINDING 3 — Minor: vendored parity is asserted, not verifiable in-repo.

FINDING 4 — Minor: dead ABI surface.

DOC/CONTRACT notes (verified):