Case file — PR #726: helios: overlap startup allocation, registration, and setup with runtime-sized zero-copy weight loading
https://github.com/NVIDIA/hyperflare-inference/pull/726 · author original-el8 (COLLABORATOR, Discord el8) · open, "ready for review" · opened 2026-12-04, last updated 2026-12-04 · base main, head 60d1b6b, branch point cc0a49d · 8 files, +1886/−385 · no labels, no reviews, no comments, CI pending at head.
Key findings
- The headline number was not measured on this PR. The 75.0 s → 45.5 s cold-start result was taken, in the PR's own words, "via
flare runon 1× NVIDIA GB300 (SM103) on the equivalentfeat/gb300-tiered-runtimebuild prior to rebasing cleanly ontomain". That branch is open draft #710, by the same author, not the #726 head, and the comparison is not againstmain— which is precisely what charter line 40 (#210) requires of performance PRs ("benchmarks showing an actual speedup overmainon a served workload"). No per-phase numbers exist for the rebased head. - Open draft #710 already carries the host-VMA half of this PR. #710's first bullet is verbatim the design #726 ships in
prepare_mapped_host_vmas— coalesce contiguous fixedMappedHostspans, best-effortMADV_HUGEPAGE, ordered 2 MiB-stride pre-fault beforecuMemHostRegister_v2, single teardown (helios/src/runtime_core/mod.rs, +120/−44 in #710). #726 subsumes that half, does not mention #710, and #710 remains open/draft; its other two thirds (scheduler cost/forecast hardening, GB300 AOT/logprobs) are not in #726. The PR's measurement branch and the superseded PR are the same piece of work. - Undeclared behaviour (a):
MADV_HUGEPAGEis applied unconditionally.let _ = libc::madvise(mapped, span_bytes, libc::MADV_HUGEPAGE);at helios/src/runtime_core/mod.rs:2264, on every coalesced span, with no policy guard. The repo has an explicit standing caution against exactly this: docs/TODO.txt:1-6 asks to "auditselene-manager/src/arena.rs(not opened) for unconditionalMADV_HUGEPAGEunder synchronous THP defragmentation", and merged #625 ("Avoid THP compaction stalls in eos::map_host…") retired that hazard after #616 (15-minute prefix-cache preparation on fragmented memory). Autobot's review of #696 calls unconditional whole-mappingMADV_HUGEPAGE"the exact THP compaction-stall hazard just retired by #625". The PR body only says "coalesced, THP-hinted VMA preparation" in passing and reportsAnonHugePages: 94.0 GiB (up from 91.0 GiB)as a benefit. - Undeclared behaviour (b): production startup output changes.
StartupObservation.completed/completed_phases()lose their#[cfg(test)]gate (helios/src/startup.rs:107-125), so production builds now retain a snapshot of every completed phase, andreplay_completed(startup.rs:177-201) re-emits them into normalflare runoutput with " · overlapped" appended (startup.rs:183-187), preserving original durations viastate.elapsed.unwrap_or_else(startup.rs:134). Anything parsing startup stage rows sees a different sequence and different per-phase timings. The PR body mentions "replaying completed stage rows in canonical order" but not thecfg(test)removal or the log-visible suffix. - The overlap only engages for mixed cores.
let overlap_host_alloc = host_bytes > 0 && device_payload_bytes > 0;(helios/src/runtime_core/model.rs:850, branch at :852/:885). All-host and all-device cores take the old serial path, so "removes serial startup overhead across every GPU architecture" is narrower than stated; those cores still get the new default staging sizes and the tokenizer preload, which are unflagged default changes. - Only 5 of the "6 new unit tests" are new. The 5 are payload.rs
io_plan_double_buffers_and_respects_memory_and_rank_bounds,mapped_host_loader_uses_zero_copy_when_aligned_and_preserves_unaligned_edges,registration_gate_orders_chunk_indices_and_wakes_on_advance_and_close, and mod.rsstartup_overlap_tests::{registration_chunks_align_to_512mib_boundaries_without_splitting_pmds, prefault_slices_preserve_allocation_order_and_2mib_alignment}. The sixth, model.rsasync_transfers_reject_peer_copy_graphs_at_load_time, is inherited from merged #721. All new tests are CPU-only: nothing exercisescuMemHostRegister_v2chunking, the overlapped pipeline, or the preloaded frontend on hardware. - Diff-base artifact (read the diff carefully). Much of the rendered diff outside the described scope —
prepare_async_transfers,map_device_pool,PoolMemoryLimit/ flare-cli pool flags,codec_context/offload_context— is inherited from merged #711/#721/#709, because the diff renders against a base older than those merges (verified: those symbols already exist at #721's headd612cd1, e.g. mod.rs:1483, model.rs:988).pr_files(8 files) is authoritative; AsyncTransfer is not a hidden feature of #726. What is specific to #726 in mod.rs:allocate_device,allocate_mapped_host_vmm,load_device_overlapping_mapped_host,register_pending_mapped_host,prepare_mapped_host_vmas,prefault_slices,registration_chunks,PendingHostRegistration,startup_overlap_tests. helios/src/server/config.rs(+139/−56, the 2nd-largest non-runtime_core change) is not listed in the description's file list. It is the mechanical extraction ofload_frontend_innerplusPreloadedFrontend/frontend_cache_key/preload_frontendandBootstrap::load_with_preloaded. Declared in prose, undeclared in the "What Changed" inventory.
The change
What it does, plainly. Startup previously ran allocate → load weights → prepare kernels/execution/engram → allocate caches → prepare offload → load tokenizer strictly in series. #726 makes those steps overlap: host-side memory preparation runs on a background thread while device weights upload; cuMemHostRegister_v2 is done in 512 MiB windows from a third thread racing ahead of the readers; kernels, graphs, caches and prefix cache are prepared on another thread while NVMe streams mapped-host weight bytes; the tokenizer/chat template is loaded on a fourth thread. The staging constants (CHUNK = 4 MiB, READERS = 4, SLOTS = 4) become a runtime IoPlan. MappedHost payload bytes stop round-tripping through pinned CUDA staging buffers and are pread straight into mapped host memory.
Files and sizes (pr_files):
- helios/src/runtime_core/payload.rs +689/−80
- helios/src/runtime_core/mod.rs +618/−86
- helios/src/runtime_core/model.rs +402/−152
- helios/src/server/config.rs +139/−56
- helios/src/startup.rs +31/−8
- helios/src/server/session.rs +4/−2
- helios/src/server.rs +2/−0
- helios/src/runtime_core/format.rs +1/−1
Mechanics, file by file (from the diff).
- model.rs:
NativeModel::load_agreeingsplits payload counters into device/host bytes and computesoverlap_host_alloc; aprepare_runtimeclosure (prepare kernels → execution → embedding tables →allocate_caches→prepare_offload) runs inline or on a background scope thread; aRegistrationGateper rank is built fromPendingHostRegistration::chunk_ends();collect_mapped_host_chunkssorts host chunks by registration index; a "flare-host-payload" coordinator spawnsflare-host-rank-{i}readers; the main path runsregister_pending_mapped_hostthenprepare_runtime, thenapply_payload_relocations,load_phase.finish, andprogress.replay_completed(&bg_observation.completed_phases())(model.rs:1192). Preload threadflare-frontend-preload(model.rs:716-717) only on cluster rank 0; result stored inpreloaded_frontend(model.rs:1224) and taken viatake_preloaded_frontend()(model.rs:1230). - mod.rs:
allocate()split intoallocate_device()plus host VMA preparation;load_device_overlapping_mapped_host()(mod.rs:716) runsprepare_mapped_host_vmas()(mod.rs:2175) onflare-host-alloc-{rank}concurrently withload_device_payload(), holding no CUDA context; VMA coalescing with matching registration flags, best-effortMADV_HUGEPAGE(mod.rs:2264), ordered FIFO 2 MiB-stride pre-fault in 32 MiB slices across(cpus/ranks).clamp(1,8)threads (prefault_slices, mod.rs:2386),mlockon integrated GPUs;registration_chunksatREGISTER_CHUNK_BYTES = 512 MiB(mod.rs:2383-2434);register_pending_mapped_host()(mod.rs:786) registers per chunk, advances the gate, then verifiescuMemHostGetDevicePointer_v2identity per allocation — now the only identity check forMappedHost. - payload.rs:
IoPlan { chunk_bytes, readers, slots }fromchoose_io_plan(ranks, cpus, optimal_io_size, available_host_ram, payload_bytes, needs_staging)(payload.rs:205);MAX_CHUNK8 MiB /MIN_CHUNK1 MiB (payload.rs:143-144),READERS = 8(payload.rs:147), slots =2 * readerscapped by a staging budget ofMemAvailable/200clamped to 16-128 MiB,slots = 0for the host tier;detect_optimal_io_sizereads/sys/dev/block/<maj>:<min>/queue/optimal_io_size(Linux only, payload.rs:160-184);push_span_chunks(payload.rs:425) splits a span into staged head/tail edges plus 4 KiB-aligned interior chunks whenfile_offset % 4096 == destination % 4096;can_read_direct_into_host(payload.rs:355) gates directpreadinto mapped memory viacrate::os::direct_reopen, falling back to a bounceAlignedBuffer;load()=load_device()+collect_mapped_host_chunks()+load_mapped_host_chunks(). - startup.rs: gate removal and replay as in Key finding 4.
- session.rs:
LoadedSession::newcallstake_preloaded_frontend()(session.rs:34-36) andserver.attach_async_transfers(...)(session.rs:74, inherited). - config.rs: preload plumbing and the
preloaded.key == frontend_cache_key(object)reuse guard (see Reach).
Description says / doesn't say. The description claims four bullets covering payload.rs, mod/mod.rs/format.rs (not opened), and model.rs/startup.rs/server.rs (not opened)/server config.rs/server session.rs. It does not say: THP is applied unconditionally; StartupObservation loses its test-only gate and rows are re-emitted with " · overlapped"; mod host becomes pub mod host and compiles on all platforms (mod.rs:22, previously #[cfg(any(windows, test))]); a new host_vmm: bool probe with unreachable!("non-unix platforms always set host_vmm = true") on the non-Unix branch; teardown moves from per-allocation unregister/unmap to reverse-ordered host_registrations then host_mmap_spans, leaving (Memory::MappedHost, _) => {} as a no-op in release_execution_resources; the overlap is gated to mixed cores; format.rs's only change is a ±1 line.
The why
The problem is real and structural: NativeModel::load_agreeing serialised allocation, weight load, kernel/graph/cache preparation and tokenizer load, so NVMe idled during host pre-faulting and cuMemHostRegister_v2, and the GPU idled during MappedHost reads. But no issue in the searchable window states this complaint: not #616, #625, #696, #701, #698, #335 or #210. The closest prior art is #616 ("v0.4.4 takes over 15 minutes to prepare a 119 GiB host prefix cache on fragmented Linux memory", closed) fixed by merged #625 — host-memory-mapping latency is a known recurring pain point, but for the prefix cache via eos::map_host, not for MappedHost weights.
How long / how widely wanted: the driver is the author's own GB300 host-tiered bring-up (feat/gb300-tiered-runtime = #710, opened 2026-12-03; #726 opened 2026-12-04). Evidence that others treat startup latency as live: #696 (malventano, opened 2026-12-02) independently attacks engram load and startup progress on the same files (36.6 s → 9.6 s engram, 66.9 s → 40.0 s total) — the two PRs do not reference each other.
Related work
- #710 (open, draft, same author, +550/−91): the VMA coalescing/THP/ordered-pre-fault half is duplicated here; #710's other two thirds (speculative cost/forecast hardening; GB300 AOT compile pool / readiness logprobs) are not in #726. Neither PR mentions the other. Which one lands the VMA work is unresolved.
- #711 (merged 2026-12-03 22:02, lukealonso): AsyncTransfer primitive + runtime-sized
DEVICE_POOL— the inherited base. - #721 (merged 2026-12-04 06:00, lukealonso): AsyncTransfer hardening; source of
validate_async_transfer_peer_copy_compatibility,invalidate_control(), and the model.rs test #726 counts among "its" new tests. - #709 (merged 2026-12-03 20:09): green contexts,
codec_context/offload_contextused by #726's prefix-cache offload path. - #723 (open, lukealonso): touches the same three runtime_core files (format, mod, model) — codec green contexts, graph SM bounds; collision risk in
prepare_kernels/prepare_graphsordering. In review with a blocker. - #696 (open, malventano): same two files (model.rs, startup.rs), same goal; direct textual collision with #726's startup pipeline and
StartupObservationchanges. - Same-file neighbours from
related_items, checked at file level only: #554 (open, engram RDMA), #701/#698 (open, offload/pool ordering), #640 (open, persistent workers), #628/#646/#430/#720/#664/#714/#301/#314 (merged or closed, none a competing implementation of the startup overlap). Nothing was found that #726 reverses; nothing was found that supersedes #726.
Recent activity
search_history is broken in this environment (git: error: Could not read c513e46a… fatal: cannot simplify commit ef38cb93…) and ref=main in the tooling is a stale snapshot, so commit-level history and per-commit authorship could not be audited; the orientation packet likewise reports history "not available" and no commits on the default branch since cc0a49d touching these files. Reconstructable from items instead:
- 2026-12-02: #696 opened (engram parallel load + startup progress).
- 2026-12-03 18:08 → 20:09: #709 merged (green contexts / codec partitions).
- 2026-12-03 18:44: #710 opened as draft (VMA coalescing + THP + pre-fault in runtime_core/mod.rs).
- 2026-12-03 19:39 → 22:02: #711 merged (+6333/−90, AsyncTransfer + DEVICE_POOL).
- 2026-12-04 05:58 → 06:00: #721 merged (+1625/−320, AsyncTransfer hardening).
- 2026-12-04 06:21: #723 opened (green contexts / graph SM bounds).
- 2026-12-04: #725, #712, #715 (author's other open PRs) and #726.
So #726 lands immediately behind four runtime_core merges in ~36 hours, in the exact functions it rewrites. It builds on all of them and reverses none, but it re-shuffles their call order (payload::load split so apply_payload_relocations runs after the background prepare phase; prepare_async_transfers now at the end of load; the cuMemHostGetDevicePointer_v2 identity check moved from allocate into register_pending_mapped_host). Because the diff base predates #711/#721/#709, no reviewer has yet seen #726's true delta against current main.
People
- original-el8 — COLLABORATOR, and named in the charter's community-respect bullet as a priority contributor whose PRs are "never close[d] … out of hand as 'low value'". 180-day record: 25 merged, 29 closed, 12 open; merged work concentrated in docs (15) and helios/src (14). Current stack is GB300/SM103 host-tiered serving: #710 (VMA/THP + AOT + scheduler, open draft), #725 (RoCE proxy send order), #715 (packed multi-request prefill), #712 (RoCE hairpin defaults), #640 (persistent workers rank 0), merged #666 (RoCE dual-rail), #646 (Orbit rank cache / GB10 KV sizing). #726 sits squarely inside that line.
- lukealonso — authored #711/#721/#709/#723, the AsyncTransfer + green-context stack #726 threads through and inherits; #711's stated merge gate was "explicit Principle 1 approval for the
Execution.async_transferscaptured-graph operation contract from project owner Luke Alonso". #726 changes whereprepare_async_transfersruns during startup, so it plausibly inherits that sign-off dependency. - malventano — the other contributor working startup latency (#696); same files, likely reviewer and conflict.
- No commits in these areas by anyone else in the last 180 days per the orientation packet.
- Engagement on #726 itself: none.
Community
pr_comments on #726: "No comments." No reviews, inline comments, reactions or labels. By contrast #696, #711 and #723 each drew an Autobot case file within 4-19 minutes of opening and a first review within 17 minutes-3 hours, and #723 later drew a long FujitsuPolycom hardware-validation comment across SM120/SM121. #726's silence is a snapshot-of-age fact (same-day PR), not evidence of disinterest — but it means no second pair of eyes and no independent hardware validation exists for a change that rewrites startup for every core. The reviewer community is currently in an active dispute about THP policy (#696's blocker; #625/#616 background), which is directly relevant to Key finding 3.
Project fit (charter)
- Fits: the four-part description (why / what / claimed result / evidence) plus an explicit "Supporting Evidence and Limitations" section matches the Code Review Standards (charter lines 41-43). The work is generic runtime I/O/alloc code with no per-model branches and no recipe changes, matching "Keep the runtime small and model-agnostic … shouldn't accumulate per-model branches (#267, #334)" and "Solve the right problem in the right place".
- Does not fit: (a) "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)" — the measurement is pre-rebase, on another branch, not againstmain(Key finding 1); (b) "Supported matrix & compatibility: Check interactions across every supported model, cache scheme, parallel layout, multi-host setup, and hardware target named in the docs" — the PR itself declareshost_vmm(Windows / non-identity-mapped Linux GPUs), integrated-GPUmlock,async_transfersand multi-rank TP startup overlap were not executed on hardware; (c) "No magic defaults, and pin dependencies" —choose_io_planintroduces environment-derived defaults (8 MiB chunks, up to 8 readers, staging =MemAvailable/200clamped to 16-128 MiB) that are not operator-configurable; (d) no roadmap item names startup latency (roadmap items are #6 in-process SDK, #267 Engram tables, #215 FlashInfer pin), so this is an unfiled measured-performance change rather than planned work. - No documentation is updated by #726 even though it changes startup log rows, staging sizing, THP policy and teardown order that docs/runtime-core-design.md (not opened) and docs/cli-design.md (not opened) describe.
Claims and evidence
Claimed per-phase table (1× GB300 SM103, 552.1 GiB signed Amazon-Ergo core = 240.5 GiB device + 316.6 GiB mapped host + 64 GiB Selene host prefix cache, 2× WD_BLACK SN850X RAID0, 12.78 GiB/s measured raw O_DIRECT ceiling, 43.2 s physical I/O floor):
| Phase | Before | After (critical path) |
|---|---|---|
| Verify core + Verify stored data + Prepare model + Initialize GPU | 2.5 s | 0.6 s |
| Allocate model memory | 21.2 s | 0.0 s |
| Load weights (552.1 GiB) | 43.9 s (12.58 GiB/s) | 43.8 s (12.90-13.00 GiB/s) |
| Prepare kernels + Prepare execution + Allocate cache + Prepare host prefix cache | 5.4 s | 0.0 s (overlapped) |
| Load tokenizer | 0.8 s | 0.0 s (pre-loaded) |
| Start server | 1.2 s | 1.1 s |
| Total ready | 75.0 s | 45.5 s (−29.5 s / −39.3 %) |
Also claimed unchanged: AnonHugePages 94.0 GiB (up from 91.0); 241.16 GiB loaded; 7.81 GiB / 147,456 live GPU KV tokens; 64.0 GiB Selene. The only phase that stays large is Load weights and it barely moves (43.9 → 43.8 s) — consistent with the design, which overlaps work rather than speeding up I/O. The PR's declared limitations, verbatim: "No package format, ABI, or PreparedContract changes. host_vmm (Windows and non-identity-mapped Linux GPUs), integrated-GPU mlock, async_transfers, and multi-rank TP startup overlap paths were not executed on hardware in this PR."
Evidence backing:
- Test counts: helios lib 1,919 passed / 0 failed / 49 ignored (with generated frontend templates), flare 255/0/4, flare-cli 250/0/3, clean release build at
f705086b. Internally plausible: #721 (merged the same day, base17961ccd) reported 1,904 passed / 49 ignored / 6 failed where all 6 failures were template-gated. 1,919 − 1,904 = 15 new passing tests against 6 claimed new tests (the remainder plausibly inherited from #709/#711/#721 plus the previously failing template tests now running), and 49 ignored matches exactly; flare-cli 250 vs 249 at #721 is consistent with a real run on a slightly later base. But no command output, log or CI artefact is attached, and CI on60d1b6bis pending. - Test identity: 5 of the 6 are genuinely new (listed in Key finding 6); the sixth is #721's.
- Memory accounting: asserted, plausible from code, not independently verifiable here.
- Pure-GPU claim ("retain exact post-load memory accounting while gaining runtime-sized double-buffered staging and background tokenizer pre-loading"): asserted, not measured.
- Staging cap: the unit test asserts
slots in 8..=16for 4 ranks and does not assert the 128 MiB cross-rank byte cap.
Reach
- Who/what is affected: every core, but differently. Host-tiered cores (any
MappedHostallocation) get the zero-copy path, the overlapped pipeline, 512 MiB registration windows and coalesced VMAs — but only mixed device+host cores get the overlap (model.rs:850). Pure-GPU cores get new default staging sizes (8 MiB chunks instead of 4 MiB, up to 8 readers instead of 4,2 × readersslots instead of 4) and the background tokenizer preload, with no flag to revert any of it. - Memory: staging sized from
/proc/meminfo MemAvailable / 200clamped to 16-128 MiB per host and divided by rank count; 2 × readers pinned staging slots instead of 4; host registration in 512 MiB windows. - Host memory shape: fixed
MappedHostallocations become shared VMAs (fewer, largermmapandcuMemHostRegister_v2calls); teardown unregistershost_registrationsin reverse, then unmapshost_mmap_spansin reverse, then VMMhost_mappings(correct pin-before-munmap order); a partial failure unmaps the whole coalesced span. - Startup output: overlapped phases re-emitted after Load weights with " · overlapped", original elapsed preserved — affects
flare runlogs, dashboard/aggregator parsers and #696-style startup totals. - Frontend: preload thread only on cluster rank 0 (model.rs:716, guarded by
cluster.as_ref().is_none_or(|c| c.rank == 0)); result used only whenpreloaded.key == frontend_cache_key(object). The key hashesassets,frontend,template_defaults,model_contract.frontend, which is exactly whatload_frontend_innerreads, so the reuse guard looks sound. Failures are silently swallowed —.spawn(..).ok()andhandle.join().ok().flatten()around a body ending inpreload_frontend(&snapshot).ok()(model.rs:717, 1224) — so a broken preload never surfaces, it just silently falls back to inline loading.preloaded_frontendis#[cfg(feature = "server")], so server-less builds compile the preload away. - Platforms: Unix (mmap/mlock/
MADV_HUGEPAGE) vshost_vmm(Windows, non-identity-mapped Linux); the non-Unix branch isunreachable!(...), an assertion rather than a fallback. None of the non-Unix paths were run on hardware. - Integration points:
LoadedSession::newnow callstake_preloaded_frontend()andattach_async_transfers(...), so the in-process/SDK path sees async-transfer handles too (inherited code, new call site). - Compatibility: no package-format, ABI or
PreparedContractchange claimed and consistent with the diff (format.rs ±1 line); existing cores should load. - Dependencies:
libc(already present) and existingcrate::os::{allocate_aligned, direct_reopen, free_aligned}; no new crate. - Docs: none touched (gap versus the charter's matrix/documentation expectation).
Process
Open and marked ready for review, not draft; same-day PR, effectively hours old at intake. CI pending on the head; no reviews, no comments, no labels, untriaged (comparable PRs carry area:memory / preparation / performance / triage:review). Risk shape: 8 files, +1886/−385 concentrated in three low-level files, rewriting the startup critical path for every core, with 5 CPU-only unit tests and no hardware test. Self-declared unrun: host_vmm/Windows, integrated-GPU mlock, async_transfers, multi-rank TP overlap. Two process notes for reviewers: commit history cannot be audited here, and the rendered diff includes already-merged PRs' code — re-read against a fresh base before merging.
Open questions / could not be found
- Whether #710 or #726 is intended to land the VMA coalescing/THP/pre-fault work; #726 neither references nor closes #710, and #710's non-VMA thirds are unmerged.
- No number exists for the rebased #726 head against
main— the charter's benchmark requirement (#210) cannot currently be checked. - Whether unconditional
MADV_HUGEPAGE(mod.rs:2264) is acceptable given #625/#616; no policy guard or flag is offered and the A/B THP test requested in docs/TODO.txt:1-6 has not been run. - No issue documents the serial-startup problem #726 solves; the "why" lives only in the PR body and the author's branch history.
- No hardware validation of the overlap on any second platform or on multi-rank TP; no GPU/integration test at all.
- Commit-level authorship and timing behind
60d1b6bcould not be verified (search_historygit error; staleref=mainsnapshot in this environment). The Discord handleel8is not a repository artefact and was not followed.