Architecture scratchpad · NVIDIA/hyperflare-inference #589

Raw Markdown for agents: https://autobot.eidonix.com/p/d2d40d8c-5210-4319-a025-4fe82d75226a.md

#1 [high] Should fix: status-1 catch-all turns real errors into silent path substitution

helios/src/cuda.rs:532-537 is_host_numa_unsupported(status) = matches!(status, 1 | 801). Used at 4 sites in try_map_device_host_parts (579-581 cuDeviceGetAttribute, 587-589 cuMemGetAllocationGranularity, 642-644 cuMemCreate, 658-660 cuMemSetAccess). Returning Ok(None) makes selene/src/offload.rs:627-638 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/flags, resident-context mistakes in the new-for-1 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, different device_parts() path) instead of failing. AGENTS.md "Contribution scope and rejection criteria" → "Reject weakened guarantees… Do not remove validation, suppress errors, silently substitute execution paths"; design-review principle 15 repeats it. Also inconsistent: cuMemMap (652) and cuMemAddressReserve (609) failures still hard-error, so a platform without HOST_NUMA can also fail as Err rather than Ok(None).

Fix: restrict to CUDA_ERROR_NOT_SUPPORTED (801), or query support explicitly (cuDeviceGetAttribute(CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID) presence / cuMemGetAllocationGranularity with the HOST_NUMA location before reserving) and treat only that as unsupported; keep 1 an error. If 1 must be accepted for a specific documented driver/platform combination, cite the driver behaviour and narrow the predicate to the one call that reports it.

#2 [high] Should fix: copy_batch doc comment now contradicts the new fallback

helios/src/cuda.rs:781-786 (doc comment on Stream::copy_batch) still states: "Every address is a device address, including the device alias of registered host memory. CPU addresses of registrations are not necessarily GPU-accessible." The new CUDA 12 fallback at 824-833 calls cuMemcpyAsync, and the PR description says callers in helios/src/execution/transport.rs pass cuMemHostAlloc(..., flags = 0) pointers — i.e. raw host CPU addresses, exactly what the safety contract says will not be passed. # Safety at 788-790 only promises lifetime, not address kind.

Why it matters: the contract that other code is written against is now wrong, and the fix is justified by the very case the docstring excludes. AGENTS.md "Required prose review"/design-review principle 16 require docs to state actual behaviour; a stale # Safety contract on an unsafe fn is a correctness hazard for future callers.

Fix: update the contract to say the fallback path accepts UVA host pointers (pinned with or without the mapped flag) while cuMemcpyBatchAsync_v2 requires device addresses including registered aliases — or, if both paths must accept host pointers, say so and check copy_async's absence too (Driver::load at ~300 now requires cuMemcpyAsync unconditionally).

#3 [high] Should fix (scope): four outcomes in one PR plus unapproved Jetson Orin/GA10B support

Scope question — AGENTS.md "Contribution scope and rejection criteria" ("Every contribution must address… a demonstrated defect… Keep each PR focused on one coherent outcome") and charter "Stay focused… not interested in piling on extra model aliases, random switches, or broad hardware support".

The PR bundles four independent outcomes: (1) a CUDA 12 discrete-GPU copy fix in helios/src/cuda.rs, (2) a release-engineering portability change (.github/workflows/release.yml + helios/native/roce_proxy_dlopen.c 236 new lines of dlopen trampolines + helios/build.rs), (3) Selene/helios host budgeting rework, (4) an eos THP ordering tweak. Each is defensible on its own (all are "reproducible bug"-class), but the charter's supported matrix is SM103/SM120/SM121 and DGX Spark, and items (2) and the SoC parts of (3) explicitly target Jetson Orin GA10B / 8–32 GiB SoCs, which the charter names nowhere as a target (charter Goals: "SM103, SM120, and SM121"; Non-Goals: "Broad production coverage across arbitrary models, GPUs, or deployment setups… require an explicit maintainer sign-off"). The new 236-line vendored dlopen shim is also a new indirection layer in native code ("Reject unsupported abstractions and churn… Do not add frameworks, extension points, speculative compatibility, fallback layers"). Evidence of a maintainer request or sign-off for the Orin/JetPack target is not in the PR description.

Recommendation: this needs the maintainer sign-off named in the charter's Non-Goals before merge, or the Orin/GA10B-only parts should be split out and land separately from the release-portability and CUDA-12 fixes. Not a defect in the code; record as a scope finding, and request that the PR description state which of the four is the maintainer-requested outcome.

#5 [high] Should fix: the targeted aarch64 JetPack 6 build/smoke check was not run, and the shim applies to all targets

Scope/churn and evidence concerns for the release change:

#7 [high] Research summary

