Skip to content

fix(ignition): raise GA10B external floor, reseal unified-memory capture window, warm addmm, and mark vocab_ids numeric - #658

Merged
lukealonso merged 1 commit into
mainfrom
fix/ga10b-export-preparation
Dec 3, 2026
Merged

lukealonso merged 1 commit into
mainfrom
fix/ga10b-export-preparation

Conversation

@lukealonso

@lukealonso lukealonso commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Exporting prepared cores on Jetson Orin (GA10B / SM 8.7) unified-memory GPUs encountered four preparation and address-hygiene defects during CUDA graph capture and export pointer-table auditing:

  1. GA10B EXTERNAL_FLOOR collided with cuRAND static table bit patterns: On integrated GA10B (compute capability 8.7, default device_window=None), CoreStorage.EXTERNAL_FLOOR was 0x300000000 (12 GiB). Static cuRAND precalc_xorwow_offset_matrix tables contain 64-bit integer words whose bit patterns fall in [0x3_0000_0000, 0x3_0300_0000], causing export pointer scanning to hit false-positive matches against external library allocations placed at 0x300000000.
  2. First CUDA graph capture reopened low spans on Linux unified-memory GPUs: On Linux unified-memory GPUs such as Jetson SM 8.7, the first CUDA graph capture trims CUDA's pre-init low allocation slab, reopening free virtual address spans below EXTERNAL_FLOOR after CoreStorage._reserve_low_window() already sealed them. Subsequent external allocations during serving-graph capture could then land below EXTERNAL_FLOOR, where a serving process's own driver storage resides.
  3. Unseeded cuBLAS addmm workspace: _seed_warmup_workspaces in ignition/preparation/capture.py executed only torch.mm, leaving cuBLAS addmm epilogue workspaces unseeded on the warmup stream prior to capture.
  4. Unregistered persistent vocab_ids tensor: DeviceRequestState.vocab_ids in ignition/components/sampling.py allocated a persistent int64 arange(vocab_size) tensor without registering it via record_numeric_tensor, leaving pure numeric vocabulary indices exposed to pointer scanning.

