Architecture report · NVIDIA/hyperflare-inference #589

Raw Markdown for agents: https://autobot.eidonix.com/p/73a047e3-360c-4ee2-bfc3-de69f3c0aa4c.md

Review of PR #589 — Architecture and scope lens

Verdict: should-fix issues only. No blocking defect in the changed code paths I could verify. The two code-level findings are a weakened-error-handling regression and a now-false unsafe fn contract; the rest are scope, evidence and documentation-consistency findings judged against AGENTS.md and docs/design-review.md.

Note: the orientation packet records this PR as merged (merge commit ba3afb13, 2026-11-28). The findings below are therefore written as follow-ups, not merge gates.

Key findings

  1. Should fix — cuda.rs:535-537: is_host_numa_unsupported treats generic CUDA_ERROR_INVALID_VALUE (1) as "platform unsupported" at four call sites, silently substituting a different allocation strategy for genuine argument errors. This is exactly the "silently substitute execution paths" pattern AGENTS.md:182-186 rejects.
  2. Should fix — cuda.rs:781-790: the copy_batch doc contract still says every address is a device address and that raw CPU addresses of registrations are not passed; the new fallback (824-833) exists precisely because callers pass those pointers. A stale # Safety contract on an unsafe fn.
  3. Should fix (scope) — PR as a whole: four independent outcomes in one PR, two of which extend support to Jetson Orin GA10B / 8–32 GiB SoCs that the charter names nowhere, without the maintainer sign-off the charter requires (AGENTS.md:171-175, charter Non-Goals).
  4. Should fix (evidence) — release claim: the headline claim ("flare-linux-arm64.tgz can start on stock JetPack 6") is supported by an x86_64-only build; the native aarch64 build and the ubuntu-24.04-arm job are listed by the author as unrun (docs/design-review.md:247-251).
  5. Should fix (docs) — docs/release.md:30-31, docs/multi-host.md:50: state JetPack 6 as qualified while the only evidence is the amd64 artifact (AGENTS.md:52-60 requires "present qualification").
  6. Verified, no defect: eos/src/unix.rs::map_host THP ordering change, and the Selene/helios budget arithmetic round trip.
  7. Nits: dead host_pool_budget_with_reserve, the Option<u64> budget-wrapper stack, the x86_64 RoCE load-time-check behaviour change unstated in the description, and a stale CUDA symbol list in docs/prefix-cache-offload.md.

Should fix

1. CUDA_ERROR_INVALID_VALUE is mapped to "platform unsupported", turning real errors into a silent path substitution

helios/src/cuda.rs:532-537

/// `CUDA_ERROR_INVALID_VALUE` (1) or `CUDA_ERROR_NOT_SUPPORTED` (801), returned by
/// CUDA drivers on platforms without `CU_MEM_LOCATION_TYPE_HOST_NUMA` VMM support
/// (such as Windows WDDM and integrated Tegra/GA10B GPUs).
fn is_host_numa_unsupported(status: c_int) -> bool { matches!(status, 1 | 801) }

Consumed at four sites in try_map_device_host_parts: 579 (cuDeviceGetAttribute), 587 (cuMemGetAllocationGranularity), 642 (cuMemCreate), 658 (cuMemSetAccess); each returns Ok(None), which makes selene/src/offload.rs silently replace the HOST_NUMA split pool with an anonymous SlabPool::sized + cuMemHostRegister_v2 mapping.

Why it matters: status 1 is the generic CUDA_ERROR_INVALID_VALUE, which CUDA also returns for genuine argument errors — bad granularity rounding, wrong handle or flags, a resident-context mistake in the newly added cuMemSetAccess path. Mapping it to "platform unsupported" means a real bug in map_device_host_parts degrades into a different allocation strategy with different properties (CPU-addressable mapping, whole-mapping registration cost, a different device_parts() path) instead of failing. AGENTS.md:182-186 — "Do not remove validation, suppress errors, silently substitute execution paths" — covers this directly, and AGENTS.md:194-199 ("tests must exercise the affected behavior") is relevant because the new fallback tests establish the substitution works but not that it is only reached on real platform absence. The change is also internally inconsistent: cuMemMap and cuMemAddressReserve failures still hard-error, so a platform without HOST_NUMA can return Err as well as Ok(None) depending on which call reports first.

