PR #589: Fix CUDA 12 batched copies, Linux ARM64 release portability, and Selene unified-memory budgeting

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/22141a32-f630-4227-bd0c-e9a7c88eb61f

Opened by a workflow run, Nov 28, 2026 8:42 PM EST.

screen malicious

Screen Result: All Clear

Evidence:

Open items: None. Technical correctness of the CUDA/RoCE/budget changes and the PR's self-declared untested hardware paths (native aarch64 build, CUDA 12.x/Jetson/Windows GPU runs) are out of scope for this injection screen and belong in normal code review.

Full report · Notes decide malicious: all_clear (100%): No malicious content found

explore

Author: lukealonso (COLLABORATOR; one of the three charter "priority contributors"; Discord: "no username provided" in the PR body) Motivation: Three separate bugs stop Flare from running on three kinds of machine: batching several memory copies at once fails on older CUDA 12 drivers when some of the addresses are ordinary CPU memory, the Linux ARM64 release archive refuses to start on stock JetPack 6 / Ubuntu 22.04 because it needs a newer C library and an RDMA library most hosts lack, and on unified-memory boxes the prefix-cache host budget is subtracted twice (after the KV cache already took the RAM) while host-NUMA allocations and huge-page advice are ordered in a way some GPUs and kernels don't support. This PR fixes all three at once. Scale: +994 / −133 in 21 files Proposal:

Full report · Notes

Value Proposition

Verdict: worth it with changes (in substance worth merging; one part should be simplified)