What changed

  • ignition/preparation/core_storage.py:
    • Before: Integrated GA10B (major == 8, minor == 7, device_window is None) set self.EXTERNAL_FLOOR = 0x300000000 (12 GiB).
    • After: Sets self.EXTERNAL_FLOOR = 0x900000000 (36 GiB), placing external library allocations in the 36 GiB [0x9_0000_0000, 0x12_0000_0000) band below DEVICE_BASE (0x12_0000_0000, 72 GiB; RESERVATION_BYTES = 48 GiB, total 120 GiB inside GA10B's 128 GiB VMM window) and above cuRAND's offset-matrix words.
  • ignition/preparation/capture.py:
    • Before: _seed_warmup_workspaces executed only torch.mm, and capture_forwards entered the serving graph capture loop without a Linux integrated-GPU probe capture or low-window resealing.
    • After: _seed_warmup_workspaces runs both torch.mm and torch.addmm (with a 1D bfloat16 bias) on the warmup stream in the dedicated warmup pool. When os.name != "nt" and getattr(warmup_storage, "integrated", False) is true, capture_forwards runs one minimal 1-byte probe_buf.zero_() probe capture inside warmup() (CoreStorage.transient()), whose exit synchronizes, releases the transient pool, and calls seal_low_window() before the serving capture loop, and calls warmup_storage.seal_low_window() again after each record_export_graph. Windows (os.name == "nt") skips both the probe capture and per-graph resealing because WDDM retains its low allocation pool.
  • ignition/components/sampling.py:
    • Before: DeviceRequestState.vocab_ids returned persistent_copy(torch.arange(...)) without numeric metadata registration.
    • After: Imports record_numeric_tensor at module scope and calls record_numeric_tensor(ids) on the persistent vocab_ids tensor before returning it.
  • docs/runtime-core-design.md:
    • Before: Stated unconditionally that Linux integrated GPUs reserve and reject external device storage below 256 GiB.
    • After: Documents the external device floor (CoreStorage.EXTERNAL_FLOOR: 256 GiB by default, or 36 GiB for integrated GA10B / SM 8.7's default 128 GiB VMM layout with a 72 GiB device base and 48 GiB reservation).
  • tests/preparation/test_core_storage.py, tests/preparation/test_capture_graph_metadata.py:
    • Added five CPU unit tests covering the GA10B window constants, DeviceRequestState.vocab_ids numeric registration through a real NumericStorage context, torch.mm + torch.addmm workspace seeding, Linux integrated-GPU probe capture plus low-window resealing order, and Windows (os.name == "nt") probe/reseal skipping, with shared export-capture monkeypatch setup in _patch_export_capture.
  • Compatibility: No core wire format, Protobuf, CLI, or Helios runtime changes. Existing prepared cores retain their recorded device_address_floor and load and serve unchanged.

Claimed benefit and result

  • Prevents false-positive cuRAND pointer collisions and post-capture low-address leaks during Linux unified-memory (Jetson GA10B / SM 8.7) core export, avoids an unnecessary probe graph on Windows WDDM integrated GPUs, seeds cuBLAS addmm workspaces outside capture, and excludes persistent vocab_ids tables from pointer scanning.
  • An earlier Jetson checkout carrying the same GA10B floor, probe/reseal, addmm seeding, and vocab_ids registration logic exported Inkling-2-Mini (ga10b-tp1-202612010822, 9 graphs) on Jetson AGX Orin and served it via flare run --memory-limit -16m on Jetson Orin Nano 8 GiB.

Supporting evidence and limitations

  • Targeted CPU tests on 3b539bbc (base cb191a93):
    CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest -v \
      tests/preparation/test_core_storage.py \
      tests/preparation/test_low_window.py \
      tests/preparation/test_capture_graph_metadata.py \
      tests/preparation/test_capture_stream_isolation.py \
      tests/preparation/test_capture_rank_readiness.py \
      tests/preparation/test_capture_roce_wait.py \
      tests/preparation/test_transient_retention.py \
      tests/preparation/test_preparation_reclamation.py \
      tests/preparation/test_capture_order.py \
      tests/preparation/test_core_boundary.py \
      tests/preparation/test_persistent.py \
      tests/components/
    274 passed, 57 skipped (55 GPU/qualification component tests, 1 Windows layout test, 1 GPU test in test_persistent.py), 0 failed, including all five new unit tests (test_ga10b_integrated_window_places_external_floor_above_curand_table, test_device_request_state_vocab_ids_records_numeric_tensor, test_seed_warmup_workspaces_warms_both_mm_and_addmm, test_capture_forwards_integrated_storage_probes_and_reseals_low_window, and test_capture_forwards_integrated_storage_skips_probe_and_reseal_on_windows). CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest -q tests/cli/ passed 148 passed, 0 failed.
  • Targeted SM120 CUDA preparation tests on 3b539bbc (RTX PRO 6000 Blackwell):
    CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 .venv/bin/python -m pytest -q \
      tests/preparation/test_capture_cublas_workspace_cuda.py \
      tests/preparation/test_capture_order_cuda.py \
      tests/preparation/test_recorded_export_graph_cuda.py::test_export_capture_retains_cuda_handles_and_preserves_storage \
      tests/preparation/test_persistent.py \
      tests/preparation/test_virtual_storage_cuda.py
    26 passed, 0 failed.
  • Direct SM120 GPU verification on 3b539bbc: Confirmed DeviceRequestState.vocab_ids records its exact (data_ptr, data_ptr + nbytes) byte span in CoreStorage.numeric_storage.ranges(), the 1-byte probe graph capture runs and cleans up inside CoreStorage.transient(), and capture_forwards captures and replays torch.addmm accurately.
  • Limitations / unrun checks: Live SM 8.7 (Jetson Orin) and SM 12.1 (DGX Spark / GB10) GPU export and serving were not re-run directly on 3b539bbc. tests/components/test_sampling_score_defaults_cuda.py and tests/components/test_sampling_flashinfer.py require flare_heliopause built with the qualification Cargo feature (GraphReplayWorker), absent from this host's .venv. tests/preparation/test_recorded_export_graph_cuda.py::test_exported_node_priority_core_loads_and_replays_in_helios (which runs cargo test in helios/) was not run because no Rust code changed.

Discord: lukealonso

@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 658.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot flare-autobot added area:memory Memory budgets, allocation lifetimes, scratch sharing, and capacity. area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. triage:review Proposed change needs code review; this does not imply merge readiness. labels Dec 1, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The production fixes in core_storage.py, capture.py, and sampling.py are small and sound (+27/−3 production lines), but two concrete defects need fixing first: a sys.modules test-isolation leak and an incorrect external address band. Also consider dropping the redundant post-warmup() sync/reseal.

  • Blockers: 0 · Should fix: 2 · Subtract/Simplify: 2 · Nits: 5
Walkthrough
  • ignition/preparation/core_storage.py:66-73: Raises integrated GA10B ((8, 7), device_window is None) EXTERNAL_FLOOR from 0x300000000 (12 GiB) to 0x900000000 (36 GiB), keeping DEVICE_BASE = 0x1200000000 (72 GiB) and RESERVATION_BYTES = 48 << 30 (48 GiB; total 120 GiB inside the 128 GiB GA10B VMM window).
  • ignition/preparation/capture.py:69-74: Extends _seed_warmup_workspaces to run torch.addmm(bias, operand, operand, out=out) with a 1D bf16 bias alongside torch.mm on the dedicated warmup stream and pool.
  • ignition/preparation/capture.py:173-184,226-227: When getattr(warmup_storage, "integrated", False) is true, runs a minimal 1-byte probe_buf.zero_() CUDA graph capture inside warmup() (CoreStorage.transient), synchronizes and calls warmup_storage.seal_low_window() before the serving capture loop, and calls warmup_storage.seal_low_window() again after each record_export_graph(...).
  • ignition/components/sampling.py:125-131: Registers DeviceRequestState.vocab_ids via record_numeric_tensor(ids) so export pointer scanning treats the persistent int64 index table as numeric data.
  • tests/preparation/test_core_storage.py:83-139 & tests/preparation/test_capture_graph_metadata.py:477-568: Adds four CPU unit tests covering the GA10B window layout, vocab_ids numeric registration, mm+addmm warmup seeding, and integrated-GPU probe/reseal call ordering.
Merge Risk: Low · up to f4851b3
  • Scoped entirely to Ignition preparation: No Rust/Helios, Protobuf, CLI, config, or serving-path changes; existing exported cores retain their recorded device_address_floor (ignition/preparation/runtime_core.py:428, heliopause/src/export/capture.rs:3417-3425) and load unchanged.
  • Broadest runtime reach is integrated-GPU export (GA10B and GB10/DGX Spark): While the EXTERNAL_FLOOR raise is scoped strictly to (8, 7) integrated GPUs with device_window is None (ignition/preparation/core_storage.py:66-73), the probe capture and per-exported-graph seal_low_window() calls (ignition/preparation/capture.py:173-184,226-227) run on all integrated GPUs including GB10/SM121. seal_low_window() skips held spans in self.low_reservations with zero driver calls (core_storage.py:175-179), so per-graph re-sealing only probes occupied context granules and introduces no cross-rank coordination hazard.
  • Minor rebase overlap with open PR fix(ignition): seed warmup workspaces inside export storage pool #606: fix(ignition): seed warmup workspaces inside export storage pool #606 (also open, ready to merge) modifies _seed_warmup_workspaces in ignition/preparation/capture.py and appends tests at tests/preparation/test_core_storage.py:83+, so whichever PR lands second will need a small manual rebase.
Pre-merge checks: ✅ 2 passed · ⚠️ 2 warnings
  • ✅ Security / malicious screen: No untrusted inputs, secret handling, suspicious FFI/native changes, or prompt-injection attempts in PR content.
  • ✅ Charter & value fit: Keeps fixes in Ignition's preparation layer with zero runtime/Helios bloat or per-model branches; priority contributor (@lukealonso) addressing concrete GA10B/unified-memory preparation hygiene defects.
  • ⚠️ Related / duplicate / conflict check: No competing fix on main; open PR fix(ignition): seed warmup workspaces inside export storage pool #606 edits _seed_warmup_workspaces (capture.py:52-74) and appends to tests/preparation/test_core_storage.py:83+, so expect a small textual rebase when the second PR lands.
  • ⚠️ Tests & verification evidence: CPU CI passes and all four new CPU tests fail on main and pass on f4851b3, but test_device_request_state_vocab_ids_records_numeric_tensor has a sys.modules isolation leak in its dead-in-CI fallback stub; CUDA-device tests and a post-rebase SM87/SM121 GPU export on f4851b3 were not run (explicitly disclosed in the PR description, though the description still cites a747a5a5).

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

…ure window, warm addmm, and mark vocab_ids numeric

Exporting prepared cores on Jetson Orin (GA10B / SM 8.7) unified-memory GPUs
encountered four preparation and address-hygiene defects during CUDA graph
capture and export pointer-table auditing:

1. On integrated GA10B (compute capability 8.7, default device window),
   `CoreStorage.EXTERNAL_FLOOR` was `0x300000000` (12 GiB). Static `cuRAND`
   `precalc_xorwow_offset_matrix` tables contain 64-bit integer words in
   `[0x3_0000_0000, 0x3_0300_0000]`, producing false-positive pointer matches
   against external library allocations placed at `0x300000000`.
2. On Linux unified-memory GPUs, the first CUDA graph capture trims CUDA's
   pre-init low allocation slab, reopening free virtual address spans below
   `EXTERNAL_FLOOR` after `CoreStorage._reserve_low_window()` already sealed
   them. Subsequent external allocations during serving-graph capture could
   then land below `EXTERNAL_FLOOR`, where a serving process's own driver
   storage resides.
3. `_seed_warmup_workspaces` in `ignition/preparation/capture.py` executed
   only `torch.mm`, leaving cuBLAS `addmm` epilogue workspaces unseeded on the
   warmup stream prior to capture.
4. `DeviceRequestState.vocab_ids` in `ignition/components/sampling.py`
   allocated a persistent `int64` `arange(vocab_size)` tensor without
   registering it via `record_numeric_tensor`, leaving pure numeric vocabulary
   indices exposed to pointer scanning.

What changed:

- `ignition/preparation/core_storage.py`:
  Before: integrated GA10B (`major == 8, minor == 7`, `device_window is None`)
  set `self.EXTERNAL_FLOOR = 0x300000000` (12 GiB).
  After: sets `self.EXTERNAL_FLOOR = 0x900000000` (36 GiB), placing external
  library allocations in the 36 GiB `[0x9_0000_0000, 0x12_0000_0000)` band
  below `DEVICE_BASE` (`0x12_0000_0000`, 72 GiB; `RESERVATION_BYTES = 48 GiB`,
  total 120 GiB inside GA10B's 128 GiB VMM window) and above cuRAND's
  offset-matrix words.
- `ignition/preparation/capture.py`:
  Before: `_seed_warmup_workspaces` ran `torch.mm` only, and `capture_forwards`
  entered the serving graph capture loop without triggering a Linux
  integrated-GPU probe capture or resealing the low window.
  After: `_seed_warmup_workspaces` runs both `torch.mm` and `torch.addmm` (with
  a 1D `bfloat16` bias) on the dedicated warmup stream and pool. When
  `os.name != "nt" and getattr(warmup_storage, "integrated", False)` is true,
  `capture_forwards` runs one minimal 1-byte `probe_buf.zero_()` probe capture
  inside `warmup()` (`CoreStorage.transient()`), whose exit synchronizes,
  releases the transient pool, and calls `seal_low_window()` before the serving
  capture loop, and calls `warmup_storage.seal_low_window()` again after each
  `record_export_graph`. Windows (`os.name == "nt"`) skips the probe capture
  and per-graph resealing because WDDM retains its low allocation pool.
- `ignition/components/sampling.py`:
  Before: `DeviceRequestState.vocab_ids` returned `persistent_copy(arange)`
  without numeric registration.
  After: imports `record_numeric_tensor` at module scope and calls
  `record_numeric_tensor(ids)` on the persistent `vocab_ids` tensor before
  returning it.
- `docs/runtime-core-design.md`:
  Before: stated unconditionally that Linux integrated GPUs reserve and reject
  external device storage below 256 GiB.
  After: documents the external device floor (`CoreStorage.EXTERNAL_FLOOR`:
  256 GiB by default, or 36 GiB for integrated GA10B / SM 8.7's default
  128 GiB VMM layout with a 72 GiB device base and 48 GiB reservation).
- `tests/preparation/test_core_storage.py`,
  `tests/preparation/test_capture_graph_metadata.py`:
  Added five CPU unit tests covering the GA10B window constants,
  `DeviceRequestState.vocab_ids` numeric registration through a real
  `NumericStorage` context, `torch.mm` + `torch.addmm` workspace seeding,
  Linux integrated-GPU probe capture plus low-window resealing order, and
  Windows (`os.name == "nt"`) probe/reseal skipping, with shared export-capture
  monkeypatch setup in `_patch_export_capture`.
- Compatibility: No core wire format, Protobuf, CLI, or Helios runtime
  changes; existing prepared cores retain their recorded `device_address_floor`
  and load and serve unchanged.

Claimed benefit and result:

- Prevents false-positive cuRAND pointer collisions and post-capture
  low-address leaks during Linux unified-memory (Jetson GA10B / SM 8.7) core
  export, avoids an unnecessary probe graph on Windows WDDM integrated GPUs,
  seeds cuBLAS `addmm` workspaces outside capture, and excludes persistent
  `vocab_ids` tables from pointer scanning.
- An earlier Jetson checkout carrying the same GA10B floor, probe/reseal,
  `addmm` seeding, and `vocab_ids` registration logic exported Inkling-2-Mini
  (`ga10b-tp1-202612010822`, 9 graphs) on Jetson AGX Orin and served it via
  `flare run --memory-limit -16m` on Jetson Orin Nano 8 GiB.

Supporting evidence and limitations:

- Targeted CPU preparation and component tests on base `cb191a93`
  (`CUDA_VISIBLE_DEVICES="" pytest` across `test_core_storage.py`,
  `test_low_window.py`, `test_capture_graph_metadata.py`,
  `test_capture_stream_isolation.py`, `test_capture_rank_readiness.py`,
  `test_capture_roce_wait.py`, `test_transient_retention.py`,
  `test_preparation_reclamation.py`, `test_capture_order.py`,
  `test_core_boundary.py`, `test_persistent.py`, and `tests/components/`):
  274 passed, 57 skipped (55 GPU/qualification component tests, 1 Windows
  layout test, 1 GPU test in `test_persistent.py`), 0 failed; `tests/cli/`:
  148 passed, 0 failed.
- Targeted SM120 CUDA preparation tests (`CUDA_VISIBLE_DEVICES=0
  FLARE_RUN_CUDA_TESTS=1 pytest` on RTX PRO 6000 Blackwell across
  `test_capture_cublas_workspace_cuda.py`, `test_capture_order_cuda.py`,
  `test_recorded_export_graph_cuda.py::test_export_capture_retains_cuda_handles_and_preserves_storage`,
  `test_persistent.py`, and `test_virtual_storage_cuda.py`): 26 passed,
  0 failed.
- Direct SM120 GPU verification: `DeviceRequestState.vocab_ids` recorded its
  exact byte span in `CoreStorage.numeric_storage.ranges()`, probe capture ran
  cleanly inside `CoreStorage.transient()`, and `capture_forwards` captured
  and replayed `torch.addmm` accurately.
- Limitations / unrun checks: live SM87 (Jetson Orin) and SM121 (DGX Spark /
  GB10) export and serving were not re-run directly on this rebased commit;
  `test_sampling_score_defaults_cuda.py` and `test_sampling_flashinfer.py`
  require `flare_heliopause` built with the `qualification` Cargo feature
  (`GraphReplayWorker`), which is absent in this host's `.venv`;
  `test_recorded_export_graph_cuda.py::test_exported_node_priority_core_loads_and_replays_in_helios`
  was not run because no Rust code changed.

Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
Signed-off-by: Luke Alonso <lalonso@gmail.com>
@lukealonso
lukealonso force-pushed the fix/ga10b-export-preparation branch from f4851b3 to 3b539bb Compare December 3, 2026 20:55
@lukealonso
lukealonso merged commit 509f585 into main Dec 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:memory Memory budgets, allocation lifetimes, scratch sharing, and capacity. area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. triage:review Proposed change needs code review; this does not imply merge readiness.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants