#1 [high] PR #606 diff summary (verified)
PR #606, head 2535841, 4 files +101/-5.
ignition/preparation/capture.py:
- :52
def _seed_warmup_workspaces(stream, device, pool=None); docstring now says seed inside export pool "so the allocation stays within declared core mappings" (dropping "outside ... any caller-owned pool" promise). - :65-70
with torch.cuda.device(device): index = torch.cuda.current_device(); if pool is None: pool = _warmup_pools.get(index) ... torch.cuda.MemPool()NOTE:indexis only assigned insidewith torch.cuda.device(device)block, then used at :71torch.cuda.device(index)— fine. - :118
warmup_pool = warmup_storage.warmup_pool() if hasattr(warmup_storage, "warmup_pool") else None— called OUTSIDE anytorch.cuda.device(device)context, before seeding. - :119-122 it then calls
_seed_warmup_workspaces(warm, device, warmup_pool)or the 2-arg version.
ignition/preparation/core_storage.py:300-309 warmup_pool(): getattr(self,"_warmup_pool",None) lazy; torch.cuda.MemPool(self._allocator.allocator()); self._preparation_pools.add(pool.id). _warmup_pool not declared in init (contrast _retention_pool at :73).
Tests: tests/preparation/test_core_storage.py:82-105 (FakeMemPool, reuse+allocator id+pool id registered); tests/preparation/test_capture_cublas_workspace_cuda.py:123-173 (fake SimpleNamespace storage + plain torch.cuda.MemPool, GPU-gated).
#2 [high] Export content consequences of warmup pool (verified code paths)
CoreStorage.unused_ranges()(ignition/preparation/core_storage.py:319-334) sweepstorch.cuda.memory_snapshot(include_traces=False)segments whosedevice == self.deviceandtuple(segment_pool_id) in self._preparation_pools, emitting only (live..block end) padding/inactive ranges. Newwarmup_pool()(core_storage.py:300-309) adds its id to_preparation_pools, so its padding becomes inactive.export_model(ignition/preparation/runtime_core.py:296-301):zero_rangesgets ALL graph-pool segments (storage.graph_pool.snapshot), whileinactive = storage.unused_ranges()is fed to BOTHinactiveandzero_ranges. Device allocations areAllocation(..., preserve_address=True)with defaultinitialize(mod.rs:77) — full snapshot, no spans.- Native side:
prepare_allocations(heliopause/src/export/capture.rs:1471-1490) splits every device, non-peer, span-less allocation vialive_pieces(&a, &inactive)and trimswithout_zero_ranges. So an active block in a_preparation_poolssegment (e.g. the 32 MiB cuBLASLt workspace + 1 MiB operand) is NOT declared inactive → it is read/hashed/copied into the exported core, and restored into VMM at serve time, although nothing at serve time reads it. - Contrast: graph pool contents are declared dead by zeroing whole segments (runtime_core.py:298-299). Warmup pool live bytes have no equivalent, so this PR adds ~34 MiB/rank (workspace + operand + granularity padding) to every exported core payload undeclared in the description.
- Floor check: capture.rs:3381-3389 rejects preserved allocations below
request.device_address_floor(storage.EXTERNAL_FLOOR); core window base is DEVICE_BASE (0x80000000000 / 0x1200000000 GA10B) >> floor, so the new segment does not trip the floor check. - Allocator:
freelist is the lower half of the rank window (base + rank*extent, extent/2) so the pool competes withself.pool/graph_poolfor that range; exhaustion error "native core address range exhausted" (heliopause/src/allocator.rs:442). - Corroborating evidence that the native rejection is at data-copy (not mapping) is weak: same-process
cuPointerGetAttribute(context)(capture.rs:1443-1465) would pass; the failure is more plausibly "retained device allocation ... below the restorable address floor" (capture.rs:3385) since GB10 puts context storage low (core_storage.py:126-140 reserves below EXTERNAL_FLOOR). PR cites neither error text nor issue => can't confirm mechanism.
#3 [high] Review findings F1-F7 (correctness/contracts/system)
F1 (Major) Description's stated failure mechanism is not the native code path; no evidence. heliopause/src/export/capture.rs:1426-1468 only validates recorded device allocations NOT already covered by a declared mapping (if allocations.iter().any(|a| a.address <= recorded.address && end <= a.address + a.nbytes) { continue; } :1437-1442); the check is cuPointerGetAttribute kind==2 && context == request.context (:1461-1466). Same-process prepare → same context → would pass. Nothing in the exporter rejects an allocation for being "outside CoreStorage ownership"; reachable-but-undeclared bytes are simply absorbed into a declared allocation's content by write_allocation (:1938-1964) and dropped if unreferenced (:3380 while let Some(allocation) = reach.take()). The only native check that could reject the seed is the floor rule capture.rs:3381-3389 ("retained device allocation ... below the restorable address floor"). PR gives no error text/issue/log, so reviewers cannot tell which check fired.
F2 (Major) Export-payload/layout change undeclared. core_storage.py:300-309 adds the pool id to _preparation_pools; unused_ranges() (:319-331) then reports this pool's padding/inactive blocks; runtime_core.py:300-301 feeds them to BOTH inactive and zero_ranges; capture.rs:1471-1490 splits declared device mappings with live_pieces and trims without_zero_ranges. Declared device allocations are Allocation(..., preserve_address=True) with default initialize="snapshot" (mod.rs:76-77), so the live seed blocks (32 MiB cuBLASLt workspace + 1 MiB operand, capture.py:72-73) are scanned, hashed (stream_pieces core.rs:1048-1072) and copied into the core. Graph-pool contents are declared dead wholesale (runtime_core.py:298-299); warmup-pool live bytes have no equivalent, and no test/evidence covers the resulting core content change (AGENTS.md:182-186).
F3 (Major) Tests do not exercise the claim. tests/preparation/test_capture_cublas_workspace_cuda.py:138-143 passes a plain torch.cuda.MemPool() behind a SimpleNamespace(warmup_pool=...); nothing asserts addresses lie inside CoreStorage.mappings. And :159-161 assert torch.cuda.memory_snapshot(export_warmup.id, ...) passes on the 512×512 operand + empty_like alone (capture.py:72-73), so it cannot distinguish "cuBLASLt workspace seeded in the export pool" from "operand allocated in it". CPU test (test_core_storage.py:95-98) uses CoreStorage.__new__ + fake allocator. AGENTS.md:194-199 requires tests that exercise the behavior, not mocks that bypass it.
F4 (Major, contract) Reverses #331's stated invariant ("outside transient storage, any caller-owned pool, and the exported graph pool") by rewriting the docstring at capture.py:53-63 while keeping the old promise's meaning inverted; AGENTS.md:201-207 requires an explicit maintainer decision for a change to an invariant, and #331/#266 are not referenced/updated.
F5 (Minor, ordering) Pool construction moved out of the device context. Old code created torch.cuda.MemPool() inside with torch.cuda.device(device) (diff, capture.py:65-70). New code calls warmup_storage.warmup_pool() at capture.py:118 with no device context, so torch.cuda.MemPool(self._allocator.allocator()) (core_storage.py:306) binds to the thread's current device, not capture_forwards(device=...); use_mem_pool(pool) at capture.py:71 would then target another device and the native allocator rejects it ("allocation device differs from core rank", allocator.rs:424-425). In-repo callers set_device first so it is latent.
F6 (Minor) Check-then-act race: getattr(self, "_warmup_pool", None) + assign (core_storage.py:304-308) is unsynchronized; two concurrent captures on one storage create two pools and register both ids. _warmup_pool also isn't declared in __init__ (:73 declares _retention_pool).
F7 (Minor) docs/preparation-development.md:88-91 still describes warmup_storage as "eager warmups allocate from its transient pools and release them before capture"; PR changes the seed's home and does not update the doc routed to by AGENTS.md:225-226.
#4 [high] F2 correction — reachability omits unreferenced segments
F2 CORRECTED (Major, but scoped): export_model's request dict (ignition/preparation/runtime_core.py:354-370) has NO roots key, so roots default to empty (heliopause/src/export/mod.rs:192-193) and only peer addresses, transports, execution buffers and graph-referenced allocations are reachability roots (capture.rs:3167-3186, reachability.rs:57-85, :311-320). So a declared-but-unreferenced warmup segment is normally omitted from the core ("{} allocations omitted", capture.rs:3472) and does not silently add ~34 MiB of payload. What the PR does change, undeclared, is the export metadata/allocation shape because core_storage.py:300-309 registers the pool in _preparation_pools, and unused_ranges() (core_storage.py:319-331) then emits this pool's padding/inactive blocks, which flow to inactive AND zero_ranges (runtime_core.py:298-301) and then: (a) split declared device mappings through live_pieces (capture.rs:1471-1486), (b) trim without_zero_ranges (capture.rs:1487-1490), (c) feed live_metadata(..., zero_ranges=...) numeric bounds (runtime_core.py:321-324), (d) relabel bytes as "Allocator slack"/"Disposable storage" in collect_inventory (memory_inventory.py:193-194, :208-210). None of this is mentioned in the PR description or covered by a test. Also note the same reachability rule weakens the PR's premise: if the pre-fix seed segment was never referenced it would have been omitted rather than rejected, so the reviewer needs the actual error text to know which check fired (see F1).
#5 [high] Research summary
Reviewed PR #606 (head 2535841) for correctness, contracts and system-level consequences, opening both changed files in full, the export/validation contract in heliopause, the tests, the callers, and the docs. Seven findings, all with exact citations, verbatim quotes and fixes, are on the scratchpad (entries 1–4).
Highest-signal items:
-
The PR's stated failure mechanism is not the code path it describes.
heliopause/src/export/capture.rs:1437-1466only validates recorded device allocations that are not already inside a declared mapping, and does so withcuPointerGetAttributekind/context — which passes trivially in the same preparation process. Nothing rejects an allocation for being "outsideCoreStorageownership", and unreferenced bytes are omitted (capture.rs:3472), not fatal. The only native check that could plausibly fire is the address-floor rule at capture.rs:3381-3389. Since no error text, log or issue is given, reviewers cannot confirm which check the fix addresses. -
Test/claim accuracy.
tests/preparation/test_capture_cublas_workspace_cuda.py:138-143uses a plaintorch.cuda.MemPool()behind aSimpleNamespace, with no realCoreStorageand no assertion that the seed lies insideCoreStorage.mappings; and the assertion at :159-161 is satisfied by the 512×512 operand and itsempty_like(capture.py:72-73) alone, so it cannot distinguish operand from cuBLASLt workspace. The CPU test buildsCoreStorage.__new__with a fake allocator. This is the same objection #331's reviewer raised. -
Undeclared export-metadata consequence (scoped after verification). Registering the pool in
_preparation_pools(core_storage.py:300-309) makesunused_ranges()(core_storage.py:319-331) report this pool's padding, which reaches bothinactiveandzero_ranges(runtime_core.py:298-301) and then splits declared mappings (live_pieces) and trims snapshots (without_zero_ranges) in capture.rs:1471-1490, and relabels inventory rows. The payload is not inflated (requests carry noroots, runtime_core.py:354-370), but the metadata change is unmentioned and untested.
Also flagged: the docstring rewrite at capture.py:53-63 reverses #331's "outside any caller-owned pool" invariant without the maintainer decision AGENTS.md:201-207 requires; the pool is now constructed outside the torch.cuda.device(device) scope (capture.py:118 vs. the old diff), so it binds to the ambient device — latent for in-repo callers only; and getattr-based lazy creation without a lock allows two pools under concurrent captures. docs/preparation-development.md:88-91 is not updated. Areas found sound: the non-export path (2-arg call and all CPU stubs still match, tests/preparation/test_capture_cublas_workspace_cuda.py:97 still reads the module pool), the floor/alignment/validation interactions, and multi-rank independence.
#6 [medium] Extra verified details for the final report
Report framing: PR #606 has one real effect (the export-path warmup seed moves from the module-level _warmup_pools[index] pool into a CoreStorage-owned torch.cuda.MemPool(self._allocator.allocator()) registered in _preparation_pools), the non-export path is genuinely unchanged, and the reach/performance cost is ~34 MiB/rank of retained segment instead of ~34 MiB in the module pool (retention moved, not added; capture.py:67-70 is skipped when pool is passed, so an export process builds no module-level pool). What blocks it is documentation/evidence and two latent correctness items, not a demonstrated defect in the new code.
Extra verified details behind the findings:
-
Allocation/intermediate lifetime still broken by PR #331's design, unchanged here:
capture.py:77-79,168_capture_orderreorders captures bycapture_allocation_sizes, andcapture.py:96-99's docstring warns graphs on one stream share the cached workspace, so resetting one frees what others reference. #606 touches neither; the warmup pool being persistent and unreset is what keeps the seed's backing alive (capture.py:52-63 docstring). -
Reachability detail (supports F1): opaque blob pointer scans (
reachability.rs:149-162) andpointer()skip any pointer inside a range listed ininactive(reachability.rs:118-122). Sinceinactivestill uses CoreStorage's retentive padding rule (core_storage.py:319-331, only live-block padding excluded), a pool-cached block reported inactive-by-PyTorch but already dead at GPU level can be skipped as a pointer target. This affectsgraph_pooland warmup-pool allocations only in so far as they appear ininactive; captured-graph kernel arguments live in graph-kernel argument blobs, not in scanned allocation content (reachability.rs:172-206), so it does not affect graph argument resolution. Graph-pool contents are additionally zeroed wholesale by runtime_core.py:298-299, independent ofunused_ranges. -
export_modelfeeds whole graph-pool segments aszero_ranges(runtime_core.py:298-299) while active allocations inside_preparation_poolssegments are never zeroed → any live block in the new warmup pool (the 32 MiB cuBLASLt workspace and 1 MiB operand, capture.py:72-73) becomes "snapshot" data if some path ever roots it; today norootsare passed so it is omitted (see entry 4). -
Test hygiene detail: the PR-added GPU test issues
torch.cuda.memory_snapshot(export_warmup.id, include_traces=False)at test_capture_cublas_workspace_cuda.py:159 without consulting blockstate, and asserts_active_pool_blocks(export_warmup.id)only after an extra standalone_seed_warmup_workspaces(fresh_stream, 0, export_warmup)call (:164-168) whosetorch.mmon a 512×512 bf16 operand may or may not allocate a cuBLASLt workspace > 0 bytes, so the later assertion is not deterministic evidence of a retained 32 MiB workspace. Alsotorch.backends.cuda.preferred_blas_library("cublaslt")restores a library, not the workspace cache, so a cached workspace from an earlier test in the same process can mask the export-pool assertion. -
Docs contract pointer: AGENTS.md:225-226 routes "Change tuning, compilation, memory planning, capture, or TP preparation" to docs/preparation-development.md, whose lines 88-91 still describe warmup_storage only as "eager warmups allocate from its transient pools and release them before capture" — unchanged by this PR.
-
Process facts verified from the repo side only: the PR description satisfies the four-part requirement (why / what changed / claimed benefit / evidence, AGENTS.md:114-140) and carries the
Discord:line; the evidence given is unexecutable here (needs CUDA + flare_heliopause) and no CI ran on the head commit, and no issue/log/error text accompanies the "native export rejection" claim, which AGENTS.md:165-169 and :194-199 make a blocker for a bug fix.