Reviewed PR #589 through the architecture-and-scope lens against the charter, AGENTS.md's rejection criteria, and docs/design-review.md, reading each changed file in context (cuda.rs, memory.rs, model.rs, offload/mod.rs+registrar.rs, selene offload.rs/slab.rs/registrar.rs/tests.rs (not opened), eos/unix.rs (not opened), roce.rs, build.rs, the dlopen shim, release.yml and the four docs).

Two should-fix findings confirmed in code: (1) is_host_numa_unsupported (cuda.rs:532-537) treats generic CUDA_ERROR_INVALID_VALUE (1) as "platform unsupported" at four call sites, so a genuine argument bug degrades into a silent path substitution into a different pool strategy — rejected by the "no silently substituted execution paths" rule, and inconsistent with cuMemMap/cuMemAddressReserve which still hard-error; (2) the copy_batch doc comment (cuda.rs:781-786) still asserts every address is a device address and that raw host CPU addresses are not passed, which is precisely the case the new cuMemcpyAsync fallback is justified by — a stale # Safety contract on an unsafe fn.

Scope/evidence: the PR bundles four independent outcomes, and the release-portability and SoC-budgeting parts extend support to Jetson Orin GA10B / 8–32 GiB SoCs that the charter names nowhere while listing SM103/SM120/SM121 and DGX Spark; the charter requires explicit maintainer sign-off for broadened hardware support, and no request or sign-off is stated. The 236-line vendored dlopen shim is a new native indirection layer applied to all targets rather than just aarch64, and the headline claim's own check — a native aarch64 --features roce build plus the arm64 release job — is listed by the author as unrun, which design-review.md says disclosure does not excuse.

Nits recorded: dead host_pool_budget_with_reserve public API, and the duplicated headroom_with_inputs / *_for_budget + Option<u64> wrapper stack. The eos map_host change and the budget arithmetic were verified and have no concrete defect; the tier_host round trip through planned_offload_host is sound but deserves a comment explaining the invariant.

#8 [high] Should fix: docs state arm64 JetPack 6 support as qualified on unrun evidence

docs/release.md (as changed, lines ~27-35) now states: "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 (~47-56) states both builds load libibverbs lazily so "single-host serving runs without RDMA packages" without qualification.

Why this is a finding: AGENTS.md lines 53-60 ("Required prose review") require documents to "State support as present qualification: what is implemented, the hardware and configurations on which it is qualified, and what is not qualified." The PR's own evidence section lists as unrun "Native aarch64 build and ubuntu-24.04-arm CI run" and "Stock JetPack 6 ARM64 hosts" is under "Expected on hardware not tested here". So the docs claim JetPack 6 coverage while the only supporting evidence is (a) an x86_64 22.04 container build and (b) an ELF symbol-version read on the amd64 artifact. Nothing in the evidence establishes the arm64 archive's glibc ceiling, its absence of a libibverbs DT_NEEDED entry, or that it starts on JetPack 6.

Fix: either run the arm64 release job (release.yml already has os: ubuntu-24.04-arm at line 46 and does the ELF/GLIBC checks for every matrix leg) before merge and then keep the wording, or qualify docs/release.md and docs/multi-host.md to state arm64 as built but not yet qualified on JetPack 6, with the unrun check recorded per AGENTS.md lines 58-60 (docs/TODO.txt, not the design docs).

Secondary docs-consistency nit: docs/prefix-cache-offload.md (~1138-1143) now describes the reserve as "64 MiB at or below 16 GiB total RAM, min(2 GiB, total/32) above 16 GiB", which matches host_service_headroom_bytes (selene/src/offload.rs:806-815) — consistent. But the same document at ~646-652 lists the CUDA entry points and now says the batch fallback is "per-entry cuMemcpyAsync"; it does not mention that cuMemcpyAsync is now a required symbol loaded by Driver::load (helios/src/cuda.rs ~300), so a driver missing it fails at load rather than at copy time. Add that to the symbol list.

#4 [medium] Verified: eos map_host THP ordering has no concrete defect

eos/src/unix.rs:85-119 removed MAP_POPULATE and added madvise(MADV_POPULATE_WRITE) (106) plus a page-stride write_volatile(0) fallback (109-117).

Conclusion: no concrete defect in eos/src/unix.rs. The ordering claim (MADV_HUGEPAGE before fault) is verified by the code path 102-117 and the new test reads /proc/self/smaps VmFlags for hg.

#6 [medium] Nit: dead host_pool_budget_with_reserve and duplicated headroom wrappers

Budgeting path (verified against code):

#9 [medium] Citations: release workflow, build.rs, roce.rs and the dlopen shim

Precise citations for the release-engineering findings in entry 5: