Pre test report report · NVIDIA/hyperflare-inference #606

Raw Markdown for agents: https://autobot.eidonix.com/p/64425c36-9f7d-4bb5-b4c0-3dd3bc255d79.md

Hardware Test Plan — PR #606 (fix(ignition): seed warmup workspaces inside export storage pool)

Bottom line first

Recommendation: yes to a hardware test, but a small, sharply-scoped one on cn7 only, and it must not start with the PR's own test.

Total GPU-time budget: ~25–35 minutes on cn7 (plus ~5 min on cn5), of which only ~5 minutes are after the reproduction gate passes. Everything else is CPU-only or skippable.


Why the defect only exists on cn7

Fact Citation
storage.integrated = torch.cuda.get_device_properties(device).is_integrated; the low-window seal and the export floor are gated on it ignition/preparation/core_storage.py:65, :106-108, :127-141, :161-189
Export sets device_address_floor = storage.EXTERNAL_FLOOR if storage.integrated else 0 ignition/preparation/runtime_core.py:364
Failure is prepare_allocations: recorded memory == "device" segments not covered by a declared allocation are rejected when cuPointerGetAttribute(CONTEXT) returns 0 (VMM cuMemMap segments) heliopause/src/export/capture.rs:1407-1468 (reject at :1461-1466), heliopause/src/export/recorder.rs:467-478
Declared device-{i} mappings come from storage.mappings, which is why the fix's segments are skipped heliopause/src/export/capture.rs:1437-1441, ignition/preparation/runtime_core.py:308-310, ignition/preparation/core_storage.py:199-205
The fix's pool allocates from flare_core_allocate (VMM cuMemCreate/cuMemMap inside the reserved window) ignition/preparation/core_storage.py:301-310, heliopause/src/allocator.rs:415-489

On cn5 (is_integrated == False) the floor is 0 and seal_low_window() returns immediately (core_storage.py:167), so neither rejection can fire — cn5 can only prove "nothing regressed".

Scope limit forced by the hardware: cn7 has 1 GPU, 10 CPUs, 60 GiB RAM, 16 GiB scratch → single-rank exports only. Multi-rank GB10 export (the rank_group.py:44-113 / host_ranks.py:343-377 peer path that also passes warmup_storage) cannot be tested with the available machines. Say so in the sign-off; do not attempt --ranks.


Step 0 — Environment and build gate on cn7 (CPU, ~15–20 min, no GPU time wasted on failure)

cd <repo>            # PR head 8c1a28a
uv sync --extra prepare --reinstall-package flare-heliopause
uv pip install --python .venv/bin/python --no-deps ./heliopause
uv pip install --python .venv/bin/python --no-deps -e .
.venv/bin/python -c "import torch, flare_heliopause; print(torch.__version__, torch.cuda.get_device_name(0), torch.cuda.get_device_properties(0).is_integrated)"

Per AGENTS.md:249-266 and heliopause/pyproject.toml (maturin, features = ["server","extension-module"]). Abort immediately if:

Also raise the locked-memory limit in the job shell — the integrated path mlocks host regions and fails with RLIMIT_MEMLOCK otherwise (core_storage.py:460-461; CI sets 64 MiB at .github/workflows/native-serving.yml:61-62 (not opened)):

sudo prlimit --pid $$ --memlock=67108864:67108864

Do not plan an end-to-end recipe export (ignition export qwen3.8-27b) unless a cached checkpoint is already present: the machine listing shows 0 GiB for every model, so it would mean a multi-GB download plus full tuning/compilation on 10 CPUs on a 16 GiB scratch volume. Recipes also live in the external local-inference-lab/hyperflare-recipes package (docs/model-preparation.md:310-330), not in this repo. The harness below needs no checkpoint.


Step 1 — CPU tier (any machine, ~2 min, no GPU)

.venv/bin/python -m pytest tests/preparation/test_core_storage.py -q
.venv/bin/python -m pytest tests/preparation/test_capture_stream_isolation.py (not opened) tests/preparation/test_transient_retention.py (not opened) \
  tests/preparation/test_capture_graph_metadata.py (not opened) tests/preparation/test_capture_rank_readiness.py (not opened) \
  tests/preparation/test_capture_roce_wait.py (not opened) tests/preparation/test_forward_compile_options.py (not opened) \
  tests/preparation/test_preparation_reclamation.py (not opened) -q

