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
-
Deduplicate
integrated_offload_host_budget/integrated_stateand fix clamping & capture-mode error masking (helios/src/runtime_core/memory.rs:195-221, 646-683vs:267-298, 878-909)- In
integrated_offload_host_budget, theNonearm passes unclampedmemory.free(raw/proc/meminfoMemAvailable) tohost_pool_budget_from(memory.free, memory.total, future, true), whereas bothSomearms (:209-210,:214) andlimited_budget(:281) clampmemory.free.min(memory.total). When CUDA reports a smallertotal_memory()than LinuxMemAvailable, theNonearm overstates the host budget relative tolimited_budget. - When an explicit
--memory-limitcap is smaller thanloaded,integrated_offload_host_budgetsaturates to0(:216). In non-capture mode the subsequentlimited_budgetcall at:920still catches and reports"memory limit is {cap} bytes, but loaded model resources require {required} bytes", but in pool-only capture mode (--prefix-cache-poolwithout local memory/disk)headroom_with_inputs_for_budget(selene/src/offload.rs:170-172) aborts early at:833with"host budget cannot hold a full pool capture", hiding the actual memory-limit diagnostic. integrated_offload_host_budgetrepeatslimited_budget(memory, loaded, limit, 0, true, future)arm-for-arm (onlyhost_growthat:1022wants.unwrap_or(0)whenpool_host_chargeexhausts remaining cap), andintegrated_state(:646-683) repeats the integrated-rank snapshot/fixed-bytes fold at:878-909with slightly differenttotal(min()vsobservations[index].total) andobserved_drop(max()vs per-rankinitial[index].free - memory.free).- Fix: Compute the integrated-rank snapshot/fixed bytes once after
observations, and route host-budget calculation throughlimited_budget(memory, loaded, limit, 0, true, future)(using.unwrap_or(0)only forhost_growthat:1022).
- In
-
Update
Stream::copy_batchdocstring to match the UVA fallback and its callers (helios/src/cuda.rs:781-790vs:824-833,helios/src/execution/transport.rs:630, 1087-1093)helios/src/cuda.rs:782-784states:"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 callerhelios/src/execution/transport.rs:630, 1087-1093, which allocatesframe.inputwithmodel.host_buffer(...)(cuMemHostAlloc(..., flags = 0)) and passesframe.input.address()tocopy_batch. - Fix: Update the
copy_batchdoc comment (:781-790) to document that UVA-accessible pinned host addresses (cuMemHostAlloc(..., flags = 0)) are valid alongside device addresses and registered host device aliases.
-
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-1402still documentshost_pool_budgetas reservingHOST_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 to64 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 linkslibibverbsanymore (helios/build.rs:67-77links onlydlandpthreadanddlopenslibibverbs.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, contradictinghelios/Cargo.toml:26-30(updated in this PR soroceloadslibibverbs.so.1lazily and onlyrdmalinkslibibverbs).- Fix: Update all three passages to match the new
host_reserve_bytesformula and lazydlopenmodel.
-
Run the
ubuntu-24.04-armrelease check and record unrun hardware validations indocs/TODO.txt(.github/workflows/release.yml:46-49 (not opened), 81-121,docs/TODO.txt)- The headline arm64 release portability claim (
flare-linux-arm64.tgzglibc ≤ 2.35 and nolibibverbs.soDT_NEEDED) was only validated on x86_64 in local Docker; the workflow's runnableubuntu-24.04-armleg (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 WDDMHOST_NUMAfallback) are not recorded indocs/TODO.txtas required byAGENTS.md:57-58. - Fix: Run
release.ymlviaworkflow_dispatchto verify the arm64 artifact (ELFDT_NEEDED, glibc symbol ceiling, and clean Ubuntu 22.04/24.04 smoke checks), and record the remaining live-GPU checks indocs/TODO.txt.
- The headline arm64 release portability claim (
Subtract / Simplify
-
Collapse the
prepareandheadroom_with_inputswrapper 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.rsandhelios/src/offload/mod.rsnow carry 3-deep forwarding ladders (prepare→prepare_with_inputs→prepare_with_inputs_budget) with#[allow(clippy::too_many_arguments)]in both crates, plus duplicatedenabled()/memory/disk/capture setup betweenheadroom_with_inputs(:117-146) andheadroom_with_inputs_for_budget(:151-206). Meanwhile, the post-KV-alloc re-query (host_budget: Noneatselene/src/offload.rs:612-618) survives as the default path for all callers outsideNativeModel::prepare_offload.- Folding
host_budget: Option<u64>(or a requiredhost_budget: u64onprepare_with_inputs) directly intoheadroom_with_inputs/prepare_with_inputsdeletes ~50–80 lines of boilerplate and eliminates the unsafe post-KV-alloc default.
-
Remove the unused
host_pool_budget_with_reserve/apply_reserveswitch (selene/src/offload.rs:824-836, 851-861, 885)host_pool_budget_with_reservehas a single caller (host_pool_budgetat:853), passingtrue.host_pool_budget_fromis also only ever called withtruein production (selene/src/offload.rs:885,helios/src/runtime_core/memory.rs:202-207);falseappears only in unit tests (selene/src/offload/tests.rs:722-723). Removing the unused boolean switch eliminates dead API surface.
-
Consolidate
HostRegistrar::map_split,cuda::map_device_host_parts, andSlabPool::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) viaSlabPool::try_sized_by_rank(selene/src/offload.rs:631), leavingCudaRegistrar::map_splitandcuda::map_device_host_partsunreachable in production andSlabPool::sized_by_ranktest-only (selene/src/slab.rs:631,helios/src/offload/transfer.rs:1723). Because these crates arepublish = falsewith no external workspace callers, replacingmap_splitwithtry_map_splitas the single trait method lets you deletemap_device_host_partsandsized_by_rank.
- Production reaches
Nits
- Use named CUDA status constants in
is_host_numa_unsupported(helios/src/cuda.rs:535-537): Replace bare1 | 801with local constants (CUDA_ERROR_INVALID_VALUE/CUDA_ERROR_NOT_SUPPORTED) besidecuda.rs:143-166(not imported fromruntime_core::driver, which is feature-gated). Also note in the docstring at:546-547thatCUDA_ERROR_INVALID_VALUEatcuMemCreate/cuMemSetAccess(:641, 657) triggers fallback too, or narrow those two sites once live GA10B/WDDM error codes are verified. - Avoid silent skips in the Linux
smapscheck (eos/src/unix.rs:214-246): Once/proc/self/smapsis readable,.expect(...)the VMA header andVmFlags:line rather than silently skipping thehgassertion inside nestedif lets, and simplify the manual byte-offset re-summing (:218-237) with line iteration. - Deduplicate the page-stride prefault loop (
eos/src/unix.rs:110-116vseos/src/windows.rs:179-183): Extract the identicalstep_by(page_size().max(1))write_volatile(0)loop into a shared helper ineos/src/lib.rs. - Drop duplicate
CopyAsyncalias (helios/src/cuda.rs:80-81):type CopyAsync = unsafe extern "C" fn(u64, u64, usize, Handle) -> c_int;is identical totype CopyDtoDon the preceding line.
Verified passes
- CUDA 12
copy_batchfallback (helios/src/cuda.rs:303, 801-833): Correctly falls back to per-entrycuMemcpyAsyncwhencuMemcpyBatchAsync_v2is absent, whilecopy_dtod_asyncretainscuMemcpyDtoDAsync_v2. DeviceHostPartscleanup onOk(None)(helios/src/cuda.rs:516-530, 612-664):DeviceHostParts::dropunmaps mapped parts, releases handles, and frees the VA reservation on every earlyreturn Ok(None)path without leaking.- Selene pre-planned host budget round trip (
helios/src/runtime_core/memory.rs:825-857, 1102-1112→model.rs:909-918, 967-977→selene/src/offload.rs:603-622):planned_offload_hostmatches the budget reserved before KV allocation in both capture (tier_host.max(chain_bytes)) and non-capture (tier_host - memory_bytes) modes. roce_ensure_libibverbsplacement androce_proxy_dlopen.c(helios/src/execution/roce.rs:124-199,helios/native/roce_proxy_dlopen.c:58-128): Runs after ABI/layout/topology preflight and before zeroing the region or callingroce_create, keepshelios/native/roce_proxy.cunmodified, and exports noibv_*symbols.- Eos THP ordering (
eos/src/unix.rs:85-119): RemovesMAP_POPULATE, advisesMADV_HUGEPAGEprior to faulting, and prefaults viaMADV_POPULATE_WRITEon Linux with a clean fallback for older kernels (< 5.14) and non-Linux Unix. docs/multi-host.md:47-56anddocs/runtime-core-design.md:9-12: Accurately describe lazylibibverbs.so.1loading for single-host vs multi-host RoCE serving.
Dropped on verification
- Candidate Blocker #1 (
is_host_numa_unsupportedtreatingCUDA_ERROR_INVALID_VALUEas unsupported): Downgraded to Nit —cuDeviceGetAttribute(..., HOST_NUMA_ID),cuMemGetAllocationGranularity(..., HOST_NUMA), andcuMemCreate(..., HOST_NUMA)legitimately returnCUDA_ERROR_INVALID_VALUE(1) orCUDA_ERROR_NOT_SUPPORTED(801) on CUDA platforms withoutHOST_NUMAVMM support; narrowing to801without hardware verification risks breaking GA10B/WDDM, andOOM(2) still propagates asErr. - Candidate #2 sub-claim (
cuMemcpyAsynchard-required inDriver::load): Dropped —cuMemcpyAsynchas been in the CUDA Driver API since CUDA 4.0 anddocs/prefix-cache-offload.md:649-650already lists it. - Candidate #3 sub-claim (undersized
--memory-limityields a sliver of intake in non-capture mode): Disproved —limited_budgetathelios/src/runtime_core/memory.rs:920runs withfuture >= memory_bytesand immediately errors with"memory limit is {cap} bytes, but loaded model resources require {required} bytes". - Candidate #5 (
FLARE_LOAD_IBV(query_port, "ibv_query_port", "IBVERBS_1.1")breaking RoCE): Disproved —libibverbs.so.1exportsibv_query_port@IBVERBS_1.1for<infiniband/verbs.h (not opened)>'s own compat fallback, removing it would risk a NULL-pointer dereference whenverbs_get_ctx_opreturnsNULL, and the PR's ownlazy_libibverbs_loader_resolves_symbols_or_reports_install_hinttest would have failed if it were absent. - Candidate #6 half (
lazy_libibverbs_loader_resolves_symbols_or_reports_install_hintinhelios/src/execution/roce.rs:511-523being vacuous): Disproved — the missing-symbol error string (roce_proxy_dlopen.c:76-77:"libibverbs.so.1 is missing required symbol %s") does not contain"libibverbs1", soassert!(text.contains("libibverbs.so.1") && text.contains("libibverbs1"))fails loudly iflibibverbs.so.1is present and any symbol fails to resolve. - Candidate #8(b) (
docs/release.md:30-31parenthetical phrasing) and #8(c) (unapproved GA10B charter scope expansion): Disproved —docs/release.md:30-31accurately states the Ubuntu 22.04 / glibc 2.35 requirement, and GA10B support was already committed tomaininc9935887(helios/src/core/naming.rs:15, 54-60) by priority contributor@lukealonso. - Candidate #9 sub-claims (
packaging/debian/package.sh:46-48anddocs/debian.md:3-6, 61-64): Disproved — the Debian package targets Ubuntu 24.04 / DGX Spark, intentionally depends onibverbs-providers(which pullslibibverbs1) for RoCE, anddocs/debian.mdaccurately states"ARM64 additionally depends on the verbs providers needed for RoCE"without claiming dynamic linking. - Candidate #12 (
flare_ibv_get_device_listinit guard andibv_reg_mr_iova2inhelios/native/roce_proxy_dlopen.c): Dropped — the 4-lineroce_ensure_libibverbs(NULL, 0)check inflare_ibv_get_device_list(:122-128) is a cheap NULL-deref safety guard ifroce_createis ever called directly, and keeping<infiniband/verbs.h (not opened)>'sIBV_ACCESS_OPTIONAL_RANGEsemantics inflare_ibv_reg_mr(:171-179) preserves compatibility with futureroce_proxy.cupdates. - Candidate Nit #4 (deleting
cuDeviceGetAttribute/cuMemGetAllocationGranularityprobes athelios/src/cuda.rs:577-590): Dropped — speculative/hardware-dependent, and probing early avoids an unnecessarycuMemAddressReserveon unsupported platforms. - Candidate Nit #5 (PR description prose: "17 calls" vs redirect count, parenthetical file lists): Dropped — low-signal formatting nit.