Fix: narrow the predicate to CUDA_ERROR_NOT_SUPPORTED (801), or probe support explicitly before reserving (host-NUMA attribute presence, or cuMemGetAllocationGranularity for CU_MEM_LOCATION_TYPE_HOST_NUMA). If status 1 must be accepted for one documented driver/platform pair, constrain it to that single call and cite the driver behaviour in the comment. Settling this beyond the code needs a GA10B/WDDM run showing which status each of the four calls actually returns.

2. The copy_batch safety contract contradicts the fallback the PR introduces

helios/src/cuda.rs:781-790 versus 824-833

The doc comment still reads: "Every address is a device address, including the device alias of registered host memory. CPU addresses of registrations are not necessarily GPU-accessible." The # Safety section promises only lifetime. The new fallback comment says the opposite of the first sentence — cuMemcpyAsync "accepts device addresses, registered host aliases, and raw cuMemHostAlloc(..., flags=0) pointers" — and the PR description names helios/src/execution/transport.rs (not opened) frame.input.address() (allocated with flags = 0) and helios/src/offload/transfer.rs as the callers that pass exactly the pointers the contract excludes.

Why it matters: the contract other code is written against is now wrong, and the fix is justified by the very case the docstring rules out. A stale contract on a pub(crate) unsafe fn is a correctness hazard for future callers, and AGENTS.md:43-65 (prose review; state actual behaviour) applies to docstrings explicitly.

Fix: rewrite the contract to distinguish the two paths — cuMemcpyBatchAsync_v2 requires device addresses including registered aliases; the CUDA < 13 fallback via cuMemcpyAsync additionally accepts UVA-reachable pinned host pointers without the mapped flag. While there, note that cuMemcpyAsync is now a hard-required entry point: Driver::load resolves it with symbol!("cuMemcpyAsync") at cuda.rs:303, and symbol! (cuda.rs:239-248) returns Err when absent, so driver load fails up front rather than the copy failing later.

3. Scope: four independent outcomes in one PR, two of them extending support to hardware the charter does not name

PR as a whole, against AGENTS.md:165-199 and the charter.

AGENTS.md:198-199 states "Keep each PR focused on one coherent outcome." This PR carries four: (1) the CUDA 12 discrete-GPU copy fallback in helios/src/cuda.rs; (2) a release-engineering portability change — .github/workflows/release.yml (not opened) plus a 236-line vendored helios/native/roce_proxy_dlopen.c and the helios/build.rs switch to it; (3) a Selene/helios host-budgeting rework across selene/src/offload.rs, selene/src/slab.rs, selene/src/registrar.rs, helios/src/runtime_core/{memory,model}.rs, helios/src/offload/{mod,registrar}.rs; (4) an eos/src/unix.rs THP ordering tweak. Each is individually "reproducible bug"-class (AGENTS.md:165-166), but they have no shared failure mode, and a regression in one cannot be bisected from the others.

The larger scope problem is the supported matrix. The charter's Goals name "SM103, SM120, and SM121" and DGX Spark; Non-Goals include "Broad production coverage across arbitrary models, GPUs, or deployment setups", "require an explicit maintainer sign-off before starting work", and "Stay focused … not interested in piling on extra model aliases, random switches, or broad hardware support". Items (2) and the SoC half of (3) explicitly target stock JetPack 6 / Ubuntu 22.04 arm64 hosts, Jetson Orin 8–32 GiB SoCs, and GA10B — none of which appear as a target anywhere in the charter or the roadmap. The PR description cites no maintainer request or sign-off for that target, and AGENTS.md:201-206 says a feature request or passing tests do not waive the requirement.

Related, same principle: the new native TU is a new indirection layer in vendored native code — roce_proxy_dlopen.c #includes the unmodified roce_proxy.c and redefines 17 ibv_* names as static trampolines. AGENTS.md:188-193 rejects "fallback layers … without a concrete requirement"; here the requirement is concrete and stated (arm64 release must run without libibverbs1), so the approach is defensible — but it should be justified for the target that needs it, not applied blanket to every build (see nit 7).

Recommendation: record which of the four outcomes was the maintainer-requested one, and either obtain the sign-off for Orin/GA10B or split the SoC-specific budgeting and arm64 packaging changes out of the CUDA 12 fix.