First file contains the PR's new test_warmup_pool_reuses_one_core_allocator_pool (tests/preparation/test_core_storage.py:83-105). The second set are the seven CPU files that stub _seed_warmup_workspaces with 2-argument lambdas and are the only reason capture.py:119-124 keeps its if warmup_pool is not None: / else split — a regression here means the non-export path was broken. Both are free; run them first even though they cannot validate the fix.


Step 2 — GPU tier on cn7: the PR's tests as shipped (~3 min, mostly import/compile)

CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 \
  .venv/bin/python -m pytest \
    tests/preparation/test_capture_cublas_workspace_cuda.py \
    tests/preparation/test_recorded_export_graph_cuda.py -q

Step 3 — GPU tier on cn7: the decisive A/B harness (~5 min total, run on main and on the PR head)

This is the plan's core. It exercises the real native validations by going through export_model instead of RuntimeCore.write.

git worktree add ../flare-main origin/main        # baseline, same .venv

Save as /tmp/warmup_export_repro.py (not opened) (run from repo root; works in either worktree):

import sys
from contextlib import nullcontext
from pathlib import Path
from types import SimpleNamespace
import torch
from ignition.preparation.capture import capture_forwards
from ignition.preparation.core_storage import CoreStorage
from ignition.preparation.execution import GraphSignature, PreparedExecution
from ignition.preparation.module_images import ModuleImages
from ignition.preparation.runtime_core import export_model

out = Path(sys.argv[1]); out.mkdir(parents=True, exist_ok=True)
with ModuleImages() as images:
    torch.cuda.set_device(0)
    prev = torch.backends.cuda.preferred_blas_library()
    torch.backends.cuda.preferred_blas_library("cublaslt")
    try:
        storage = CoreStorage()                      # integrated=True on GB10 -> floor + low-window seal active
        with storage:
            src = torch.randn((512, 512), device="cuda", dtype=torch.bfloat16)
            w   = torch.randn((512, 512), device="cuda", dtype=torch.bfloat16)
            o   = torch.empty_like(src)
            frame = torch.zeros(1, device="cuda", dtype=torch.int32)
            seq   = torch.zeros(1, device="cuda", dtype=torch.int64)
            rec   = torch.zeros((2, 1, 24), device="cuda", dtype=torch.int64)
            def forward(): torch.mm(src, w, out=o)
            stream = torch.cuda.Stream()
            graphs, _ = capture_forwards({"decode": forward}, {"decode": GraphSignature("decode", 1, 1)},
                session=SimpleNamespace(capture=nullcontext), device=0, stream=stream,
                pool=storage.graph_pool.id, warmup_storage=storage,
                retain_graphs=True, compile_decoder=False)
            try:
                prep = PreparedExecution(device=0, graphs=graphs,
                    buffers=dict(source=src, weight=w, output=o, frame_index=frame,
                                 submission_sequence=seq, completion_records=rec),
                    max_active=1, signatures={"decode": GraphSignature("decode", 1, 1, ("source",))})
                prep.server_config = {}
                prep.core_data = None
                core = export_model(prep, images, storage, out / "rank.json (not opened)",
                                    options={}, bundle_only=True)   # full discovery + floor
                print("EXPORT_OK", flush=True)
                print("allocations:", len(core.allocations), "external:", core.external, flush=True)
                if hasattr(storage, "warmup_pool"):
                    warm = storage.warmup_pool()
                    declared = [(a.address, a.nbytes) for a in core.allocations]
                    for seg in torch.cuda.memory_snapshot(warm.id, include_traces=False):
                        inside  = any(s <= seg["address"] and seg["address"] + seg["total_size"] <= s + n
                                      for s, n in declared)
                        covered = any(s <= seg["address"] < s + n for s, n in declared)
                        print(f"warmup segment {seg['address']:#x}+{seg['total_size']} "
                              f"declared={inside} exported={covered}", flush=True)
            finally:
                for g in graphs.values(): g.reset()
    finally:
        torch.backends.cuda.preferred_blas_library(prev)

Run:

CUDA_VISIBLE_DEVICES=0 .venv/bin/python /tmp/warmup_export_repro.py (not opened) /tmp/main-out   2>&1 | tail -40   # from ../flare-main
CUDA_VISIBLE_DEVICES=0 .venv/bin/python /tmp/warmup_export_repro.py (not opened) /tmp/head-out   2>&1 | tail -40   # from PR head

Reproduction gate and acceptance criteria

