Recommendation: Changes Requested
The core mechanism—reusing the existing host-backed CUDA VMM (HOST_NUMA) path on Linux whenever a device lacks HOST_REGISTER_SUPPORTED (99) or CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM (91), while keeping capable Linux GPUs on mmap + cuMemHostRegister and Windows WDDM off speculative probes—is clean, capability-driven, and memory-safe in helios/src/runtime_core/{host,mod}.rs. However, four verified issues need resolution before merging: a head-on GA10B address-layout conflict with open PR #658 compounded by a duplicated EXTERNAL_FLOOR heuristic in Rust, a TOCTOU gap where the probed host VMM range is freed inside the narrow unsealed external allocation band, init-time probe failure propagation that swallows CUDA error statuses and breaks non-MappedHost exports on tight windows, and stale contradictory docs/comments across the repo. No CI has run on ea65cb2 yet.
Merge Risk
Level: Medium
- Shared MappedHost load/init seams across all targets: Modifies
heliopause/src/allocator.rs,helios/src/runtime_core/{driver,host,mod}.rs, andignition/preparation/core_storage.py, which run on every export and native core load across SM87/103/110/120/121 and Windows WDDM. Linux GPUs with99==1 && 91==1and Windows WDDM (!cfg!(windows)) preserve their existing paths, keeping steady-state regression risk bounded, but no CI has verified Windows or non-Orin/Thor targets onea65cb2. - Every SM87 export moves address windows and collides with #658: Lowering integrated SM87
DEVICE_BASEfrom0x12_0000_0000(72 GiB) to0x0c_0000_0000(48 GiB) shifts all SM87 exports (even models withoutMappedHost) and directly conflicts with open PR #658's GA10B cuRAND floor fix (EXTERNAL_FLOOR = 0x9_0000_0000,DEVICE_BASE = 0x12_0000_0000). - Narrow-aperture VA race during preparation: Freeing the probed
[40 GiB, 48 GiB)host VMM range betweenCoreStorage.__init__andhost_allocate()leaves it exposed to intervening CUDA/cuBLAS external allocations in[EXTERNAL_FLOOR, DEVICE_BASE).
Walkthrough
helios/src/runtime_core/driver.rs:14-19: Defines namedCU_DEVICE_ATTRIBUTE_*constants (18,91,99,116,134,141).helios/src/runtime_core/host.rs:12-18,57-174: Adds shareduse_host_vmmandhost_numa_properties(validatingHOST_NUMA_VMMand power-of-two host granularity), ungatesallocate_hoston Unix, and checkscuMemReleasestatus after recording each host mapping.helios/src/runtime_core/mod.rs:22,123-128,364-386,564-566,645,711,1610,1618-1620: Exportspub mod host(consumed by sibling crateheliopause), queries attributes 99/91 inNativeResources::initialize, routesMappedHostsetup/teardown byself.host_vmm, and unconditionally drainshost_mappingsin Phase 1 teardown.heliopause/src/allocator.rs:195,367-418,448-589,863,1589-1637: Computeshost_vmm, exposes"host_vmm"inflare_core_snapshot(), tightens device granularity validation tois_power_of_two(), addsvmm_host_window()to probe a GiB-aligned 8 GiB/rank host range on non-Windowshost_vmmdevices, and adds unit coverage forvmm_host_window.ignition/preparation/core_storage.py:66-71,103,356,492-505&tests/preparation/test_core_storage.py:83-139: Lowers SM87DEVICE_BASEto0x0c00000000(48..96 GiB), readsself._host_vmmfromlayout["host_vmm"], renamesWindowsHostRegiontoHostVmmRegionwith an explicitHOST_NUMA_VMM(141) guard, and adds unit tests for region dispatch, overflow cleanup, and 141 rejection.docs/runtime-core-design.md:92-121: Documents the Linux host-VMM fallback, narrow-aperture 8 GiB host range, and SM8748..96 GiB/12 GiBdefaults.
Pre-merge Checks
- [PASS] Security / malicious screen: No untrusted external inputs, secret exposure, suspicious native/FFI behavior, or prompt-injection attempts in PR diff or metadata.
- [WARN] Charter & value fit: Capability-based reuse of host-backed CUDA VMM on SM87 (a documented target in
docs/cli-design.md:6) fits the charter well, with zero per-model branches; however,allocator.rs:526-530duplicates Python'sEXTERNAL_FLOORvia a magic address heuristic, probe errors are swallowed without root-cause status (allocator.rs:544-553), and non-Orin/Thor targets in the supported matrix remain unverified. - [WARN] Related / duplicate / conflict check: Head-on conflict with open PR #658 on
ignition/preparation/core_storage.py:66-71andtests/preparation/test_core_storage.py:83+, plus stale statements left inhelios/src/cuda.rs,selene/src/offload.rs, anddocs/from merged #589 and earlier Windows docs. - [WARN] Tests & verification evidence: Unit tests in
host.rs,allocator.rs, andtest_core_storage.pyare isolated (no global state leaks), but no CI ran onea65cb2; end-to-end Orin Nano/Thor evidence is self-reported via the#[ignore]dfixed_core_fixture.py(not opened) ->event_tests.rsfixture,test_host_allocate_selects_region_by_host_vmmbypassesCoreStorage.__init__via__new__, and Windows WDDM, AGX Orin 64 GiB, SM120/SM121, and RoCE over host-VMM were not exercised.
Blockers
None.
Should Fix
-
Reconcile the GA10B address layout with open PR #658 and eliminate the duplicated
EXTERNAL_FLOORheuristic (ignition/preparation/core_storage.py:66-71,heliopause/src/allocator.rs:526-530):core_storage.py:66-71keepsEXTERNAL_FLOOR = 0x300000000(12 GiB) and lowersDEVICE_BASEto0x0c00000000(48 GiB,[48 GiB, 96 GiB)). Open PR #658 modifies the exact same lines to raiseEXTERNAL_FLOORto0x900000000(36 GiB) because staticcuRANDprecalc_xorwow_offset_matrixtables contain 64-bit patterns in[0x3_0000_0000, 0x3_0300_0000]that trigger false-positive export pointer matches, while keepingDEVICE_BASE = 0x1200000000(note: both measurements are consistent—64 GiB AGX Orin has a 128 GiB VMM ceiling and exported cores only reserve used GiB-aligned spans, whereas exporting directly on 8 GiB Orin Nano reserves the full 48 GiBRESERVATION_BYTESand hits the 96.56 GiB cap).- Independently,
heliopause/src/allocator.rs:526-530duplicates Python'sEXTERNAL_FLOORvia an address heuristic (if integrated != 0 && base < 0x40_0000_0000 { 0x3_0000_0000 } else { 0x40_0000_0000 }). OnceEXTERNAL_FLOORmoves (e.g., to 36 GiB per #658), Rust silently uses the stale 12 GiB floor and can placeHOST_BASEinsideseal_low_window()'s sealed range (e.g., forworld >= 2,before = 32 GiB < 36 GiB), and even forworld == 1only 4 GiB ([36 GiB, 40 GiB)) remains for external library allocations. - Fix: Coordinate a single GA10B window layout with #658 (keeping
EXTERNAL_FLOORclear of cuRAND's[0x3_0000_0000, 0x3_0300_0000]while fitting direct export inside Orin Nano's 96.56 GiB VMM ceiling), and passself.EXTERNAL_FLOORexplicitly fromCoreStorageintoflare_core_initialize_windowasmin_host_baserather than hardcoding a second copy in Rust.
-
Hold the probed host VMM range instead of freeing it before
host_allocate()(heliopause/src/allocator.rs:543-553,ignition/preparation/core_storage.py:109-110, 513-518):flare_core_initialize_windowprobes[40 GiB, 48 GiB)withcuMemAddressReserveand immediately releases it withcuMemAddressFree(allocator.rs:544-550). Immediately afterward,CoreStorage._reserve_low_window()(core_storage.py:109-110) seals only[4 GiB, EXTERNAL_FLOOR), leaving[EXTERNAL_FLOOR, DEVICE_BASE)open for cuBLAS handles, PyTorch non-pool allocations, and CUDA driver storage.HostVmmRegion.__init__(core_storage.py:513-518) only re-reservesHOST_BASElater whenhost_allocate()runs (e.g.,ignition/preparation/collectives.py:77(not opened) or mailbox setup). On a narrow 96.56 GiB aperture, any intervening external CUDA allocation landing in[40 GiB, 48 GiB)turns export into a load-order-dependent"cannot reserve mapped host CUDA address"failure.- Fix: Reserve the selected host VA span once during initialization and keep it held, having
HostVmmRegionmap/unmap physicalHOST_NUMAhandles directly inside that pre-reserved range without callingcuMemAddressReserve/cuMemAddressFree(mirroringDeviceRegionatignition/preparation/core_storage.py:608-655), or reserve/protect the span before external allocations run.
-
Do not fail allocator init on host-VMM probe failure for non-
MappedHostexports, and preserve the failing CUDA status (heliopause/src/allocator.rs:415-417, 518-555):vmm_host_window(...)propagatesErrout offlare_core_initialize_window(allocator.rs:555), even though most models never callhost_allocate(). Noticeallocator.rs:556-558already falls back to(default_host_base, default_host_extent)whenHOST_NUMA_VMM == 0so non-MappedHostmodels can still export, whereas whenHOST_NUMA_VMM == 1, a tight customdevice_windowor multi-rank layout where no 8 GiB host slice fits aborts export before model loading even begins.- At
allocator.rs:544-553, every non-zerocuMemAddressReservestatus (e.g.,CUDA_ERROR_INVALID_CONTEXT,CUDA_ERROR_OUT_OF_MEMORY,CUDA_ERROR_NOT_SUPPORTED) is flattened intoOk(false), andvmm_host_windowreturns"no reservable CUDA VMM address range for mapped host storage"with no CUDA error code or probed ranges. - Fix: Record the last non-zero CUDA status and attempted ranges in the failure diagnostic, and either defer host-VMM range placement/reservation until the first
host_allocate()call or keep initialization non-fatal when noMappedHoststorage is allocated (surfacing the recorded error ifhost_allocate()is subsequently invoked).
-
Update stale docs and comments that now contradict the new Linux host-VMM path:
docs/windows.md:212-217still states that "Linux registers host pages for mapped graph storage. Windows uses host-backed CUDA VMM…", contradictingdocs/runtime-core-design.md:107-110.docs/same-process-tp.md:38-45still states host ranges always span 1 TiB at0x0c00_0000_0000/0x2000_0000_0000.helios/src/cuda.rs:552-554,selene/src/offload.rs:693-695, anddocs/prefix-cache-offload.md:588-590still assert thatHOST_NUMAVMM is unsupported on "Windows WDDM and integrated Tegra/GA10B GPUs", which this PR empirically disproves on JetPack 6 / CUDA 12.6 GA10B (and Windows WDDM already usesHOST_NUMAVMM forHostVmmRegion).- Fix: Update these five sites to match the capability-based behavior (
HOST_NUMAVMM support depends on driver/device capability rather than being categorically absent on GA10B/WDDM, and Linux can fall back to host-VMM and narrower host windows).
Subtract / Simplify
- Fold the duplicated
HOST_REGISTER_SUPPORTED/CAN_USE_HOST_POINTER_FOR_REGISTERED_MEMqueries intohost::use_host_vmm(helios/src/runtime_core/host.rs:12-18, 202-221,helios/src/runtime_core/mod.rs:364-386,heliopause/src/allocator.rs:448-480, 511-515):- Both
NativeResources::initialize(mod.rs:364-386) andflare_core_initialize_window(allocator.rs:465-480) duplicate the identical ~20-line pair ofcuDeviceGetAttributecalls solely to feed booleans +cfg!(windows)intohost::use_host_vmm. - Change
use_host_vmmtopub unsafe fn use_host_vmm(driver: &super::driver::Driver, device: i32) -> Result<bool>(matching siblinghost_numa_properties), removing ~40 lines of duplicated FFI plumbing and shrinking theallocator.rs:448-455init tuple back from 6 variables to 4. Also drop the tautological boolean loop inhost.rs:209-219(which only comparesuse_host_vmmagainst a literal copy of its own 1-line body).
- Both
- Delete unreachable granularity re-validation and redundant
usizeconversion inheliopause/src/allocator.rs:366-381, 521-525, 1633-1634:vmm_host_window'sif !granule.is_power_of_two()guard (allocator.rs:377-381) cannot fire from its production caller becausegranuleis already validated withis_power_of_two()atallocator.rs:497andhost_granularityis already validated withis_power_of_two()athelios/src/runtime_core/host.rs:91-95(making the two assertions atallocator.rs:1633-1634dead-input tests).host_granule(allocator.rs:520) isgranule.max(host_granularity as u64)where both inputs came fromusize, sousize::try_from(host_granule)(allocator.rs:521-525) is redundant. Grouping the device/default window parameters into a small struct also removes#[allow(clippy::too_many_arguments)](allocator.rs:366).
Nits
ignition/preparation/core_storage.py:103:layout["host_vmm"]hard-indexes a newly added snapshot key right abovelayout.get("host_extent", ...)on line 105; if a developer runs updated Python against a staleflare_heliopausebuild, aKeyErroris raised mid-init. Raising a clearRuntimeErrormentioning aflare_heliopauserebuild when"host_vmm"is missing is friendlier.ignition/preparation/core_storage.py:501-502andhelios/src/runtime_core/host.rs:116: IncludingHOST_NUMA_VMM (141)(and why the VMM path was selected) in the"mapped core storage requires host-backed CUDA VMM"error makes capability mismatches easier to diagnose.helios/src/runtime_core/mod.rs:382: Logging or surfacing the selectedhost_vmmmode in load diagnostics would make replay issues on Linux/Orin immediately inspectable.tests/preparation/test_core_storage.py:83-128: Add a small test exercisingCoreStorage.__init__snapshot propagation ofhost_vmm(rather than onlyCoreStorage.__new__), plus CI coverage onea65cb2.
Dropped on verification
- Upstream Correctness F1 ("Blocker: init-time probe failure is a Blocker"): Downgraded from Blocker to Should Fix (#3). On
main,window_host_layout(heliopause/src/allocator.rs:278-359) already failsflare_core_initialize_windowunconditionally when no host window fits on Windows, and on default SM87 (48..96 GiB)[40 GiB, 48 GiB)is free at init prior to model loading. - Upstream Correctness F3 ("Major: unconditional
cuDeviceGetAttribute(99/91)breaks older CUDA drivers"): Dropped as false. Attributes 91 (CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM, CUDA 8.0) and 99 (HOST_REGISTER_SUPPORTED, CUDA 9.2) predate the required VMM symbols inDriver::load()(helios/src/runtime_core/driver.rs:255-260, CUDA 10.2+),cuTensorMapReplaceAddress(driver.rs:313, CUDA 12+), and attribute 116 (GPU_DIRECT_RDMA_SUPPORTED, CUDA 11.3, already checked unconditionally viadriver.check(...)atallocator.rs:481-488). - Upstream Correctness F4 & Discovery #4 ("Major: Linux device with 99/91==0 and 141==0 previously exported and only failed at serve; loses working
mmap+cuMemHostRegisterpath"): Dropped as factually false.HostRegion.__init__(ignition/preparation/core_storage.py:453-462) runs at export, not serve, and already calledcuMemHostRegister_v2+cuMemHostGetDevicePointer_v2and failed ongpu.value != address. No workingmmap+cuMemHostRegisterpath existed on such devices. - Upstream Subtraction #2 ("Delete
allocator.rs:556-558fallback and delete Python's attribute-141 check incore_storage.py:499-502"): Dropped as unsafe. Deletingcore_storage.py:499-502would drop theHOST_NUMA_VMMcheck on Windows WDDM (whereallocator.rs:518skipshost_numa_propertiesvia!cfg!(windows)), and turning141 == 0into a hard init error would break non-MappedHostexports on91==0 && 141==0Linux devices. - Upstream Correctness F5a ("Major: tightening device granularity check from
!= 0tois_power_of_two()atallocator.rs:497is an undeclared regression"): Dropped as false.window_host_layout(allocator.rs:322-338) andheliopause/src/export/capture.rs:3545already relied on power-of-two bitmask alignment (n & !(granule - 1)), so enforcingis_power_of_two()prevents silent misalignment rather than introducing a regression. - Upstream Correctness F5b & Subtraction ("Narrow
pub mod hostathelios/src/runtime_core/mod.rs:22topub(crate)"): Dropped as factually incorrect (would break compilation).heliopauseis a separate crate (heliopause/src/lib.rs:9re-exportshelios_core::*, andheliopause/src/allocator.rs:18importscrate::runtime_core::host), matching siblingpub mod address_spaceandpub mod driver(helios/src/runtime_core/mod.rs:15,17). - Upstream Correctness F6 ("Major:
WindowsHostRegionrename needs deprecation alias;layout['host_vmm']hard index is Major"): Dropped theWindowsHostRegionalias claim as low-signal (repo-wide search confirmed zero other references; it is an internal helper class incore_storage.py), and downgraded thelayout["host_vmm"]stale-wheel ergonomics point to a Nit. - Upstream Correctness F7 ("Major: core does not record host backing mode, contradicting cross-board interchange claim"): Dropped as false. Both 8 GiB Orin Nano and 64 GiB AGX Orin are GA10B (SM87) using the same
host_vmmmode;NativeResources::initialize(helios/src/runtime_core/mod.rs:349-358) already enforces exact GPU(major, minor)matching; and cores intentionally omit host backing mode so Linux-exported cores load on Windows WDDM via host-VMM (docs/windows.md:212-231). - Upstream Subtraction #3 ("Collapse
vmm_host_windowintowindow_host_layout"): Dropped full merge recommendation becausewindow_host_layoutruns pure address-width math where speculativecuMemAddressReserveprobes must never execute on WDDM (allocator.rs:516-517); kept the argument-grouping and dead-check cleanup under Subtract / Simplify #2. - Upstream Discovery #6 / Correctness F10 ("Hardcoded 8 GiB / 1 GiB constants violate 'No magic defaults'"): Dropped as low-signal for
1 GiB(matches existing GiB reservation rounding inheliopause/src/export/capture.rs:3536) and8 GiB(an internal VA window constant analogous to existingEXTENT = 1 << 40/HOST_BASE = 0xc0000000000); the genuinely harmful duplicated constant (min_host_baseatallocator.rs:526-530) is addressed in Should Fix #1.