4. The check that the release fix targets was not run

.github/workflows/release.yml:37-53 (not opened) and the PR's own evidence section.

The workflow's linux matrix already contains an arm64 leg (os: ubuntu-24.04-arm, with build-packages: libibverbs-dev) and runs the ELF/GLIBC_ verification and the ubuntu:22.04/ubuntu:24.04 clean-container smoke checks per leg (release.yml:58-121). The author lists as unrun: "Native aarch64 build and ubuntu-24.04-arm CI run". docs/design-review.md:247-251 is explicit: "Disclosure does not excuse skipping runnable CPU checks … noting it as a limitation does not make the omission acceptable." The headline claim of this PR — flare-linux-arm64.tgz starts on stock JetPack 6 — is exactly the leg that was not executed, and it is runnable on the runner the repository already uses. docs/design-review.md:106-115 likewise requires "disclose unrun checks and material limitations", which was done, but disclosure is not a substitute for a runnable check.

Fix: run the linux arm64 job (workflow_dispatch is enough) or at minimum a native cargo build --release --features roce on arm64 with the ELF checks applied, and attach the output before treating the portability claim as established.

5. Docs state arm64 JetPack 6 support as present qualification on unrun evidence

docs/release.md:30-31, docs/multi-host.md:48-50.

docs/release.md:30-31: "The Linux executables are built in Ubuntu 22.04 and require glibc 2.35 or later (covering Ubuntu 22.04+, JetPack 6, and Ubuntu 24.04+)." docs/multi-host.md:50: "Both builds load libibverbs.so.1 lazily at run time only when opening a …". AGENTS.md:52-60 requires documents to "State support as present qualification: what is implemented, the hardware and configurations on which it is qualified, and what is not qualified", and to record unrun checks in docs/TODO.txt, not in design documents.

The only evidence offered for JetPack 6 is (a) an x86_64 build inside ubuntu:22.04 and (b) a readelf/GLIBC_ read on the amd64 artifact. Nothing establishes the arm64 archive's glibc ceiling, its absence of a libibverbs.so DT_NEEDED entry, or that it starts on JetPack 6. The claim in the prose is therefore ahead of the evidence.

Fix: run finding 4's job and keep the wording, or qualify these two passages to arm64 as "built, not yet qualified on JetPack 6" and move the unrun check to docs/TODO.txt.


Verified, no defect

Nits

  1. Dead public API added alongside a live one — selene/src/offload.rs:856-885 host_pool_budget_with_reserve: host_pool_budget calls it with true (851-853) and nothing in production calls it with false; the apply_reserve plumbing is exercised only from tests (selene/src/offload/tests.rs:720-723). This is the "unsupported abstractions and churn" case in AGENTS.md:188-193. Fix: inline host_pool_budget_from(available, total, future, true) into host_pool_budget and drop the wrapper. Related shape nit: prepare_with_inputs_budget (selene/src/offload.rs:522-533, helios/src/offload/mod.rs:105-129) is a 9/10-argument function on a #[allow(clippy::too_many_arguments)] path behind an Option<u64> plus a parallel headroom_with_inputs / headroom_with_inputs_for_budget pair (selene/src/offload.rs:117-206); only one production caller (helios/src/runtime_core/model.rs:967) passes Some, all None callers are tests. A single required host_budget: u64 resolved once at the entry point would remove three wrappers.
  2. x86_64 behaviour change unstated in the description — helios/build.rs:67-77 gates the dlopen shim only on #[cfg(feature = "roce")], with no target_arch gate: any --features roce x86_64 build now goes through dlopen, so an RDMA host that previously failed at process start now starts and fails only when opening multi-host RoCE. The description frames the dlopen work as an arm64/JetPack 6 fix. Not a code defect (it matches the new docs/multi-host.md wording), but the description understates it.
  3. Stale CUDA symbol list in prose — docs/prefix-cache-offload.md:645-655 lists what helios/src/cuda.rs binds and now says the batch path falls back to per-entry cuMemcpyAsync, but does not say cuMemcpyAsync became a required entry point (cuda.rs:303 via the symbol! macro at 239-248), i.e. a driver missing it fails at load, not at copy time. Add it to the list, and update copy_batch's contract per finding 2.

Open questions