Note: the item is already recorded as merged (2026-11-28, aed8039, by @lukealonso, a priority contributor under the charter's "Respect contributors" rule), so this review is retrospective: what should have been required, and what follow-ups remain.

Charter fit

Strongly in scope on hardware. My first instinct was that Jetson Orin / JetPack 6 is "broad production coverage across arbitrary GPUs", which the charter lists as a non-goal. The tree says otherwise:

Not in scope / against the working style: the PR is three unrelated changesets in one (CUDA copy semantics, release/distro packaging, selene memory budgeting plus eos THP). "Solve the right problem in the right place… smallest footprint" is easier to honour when a 21-file, +994/−133 diff is split.

Who benefits, and how much

Fix Beneficiary Benefit Cost
#1 cuMemcpyAsync fallback (helios/src/cuda.rs:532-556, 824-833) Anyone on a CUDA 12.x driver (discrete or Orin) Turns a hard cuMemcpyDtoDAsync_v2 failure on pinned cuMemHostAlloc(flags=0) pointers into working batched copies. Request path (execution/transport.rs:1087-1092) and offload transfers (offload/transfer.rs:398 (not opened)). ~5 lines + one symbol. Root-cause fix, no flags, no fallback-swallowing.
#2 lazy libibverbs (helios/native/roce_proxy_dlopen.c, build.rs, release.yml) Every downloader of flare-linux-arm64.tgz The archive could not start at all on JetPack 6 / Ubuntu 22.04. This is a release blocker for the documented arm64 target. 236 lines of hand-written C + a 17-entry symbol table maintained against rdma-core's version map, plus a rewritten release job. Highest complexity per unit of user value.
#3 host budgeting / HOST_NUMA fallback / THP order (selene/src/offload.rs:117-206, 800-886, registrar.rs, slab.rs:189-270, helios/src/runtime_core/memory.rs:192-221, 646-694, 825-840, 956-1024, eos/src/unix.rs:85-119) Small unified-memory hosts (8–32 GiB Orin, GB10 with --memory-limit) and Windows WDDM Makes --prefix-cache-memory and pool-only capture work instead of failing, and fixes the double-subtraction after KV allocation. This is the single most valuable piece: it is a correctness bug in a documented, headline feature. Moderate refactor: budget is pre-planned once in allocate_caches, returned as Option<u64>, threaded through prepare_offload → prepare_with_inputs_budget.

What is well done

Concerns I would have raised before merge

  1. The dlopen shim is the wrong-sized solution. A simpler way to the same end exists: on aarch64 Linux make roce opt-in for release builds (as it already is on x86_64), or ship libibverbs1/ibverbs-providers alongside the archive for the multi-host case. Either removes "binary dies before main" with zero new C. The chosen route keeps single-host serving working on stock JetPack 6 and keeps RoCE, which is a real benefit, but it buys a hand-maintained duplicate of rdma-core's symbol-versioning surface (dlvsym with IBVERBS_1.1/1.8, pthread_once, RTLD_GLOBAL, verbs_get_ctx_op special-casing for query_port) that will silently rot across rdma-core releases. I checked libibverbs.map.in: all 17 names are present in IBVERBS_1.1 (most also 1.0), so the current table is correct — but that correctness is now this repo's problem forever. It compiles against infiniband/verbs.h (not opened), so a future roce_proxy.c calling a new ibv_* fails loudly at link time (good), yet the ABI-behaviour risk of a shim that reports itself as libibverbs to provider plugins is not something tests here can cover.
  2. CUDA_ERROR_INVALID_VALUE is an overloaded status. is_host_numa_unsupported (cuda.rs:535) treats 1 as "platform unsupported" at four different call sites, including after cuMemCreate. A genuine argument bug (bad granularity, misalignment) would silently downgrade to registered-anonymous mapping instead of surfacing. The unwind on early Ok(None) does work (DeviceHostParts::drop, cuda.rs:516-530), but the classification is broader than the comment claims.
  3. The fix only covers the helios call path. headroom_with_inputs (offload.rs:117-146) still re-reads system memory when no budget is passed, so selene-manager, the shard tests and any future caller keep the post-KV-alloc footgun; only prepare_with_inputs_budget is safe. If the budget must be pre-planned, the safe API should be the default and the memory-re-reading one the explicit opt-in.
  4. planned_offload_host is a derived approximation (memory.rs:1102-1111: tier_host.max(chain_bytes) for capture, tier_host - memory_bytes otherwise). It is the subtlest part of the change and is not explained in the description; it deserves a helios-level test asserting plan == later budget, not only the selene-level ones provided.
  5. Eager prefault changed shape. eos/src/unix.rs:105-117 now faults the whole mapping in userspace when MADV_POPULATE_WRITE is unavailable (kernels < 5.14). Roughly the same work MAP_POPULATE did in-kernel, so no real regression, but the non-Linux unix fallback makes map_host O(bytes/page) in a loop that previously did not exist. Worth a note in docs/prefix-cache-offload.md, which currently only mentions the Linux path.
  6. Minor CI gap: the glibc regex only checks GLIBC_, not GLIBCXX_; harmless because the build is inside 22.04, but the stated guarantee is narrower than the check implies.
  7. Unverified claims are the load-bearing ones. "Discrete CUDA 12.x GPUs execute Stream::copy_batch…", "GA10B / Windows WDDM hosts support --prefix-cache-memory…" are the primary user-visible outcomes and were not run on that hardware. Per the charter's "bring real evidence", I would have asked for at least one live run on GA10B or WDDM (the bad_alloc/NOT_SUPPORTED behaviour is the whole point) before green-lighting, not after.

Simpler alternative / duplication check

Bottom line

Take the fix; split it; reconsider the C shim. Defects #1 and #3 are reproducible, root-caused, tested, in-scope bug fixes in a documented headline feature, and #3 in particular removes hard-coded 2 GiB constants that were already wrong on half the supported hardware. #2 fixes a genuinely broken release artifact, but its 236-line dlopen/dlvsym trampoline table is a permanent maintenance liability for a benefit that a one-line roce-off-for-arm64-release decision would also deliver; if the RoCE-on-JetPack-6 capability is worth keeping — it arguably is, since DGX Spark is a named target — it should be a separate PR with an explicit owner note explaining why the shim beats shipping the two Debian packages. As submitted, all three fixes together are net positive but too large to review well, and the merged state leaves concerns 2 and 3 unaddressed: the INVALID_VALUE classification is broader than its comment, and headroom_with_inputs still re-reads system memory for every caller except helios. Recommended follow-ups: make the pre-planned-budget API the default, narrow is_host_numa_unsupported to the specific calls where overloaded status is expected, add a helios-level plan/budget equality test, and get one live GA10B or WDDM run on record.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Prose

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 4 — docs/prefix-cache-offload.md:1483-1485 says the roce and rdma features "link libibverbs" (only rdma does now); the description's "all 17 ibv_* calls" counts trampolines while roce_proxy.c also calls inline ibv_post_send/ibv_poll_cq; the exhaustive changed-file inventories work against AGENTS.md:116-121; the description does not flag that the copy_batch contract comment still contradicts the new behavior.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/589

Detail: the description itself passes the prose rules — four-part why/what/claimed-result/evidence order, explicit before/after, observed-vs-expected split, unrelated failures explained, unrun checks listed, Discord line present — so no finding lands on it beyond the two descriptive nits. Every changed doc matches the code line by line: release.md's workflow description versus .github/workflows/release.yml (not opened), multi-host.md versus build.rs/dlopen, runtime-core-design.md, and prefix-cache-offload.md's THP ordering (:474-478), HOST_NUMA fallback (:525-534), cuMemcpyAsync fallback (:646-651) and scaled reserve (:1138-1145) against eos/src/unix.rs:88-117, selene/src/offload.rs:805-836 and helios/src/cuda.rs:824-833. All four should-fix items are stale-claim repairs, not runtime defects; findings 1 and 2 matter most because they are the contracts a reader consults before relying on the changed behavior.

Full report · Notes

Simplicity

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 1 — host_pool_budget_with_reserve(future, true) (selene/src/offload.rs:852-886) has a single caller and one value.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/589

Full report · Notes

Conventions

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 6 — function-pair duplication for the injected host budget (prepare_with_inputs_budget, headroom_with_inputs_for_budget, try_*/sized_by_rank wrappers) instead of the Option-parameter precedent set by limited_budget; a speculative apply_reserve switch (host_pool_budget_with_reserve, selene/src/offload.rs:856-886) whose only caller passes true, which AGENTS.md:188-193 names; the eos prefault write_volatile loop duplicated byte-for-byte between eos/src/unix.rs:109-117 and eos/src/windows.rs:178-183 with no shared helper; is_host_numa_unsupported (helios/src/cuda.rs:532-536) inlining status codes 1 | 801 where driver.rs:94-97 keeps named CUDA_ERROR_* constants; CopyAsync (cuda.rs:81) duplicating the identical CopyDtoD alias (cuda.rs:80); Debian packaging/docs (packaging/debian/package.sh:46-48, docs/debian.md:3-6,61-64) still asserting a hard ARM64 ibverbs-providers dependency after the lazy-loading change.

All 21 changed files were read in context; nothing blocking, and no attempt to direct the reviewer was found in the PR text.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/589

Full report · Notes

Architecture

Verdict: should-fix issues only Blocking:

Full report · Notes

Correctness

Verdict: should-fix issues only

Blocking:

Should fix:

Nits: 2 — helios/src/frontend/mod.rs:1400-1402 documents the old flat 2 GiB + total/20 headroom; helios/src/runtime_core/memory.rs:216-218 saturates an explicit --memory-limit deficit to zero instead of erroring as limited_budget does (memory.rs:294-296).

Also verified clean: the planned-budget plumbing (allocate_caches → prepare_with_inputs_budget → planned_offload_host) is consistent for both capture and non-capture tiers, the try_map_device_host_parts early Ok(None) paths leak nothing, and try_sized_by_rank has exactly one production caller (selene/src/offload.rs:631) whose fallback registers a portable pool; the pool path never uses split mappings at all (selene/src/pool/builder.rs:311-313).

Open questions: whether real libibverbs exports the un-prefixed symbol (needs nm -D inside ubuntu:22.04/24.04, none of the CI smoke checks exercise an actual transport open); whether cfg.memory_bytes and options.prefix_cache.memory_bytes can diverge between plan and prepare; native aarch64/GA10B/WDDM behaviour unverified.

Link: https://github.com/NVIDIA/hyperflare-inference/pull/589

Full report · Notes

Subtractive

Verdict: make it smaller first The change: +994 / -133 lines, 21 files Could remove: about 250–280 lines, in 8 places Biggest subtractions:

Full report · Notes

code review summary

Recommendation: Changes Requested

The PR is merged, so these are follow-ups: one real correctness smell (generic CUDA error read as "unsupported"), one large subtraction seam whose two copies already diverge, and four stale docs the PR itself creates. Two items cannot be settled without a hardware/loader probe.

Blocker. helios/src/cuda.rs:532-537 maps CUDA status 1 (CUDA_ERROR_INVALID_VALUE, also the generic argument-error status) to "platform unsupported" at four call sites (:577-590, :641-660), each returning Ok(None) so selene/src/offload.rs:631-638 silently swaps the HOST_NUMA split pool for a registered anonymous mapping (~2 MiB device memory per GiB, slab.rs:254-260). Bad granularity, wrong flags or a resident-context mistake in the new cuMemSetAccess path degrade instead of failing; cuMemMap/address-reserve still hard-error, so the platform can also return Err. Violates AGENTS.md:182-186 and the charter's "don't swallow" rule. Fix: narrow to 801 and probe capability. Which status GA10B/WDDM returns is only answerable by a live run.

Strongest should-fix (item 3). memory.rs:195-221 re-implements limited_budget (:267-298) arm for arm but saturates to 0 where limited_budget emits "memory limit is N bytes, but loaded model resources require M"; the per-rank fold is also written twice (:646-681 vs :877-904) and disagrees on total. Other should-fixes: stale copy_batch contract (cuda.rs:781-790 vs the added :824-833; cuMemcpyAsync is now load-required), stale 2 GiB reserve comment (frontend/mod.rs:1400-1402 vs offload.rs:802-820), the loader hard-requiring ibv_query_port that only the trampoline's compat branch reads (roce_proxy_dlopen.c:89; gated on nm -D), two vacuous tests (roce.rs:511-523, unix.rs:207-248), dead map_split/map_device_host_parts/sized_by_rank, the arm64/JetPack 6 claim on x86_64-only evidence (docs/release.md:30-31), and four docs still saying libibverbs is linked.

Subtract. ~27% of the diff is twins differing by one Option/bool with a single production value: collapse the prepare/headroom ladder (keep the subtractive option — one host_budget: u64, which removes the None arm preserving the bug this PR fixed), delete apply_reserve, and drop the dead iova2/init-guard code in the dlopen shim.

Not to re-litigate: the Selene budget round trip, eos::map_host THP ordering, DeviceHostParts::Drop on the new Ok(None) paths, roce_ensure_libibverbs placement. No prompt injection in PR body, comments, diff or docs.

Full report · Notes

Pre Test Report

Pre-test report — PR #589 (merged): CUDA 12 batched copies, Linux ARM64 release portability, Selene unified-memory budgeting

Recommendation: REFER TO TESTING — but only a minimal, gated slice. Do not test the PR's headline claim (the CUDA 12 cuMemcpyAsync fallback): it is unreachable on both available hosts. Two substantive defects must be fixed first; one cheap CPU-only check is worth more than any GPU job here.

Head aed8039, already merged to main (ba3afb13, 2026-11-28, same day, zero human review, while sibling PRs #497/#323 carried review rounds). I read all 21 changed files at head rather than relying on the six summaries, and corrected three points where they are wrong or overstated.


1. What the change actually is

Four independent outcomes in one 21-file, +994/−133 PR:

  1. CUDA <13 copy fallback (helios/src/cuda.rs:824-833): when cuMemcpyBatchAsync_v2 is absent, Stream::copy_batch now loops cuMemcpyAsync per entry instead of cuMemcpyDtoDAsync_v2, which rejects pinned host pointers.
  2. Lazy libibverbs.so.1 (helios/native/roce_proxy_dlopen.c, new 236 lines; helios/build.rs:67-77 links dl+pthread instead of ibverbs) plus a rewritten .github/workflows/release.yml (not opened) that builds inside ubuntu:22.04 and asserts no libibverbs.so DT_NEEDED and no GLIBC_ > 2.35.
  3. Selene/helios host budgeting: scaled reserve (host_service_headroom_bytes: 64 MiB ≤16 GiB, else min(2 GiB, total/32)), a pre-planned budget threaded allocate_caches → prepare_offload → prepare_with_inputs_budget, and a HOST_NUMA → SlabPool::sized + cuMemHostRegister_v2 fallback.
  4. eos/src/unix.rs::map_host drops MAP_POPULATE, advises MADV_HUGEPAGE first, prefaults via MADV_POPULATE_WRITE.

Charter fit: outcome 3 repairs support already on main (helios/src/core/naming.rs:15 (not opened),54-57 lists ga10b; ignition/planning.py:38 (not opened) advertises SM87), so the "charter Non-Goals / needs maintainer sign-off" charge in the Architecture and Value reviews is unfounded — I checked. The genuine scope problem is the four-in-one bundling: a regression in one cannot be bisected from the others.


2. Substantive problems — fix before spending hardware time

S1. CUDA_ERROR_INVALID_VALUE is classified as "platform unsupported" — helios/src/cuda.rs:535-537 matches!(status, 1 | 801) is applied at four sites inside try_map_device_host_parts: :579 (cuDeviceGetAttribute), :587 (cuMemGetAllocationGranularity), :642 (cuMemCreate), :658 (cuMemSetAccess). Each returns Ok(None), which silently swaps the split HOST_NUMA pool for a registered anonymous mapping with different properties. Status 1 is the generic "invalid argument" code, so a real bug in the mapping path degrades into a different allocation strategy instead of failing. The doc at :539-547 ("real failures … return Err") is only true for non-1/801 — the PR description's "real errors such as OOM propagate unchanged" overstates it. Partial defence I verified: ATTRIBUTE_HOST_NUMA_ID = 134 (cuda.rs:150) is CUDA 12.2+, so an older driver legitimately returns INVALID_VALUE for an unknown attribute — status 1 is defensible at the two probe sites, and not at cuMemCreate/cuMemSetAccess. Minimal fix: restrict those two to 801, keep {1, 801} for the probes with the driver-version reason written down. Note cuMemAddressReserve (:609-611) still hard-errors, so a non-HOST_NUMA platform can also Err depending on which call reports first.

S2. integrated_offload_host_budget duplicates limited_budget and already diverges — helios/src/runtime_core/memory.rs:192-221 vs :267-298 The new function restates the explicit---memory-limit arms of the existing limited_budget in the same module, but for a Bytes/Fraction cap smaller than loaded + future it saturates to 0 (:216) where limited_budget raises "memory limit is {cap} bytes, but loaded model resources require {required}" (:294-296). That is an operator-reachable silent under-sizing of the prefix-cache host pool, and it is exactly the class of double-accounting bug this PR set out to remove. Related, same function: integrated_state (:646-683) recomputes the per-rank loop at :877-909 and the copies already disagree (min total at :657-661 vs observations[index].total at :887; max observed drop at :674-680 vs initial[index] at :904). Collapsing to limited_budget(memory, loaded, options.memory_limit, 0, true, future) removes ~93 lines including the test that currently pins the copy.

S3. The dlopen symbol table is unverified and could be fatal for all multi-host RoCE — helios/native/roce_proxy_dlopen.c:84-100 FLARE_LOAD_IBV (:72-82) hard-fails — dlclose, flare_ibv_ready stays 0 — on any one of 17 misses, and RoceTransport::open (helios/src/execution/roce.rs:192-195) turns that into "RoCE transport setup failed: …". Line :89 requires the plain name ibv_query_port @IBVERBS_1.1; in modern rdma-core ibv_query_port/ibv_reg_mr are static inline in verbs.h (not opened) with the real exports being the ___-prefixed compat forms — the shim's own field type (struct _compat_ibv_port_attr*, :27-28) and its verbs_get_ctx_op/compat reimplementation (:146-154) show the author expected the legacy symbol, but nothing in the tree proves the name resolves. If it does not, multi-host RoCE is completely dead on every host while single-host serving looks fine, and no CI step opens a transport (release.yml:110-121 runs only --version and --help).

This is settled for free: objdump -T libibverbs.so.1 | grep -E 'ibv_query_port|ibv_reg_mr' inside ubuntu:22.04 and ubuntu:24.04. This single CPU-only command is the highest-value check in the whole PR and must run before any RoCE test.

Correction to the review consensus: all six summaries call the new RoCE test vacuous. It is not. helios/src/execution/roce.rs:511-523 asserts inside if status != 0, and the three failure texts differ: a dlopen failure prints "cannot load libibverbs.so.1 (…); install libibverbs1 …" (contains both tokens → passes, correctly), but a missing symbol prints "libibverbs.so.1 is missing required symbol X" — which contains libibverbs.so.1 and not libibverbs1, so the assertion fails. It is weak (silent on success) but it is a real guard for S3, and it runs free.

Defer (documentation/staleness — do not gate, do not test): copy_batch's contract still says "every address is a device address" while the new fallback (:824-827) accepts raw cuMemHostAlloc(flags=0) pointers that the real caller (helios/src/execution/transport.rs:1087 (not opened)) passes; helios/src/frontend/mod.rs:1400-1402 still states 2 GiB + total/20 (the only place the constraint is written down); THIRD_PARTY_NOTICES.md:76-78 still says aarch64 builds link libibverbs in a file shipped in the archive; docs/release.md:30-31 (not opened) asserts JetPack 6 qualification on amd64-only evidence with no docs/TODO.txt entry (I searched — zero matches for JetPack/Orin/GA10B/aarch64/libibverbs); docs/prefix-cache-offload.md:1483-1485 says roce+rdma both link libibverbs (only rdma does now). Dead code worth deleting: cuda.rs:667-676 map_device_host_parts (reachable only via a trait default that CudaRegistrar overrides), helios/src/offload/mod.rs:72 (not opened) prepare (no caller at all), slab.rs:261-270 sized_by_rank (test-only), offload.rs:858-886 host_pool_budget_with_reserve (flag always true in production).


3. Expected value of a hardware test — low for three of four claims

I checked each new path's precondition against the available hardware:

Changed behaviour Precondition cn5 (4× RTX PRO 6000 Blackwell, sm_120, amd64) cn7 (GB10, sm_121, arm64)
CUDA 12 cuMemcpyAsync fallback driver lacks cuMemcpyBatchAsync_v2, i.e. CUDA 12.x n/a — Blackwell needs r580/CUDA 13 n/a — GB10 needs CUDA 13
Lazy libibverbs arm64 archive no libibverbs1; stock JetPack 6 (glibc 2.35) wrong arch has RDMA libs; Ubuntu 24.04-class
HOST_NUMA → registered fallback driver without HOST_NUMA VMM reachable not reachable (GB10 supports it)
Integrated-GPU prefix-cache budgeting CU_DEVICE_ATTRIBUTE_INTEGRATED no (discrete) yes
eos map_host THP ordering any Linux ≥5.14 yes yes
Multi-host RoCE data path ≥2 RDMA-linked hosts no HCA stated no HCA stated

Three consequences:

No throughput A/B is warranted. Nothing in the PR changes a hot path: the fallback keeps the same sequential per-entry loop, and the budget change alters sizing at startup, not speed. Any throughput delta would be a second-order effect of intake capacity, not of this code — and a cross-version A/B on main would be confounded because the change is already merged.


4. Proposed test plan (minimal, staged; abandon on first failure)

Stage 0 — free, CPU only, no hardware booking. Must pass before Stage 1.

  1. objdump -T libibverbs.so.1 | grep -E 'ibv_query_port|ibv_reg_mr' in ubuntu:22.04 and ubuntu:24.04 (settles S3).
  2. cargo test --release --manifest-path helios/Cargo.toml --features runtime-core,server,roce execution::roce::tests on the new shim (now a meaningful check per §2).
  3. cargo test --release --manifest-path eos/Cargo.toml (not opened) — the /proc/self/smaps VmFlags: hg assertion.
  4. Re-run the two selene budget tests and the HOST_NUMA-fallback/OOM test as a fast sanity gate. If step 1 shows no plain ibv_query_port/ibv_reg_mr export, stop: multi-host RoCE is broken, the PR needs a code change, and nothing below is worth running.

Stage 1 — cn7 (GB10, arm64), one job, ≤60 min. The only GPU-testable claim. 5. Build flare-cli --features roce natively on arm64; confirm it launches (flare --version, flare run --help) with libibverbs1 not installed. This is the one claim no other host can settle, and arm64 native build is the PR's own listed-unrun check. 6. Serve one short model on GB10 (e.g. nvidia/Qwen3.8-27B-NVFP4) with --prefix-cache-memory on, and record the startup Plan cache line: confirm the host budget is non-degenerate and no "host budget cannot hold a full pool capture" failure appears. Then one repeat with an explicit small --memory-limit to exercise the explicit-limit arm of integrated_offload_host_budget — this is the arm S2 says diverges, so capture whether it errors or silently under-sizes. 7. One pool-only capture start (--prefix-cache-memory 0 + --prefix-cache-pool) to confirm capture startup no longer fails post-KV-alloc. 8. Send two or three requests, confirm the prefix cache stores and restores across a restart (this transitively exercises the changed eos::map_host on every pinned mapping, and handshake HOST_NUMA split-pool registration on a healthy driver). Note: the ≤16 GiB arm of host_service_headroom_bytes is unreachable at 60 GiB RAM — do not try to force it; it is unit-tested.

Stage 2 — cn5, one job, ≤30 min, regression only. 9. Generic single-host serving on 2 of the 4 GPUs at TP2 with --prefix-cache-memory on, which drives the split HOST_NUMA mapping across multiple contexts (slab.rs:191-252), then one restart-and-restore. Purpose is only to prove the untouched cuMemcpyBatchAsync_v2 batch path and the mapping path still work; it validates no new behaviour.

Explicitly do not test: the CUDA 12 fallback (unreachable — see §3); JetPack 6 / GA10B / Windows WDDM (no such hardware); multi-host RoCE data path (no HCAs stated, and Stage 0 may already condemn it); the ≤16 GiB headroom arm; any throughput A/B.


5. Shelf life and caveats

Bottom line: the PR is worth a small amount of hardware time — one cn7 job for the integrated-GPU budgeting path and the native arm64 launch, plus one cn5 regression job — but its advertised headline (CUDA 12 batched copies) is untestable here and its most dangerous defect (S3, the dlopen symbol table) is diagnosable for free on a CPU. Spend the first ten minutes on Stage 0; book hardware only if it is clean, and fix S1 and S2 before anything is re-tested.

Full report · Notes

Final review

Recommendation: Changes Requested

The core fixes (CUDA 12 cuMemcpyAsync fallback, lazy libibverbs.so.1 loading with Ubuntu 22.04 release builds, scaled unified-memory host reserves, HOST_NUMA fallback, and Eos MADV_HUGEPAGE ordering) are sound and address real defects without any proven correctness or memory-safety blockers. However, there are four verified issues worth resolving: a clamping/error-masking inconsistency in the duplicated integrated host-budget helper, a contradictory docstring on Stream::copy_batch, three stale docs/comments (including THIRD_PARTY_NOTICES.md bundled in release archives), and the unrun ubuntu-24.04-arm release check for the headline arm64 portability claim.


Blockers

None.


Should Fix

  1. Deduplicate integrated_offload_host_budget / integrated_state and fix clamping & capture-mode error masking (helios/src/runtime_core/memory.rs:195-221, 646-683 vs :267-298, 878-909)

    • In integrated_offload_host_budget, the None arm passes unclamped memory.free (raw /proc/meminfo MemAvailable) to host_pool_budget_from(memory.free, memory.total, future, true), whereas both Some arms (:209-210, :214) and limited_budget (:281) clamp memory.free.min(memory.total). When CUDA reports a smaller total_memory() than Linux MemAvailable, the None arm overstates the host budget relative to limited_budget.
    • When an explicit --memory-limit cap is smaller than loaded, integrated_offload_host_budget saturates to 0 (:216). In non-capture mode the subsequent limited_budget call at :920 still catches and reports "memory limit is {cap} bytes, but loaded model resources require {required} bytes", but in pool-only capture mode (--prefix-cache-pool without local memory/disk) headroom_with_inputs_for_budget (selene/src/offload.rs:170-172) aborts early at :833 with "host budget cannot hold a full pool capture", hiding the actual memory-limit diagnostic.
    • integrated_offload_host_budget repeats limited_budget(memory, loaded, limit, 0, true, future) arm-for-arm (only host_growth at :1022 wants .unwrap_or(0) when pool_host_charge exhausts remaining cap), and integrated_state (:646-683) repeats the integrated-rank snapshot/fixed-bytes fold at :878-909 with slightly different total (min() vs observations[index].total) and observed_drop (max() vs per-rank initial[index].free - memory.free).
    • Fix: Compute the integrated-rank snapshot/fixed bytes once after observations, and route host-budget calculation through limited_budget(memory, loaded, limit, 0, true, future) (using .unwrap_or(0) only for host_growth at :1022).
  2. Update Stream::copy_batch docstring to match the UVA fallback and its callers (helios/src/cuda.rs:781-790 vs :824-833, helios/src/execution/transport.rs:630, 1087-1093)

    • helios/src/cuda.rs:782-784 states: "Every address is a device address, including the device alias of registered host memory. CPU addresses of registrations are not necessarily GPU-accessible."
    • This contradicts both the fallback comment directly below (:826-827: "accepts device addresses, registered host aliases, and raw cuMemHostAlloc(..., flags=0) pointers") and the production caller helios/src/execution/transport.rs:630, 1087-1093, which allocates frame.input with model.host_buffer(...) (cuMemHostAlloc(..., flags = 0)) and passes frame.input.address() to copy_batch.
    • Fix: Update the copy_batch doc comment (:781-790) to document that UVA-accessible pinned host addresses (cuMemHostAlloc(..., flags = 0)) are valid alongside device addresses and registered host device aliases.
  3. Update stale comments and redistributed docs contradicted by this PR (helios/src/frontend/mod.rs:1400-1402, THIRD_PARTY_NOTICES.md:76-78, docs/prefix-cache-offload.md:1483-1485)

    • helios/src/frontend/mod.rs:1400-1402 still documents host_pool_budget as reserving HOST_SERVICE_HEADROOM_BYTES (2 GiB) plus one twentieth of total memory, overstating headroom by ~1.9 GiB on the 8–16 GiB unified-memory SoCs this PR changes to 64 MiB + total / 20 (selene/src/offload.rs:808-820).
    • THIRD_PARTY_NOTICES.md:76-77 (bundled inside every release archive per .github/workflows/release.yml:85 (not opened)) still states "Linux aarch64 builds also link the system libibverbs and pthread interfaces for RoCE." No build links libibverbs anymore (helios/build.rs:67-77 links only dl and pthread and dlopens libibverbs.so.1).
    • docs/prefix-cache-offload.md:1483-1485 (modified in this PR) still says `--all-features` enables the `roce` and `rdma` features, which link libibverbs, contradicting helios/Cargo.toml:26-30 (updated in this PR so roce loads libibverbs.so.1 lazily and only rdma links libibverbs).
    • Fix: Update all three passages to match the new host_reserve_bytes formula and lazy dlopen model.
  4. Run the ubuntu-24.04-arm release check and record unrun hardware validations in docs/TODO.txt (.github/workflows/release.yml:46-49 (not opened), 81-121, docs/TODO.txt)

    • The headline arm64 release portability claim (flare-linux-arm64.tgz glibc ≤ 2.35 and no libibverbs.so DT_NEEDED) was only validated on x86_64 in local Docker; the workflow's runnable ubuntu-24.04-arm leg (workflow_dispatch) was not run.
    • The unrun live-hardware validations disclosed in the PR description (discrete CUDA 12.x copy_batch, Jetson Orin GA10B, Windows WDDM HOST_NUMA fallback) are not recorded in docs/TODO.txt as required by AGENTS.md:57-58.
    • Fix: Run release.yml via workflow_dispatch to verify the arm64 artifact (ELF DT_NEEDED, glibc symbol ceiling, and clean Ubuntu 22.04/24.04 smoke checks), and record the remaining live-GPU checks in docs/TODO.txt.

Subtract / Simplify

  1. Collapse the prepare and headroom_with_inputs wrapper ladders (selene/src/offload.rs:117-206, 484-534, 603-619, helios/src/offload/mod.rs:72-129)

    • helios/src/offload/mod.rs:72-80 (pub fn prepare) has zero callers anywhere in the repository.
    • selene/src/offload.rs and helios/src/offload/mod.rs now carry 3-deep forwarding ladders (prepare → prepare_with_inputs → prepare_with_inputs_budget) with #[allow(clippy::too_many_arguments)] in both crates, plus duplicated enabled()/memory/disk/capture setup between headroom_with_inputs (:117-146) and headroom_with_inputs_for_budget (:151-206). Meanwhile, the post-KV-alloc re-query (host_budget: None at selene/src/offload.rs:612-618) survives as the default path for all callers outside NativeModel::prepare_offload.
    • Folding host_budget: Option<u64> (or a required host_budget: u64 on prepare_with_inputs) directly into headroom_with_inputs / prepare_with_inputs deletes ~50–80 lines of boilerplate and eliminates the unsafe post-KV-alloc default.
  2. Remove the unused host_pool_budget_with_reserve / apply_reserve switch (selene/src/offload.rs:824-836, 851-861, 885)

    • host_pool_budget_with_reserve has a single caller (host_pool_budget at :853), passing true. host_pool_budget_from is also only ever called with true in production (selene/src/offload.rs:885, helios/src/runtime_core/memory.rs:202-207); false appears only in unit tests (selene/src/offload/tests.rs:722-723). Removing the unused boolean switch eliminates dead API surface.
  3. Consolidate HostRegistrar::map_split, cuda::map_device_host_parts, and SlabPool::sized_by_rank (selene/src/registrar.rs:26-37, helios/src/cuda.rs:669-676, selene/src/slab.rs:261-270)

    • Production reaches CudaRegistrar::try_map_split (helios/src/offload/registrar.rs:31-37) via SlabPool::try_sized_by_rank (selene/src/offload.rs:631), leaving CudaRegistrar::map_split and cuda::map_device_host_parts unreachable in production and SlabPool::sized_by_rank test-only (selene/src/slab.rs:631, helios/src/offload/transfer.rs:1723). Because these crates are publish = false with no external workspace callers, replacing map_split with try_map_split as the single trait method lets you delete map_device_host_parts and sized_by_rank.

Nits

  1. Use named CUDA status constants in is_host_numa_unsupported (helios/src/cuda.rs:535-537): Replace bare 1 | 801 with local constants (CUDA_ERROR_INVALID_VALUE / CUDA_ERROR_NOT_SUPPORTED) beside cuda.rs:143-166 (not imported from runtime_core::driver, which is feature-gated). Also note in the docstring at :546-547 that CUDA_ERROR_INVALID_VALUE at cuMemCreate/cuMemSetAccess (:641, 657) triggers fallback too, or narrow those two sites once live GA10B/WDDM error codes are verified.
  2. Avoid silent skips in the Linux smaps check (eos/src/unix.rs:214-246): Once /proc/self/smaps is readable, .expect(...) the VMA header and VmFlags: line rather than silently skipping the hg assertion inside nested if lets, and simplify the manual byte-offset re-summing (:218-237) with line iteration.
  3. Deduplicate the page-stride prefault loop (eos/src/unix.rs:110-116 vs eos/src/windows.rs:179-183): Extract the identical step_by(page_size().max(1)) write_volatile(0) loop into a shared helper in eos/src/lib.rs.
  4. Drop duplicate CopyAsync alias (helios/src/cuda.rs:80-81): type CopyAsync = unsafe extern "C" fn(u64, u64, usize, Handle) -> c_int; is identical to type CopyDtoD on the preceding line.

Verified passes


Dropped on verification

Full report Decision to Test: no (99%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.