Outcome Meaning Action
main raises RuntimeError: ... external allocation 0x... is not device memory in the serving context ... (text from capture.rs:1461-1466) and the head prints EXPORT_OK Defect reproduced and fixed on real GB10 validation PASS — proceed to Step 4
main prints EXPORT_OK with external: [...] non-empty The warmup segment was accepted as an external allocation → the module pool happened to be cudaMalloc-backed on this host; the failure the PR describes does not reproduce here INCONCLUSIVE — do not spend more GPU time; report that the fix is unverifiable on our hardware, attach both logs, and ask the author for the exact GB10 command/log (they claim spark-b23d)
head raises the same error, or storage.warmup_pool() segments show declared=False The fix does not hold on this host FAIL — capture full output + storage.mappings dump, block merge
both fail before export (import/MemPool/mlock errors) Environment fault, not a PR signal Fix env per Step 0; counts as no evidence

On the head, also record (one line each, no extra runs): external must be empty, every warmup segment must print declared=True exported=False (the operand block is fed through unused_ranges() → inactive/zero_ranges at runtime_core.py:298-301 and core_storage.py:320-335, and is unreachable per reachability.rs:118-122), and len(core.allocations) must equal main's count plus nothing — i.e. no new exported allocation. If a warmup segment appears in core.allocations, the "retention moved, not added" claim is false and the PR needs rework.

Fallbacks if the bundle construction trips a contract check: copy helios/tests/fixed_core_fixture.py:159-172 verbatim (it is the maintained export_model + PreparedExecution pattern), or drop bundle_only=True and pass server_config from helios/tests/fixture_frontend.py (not opened). bundle_only only suppresses server metadata (runtime_core.py:332, :366); it does not skip prepare_allocations or reachability.


Step 4 — Memory accounting and native load (only if Step 3 passed; ~5 min, cn7)

  1. Retained bytes. In the same process as Step 3, before export_model, print torch.cuda.memory_allocated and len(torch.cuda.memory_snapshot(storage.warmup_pool().id))-derived sizes. Expected: one 2 MiB operand segment freed, and up to ~32 MiB cuBLASLt workspace held for process life. Assert the head does not retain more than main's module pool did (the change relocates ownership into CoreStorage's VMM arena rather than adding memory). Record the numbers; there is no target to beat.
  2. Native replay of the exported core — the real proof the metadata is still loadable: cargo build --release --manifest-path flare-cli/Cargo.toml (not opened), then ./flare-cli/target/release/flare inspect <out>/rank.json (not opened) (or flare run if the bundle carries enough metadata; inspect needs no GPU work). Expected: verifies and lists the decode graph; failure means the warmup-pool registration corrupted exported content (core_storage.py:309) and merge must be blocked even though Step 3 passed.

Step 5 — cn5 (discrete, 4× RTX PRO 6000): no-regression only, ~5 min, 1 GPU

git worktree… # PR head
CUDA_VISIBLE_DEVICES=0 .venv/bin/python /tmp/warmup_export_repro.py (not opened) /tmp/cn5-out   # expect EXPORT_OK, external: []
CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 .venv/bin/python -m pytest \
  tests/preparation/test_capture_cublas_workspace_cuda.py tests/preparation/test_recorded_export_graph_cuda.py -q

Purpose: confirm non-integrated export is unchanged (floor 0, no low-window seal) and that warmup_pool() does not disturb the discrete path. One GPU only; do not occupy 4 GPUs — the other three buy nothing for this PR. If time is tight, this step is the first to cut: the code path is gated on is_integrated, and Step 1's CPU tier plus Step 3 on cn7 already cover correctness.


Explicitly out of scope (do not spend GPU time)

Risks the test engineer should watch

  1. Reproduction may simply not happen (module pool may not be VMM-backed on main) — the single largest risk; hence the Step 3 gate before any wider run.
  2. cn7 build wheel availability for torch 2.14.1+cu132 / flare-heliopause on arm64 — gate in Step 0.
  3. RLIMIT_MEMLOCK on integrated hosts (core_storage.py:460-461).
  4. 16 GiB scratch — keep exports under /tmp or the job scratch and delete between arms; two arms total ≈ tens of MiB, so this is comfortable.
  5. Order-dependent cuBLASLt cache state — always run the two CUDA test files together in one pytest invocation, and never interleave Step 3 arms in one interpreter (separate processes, as written).
  6. If Steps 3–4 pass, the remaining merge gate is procedural, not hardware: DCO Signed-off-by and a maintainer decision that relocating the warmup pool into CoreStorage (a partial reversal of #331's "outside any caller-owned pool" invariant, docstring now at capture.py:59-64) is the intended layer rather than #332-style export diagnostics.