Repository navigation
ignition: propagate CLI prog, move image specs to recipes, and harden state.py kernels - #683
Merged
Merged
Conversation
… state.py kernels
After separating external recipe packs from core `ignition`, three core/recipe
boundary and GPU-safety defects remained in `ignition`:
1. `ignition.preparation.rebuild_manifest.reproduction_arguments` hardcoded
`'ignition'` as argv[0] even though `ignition.cli.main` already accepts a
caller-supplied `prog` (for example `ignition-jetson` in
`hyperflare-jetson-recipes`). External recipe packs therefore recorded
unreproducible `ignition export ...` commands in their core manifests.
2. `ignition/preparation/frontend.py` hardcoded external recipe `model_type`
strings (`inkling2`, `inkling2_loop`, `glm5_next`, `qwen4_exp`, `mimo_v2`),
processor class names, and model-specific token IDs (`154854`, `154855`,
`18`, `151655`). Keeping checkpoint-specific validation tables in core
forces external recipes to patch `hyperflare-inference` whenever a recipe's
vision metadata changes.
3. The Triton kernels in `ignition/components/state.py` (`_gather_rows`,
`_gather_rows_three`, `_scatter_rows`, `_save_hidden`, and
`_request_history`) multiplied `int32` row/slot indices by row strides
without casting to `tl.int64`, risking signed 32-bit overflow on large
hybrid continuation pools (115-215 MiB per row). In addition,
`_scatter_rows` baked export-time `SLOTS: tl.constexpr` instead of reading
Helios's dynamic `memory_capacity` (`STATE_ROWS`), and allowed writes to
reserved null continuation slot `0` (`selected >= 0`).
What changed:
- CLI program-name propagation (`ignition/registry.py`,
`ignition/cli/__init__.py`, `ignition/preparation/rebuild_manifest.py`):
- Before: `ignition.cli.main` passed `prog` only to `argparse`, and
`reproduction_arguments` hardcoded `['ignition', 'export', ...]`.
- After: Added `active_prog` / `current_prog` `ContextVar` helpers in
`ignition/registry.py` (defaulting to `'ignition'`), bound `active_prog`
inside `ignition.cli.main`, and updated `reproduction_arguments` /
`from_plan` to emit `[current_prog(), 'export', ...]` with an optional
`prog=` override. No plugin discovery is introduced.
- Recipe-owned image specs (`ignition/preparation/frontend.py`):
- Before: `image_settings(config, model, profile, qwen_model_type=...)` and
`prepare_frontend(..., image_profile=..., qwen_model_type=...)` branched
on hardcoded recipe profiles and model constants.
- After: Added a typed `ImageProcessorSpec` dataclass and core Helios
`ImageSettings` wire-payload validation (`_validate_image_payload`).
`image_settings(config, model, spec)` and
`prepare_frontend(..., image_spec=...)` now validate checkpoint metadata
strictly against the recipe-supplied `ImageProcessorSpec` while preserving
the exact Protobuf `ImageSettings` wire format.
- `state.py` kernel hardening (`ignition/components/state.py`):
- Before: `_gather_rows`, `_gather_rows_three`, `_scatter_rows`,
`_save_hidden`, and `_request_history` computed pointer offsets in
default integer width, and `_scatter_rows` checked
`(selected >= 0) & (selected < SLOTS)`.
- After: Cast row, slot, and column indices to `tl.int64` in all five
Triton kernels. Updated `scatter_rows` to forbid null slot `0` by default
(`allow_zero=False`, with `allow_zero=True` available for 0-indexed
non-continuation tables such as KV pages) and to accept an optional
`memory_capacity` int64 device tensor so `_scatter_rows` reads Helios's
live `STATE_ROWS` count dynamically at replay time.
- Unit and CUDA tests (`tests/components/test_state.py`,
`tests/cli/test_parameters.py`, `tests/preparation/test_frontend_spec.py`):
Added tests covering `active_prog` manifest emission, `ImageProcessorSpec`
validation and rejection paths, and CPU/CUDA `scatter_rows` null-slot-0
protection and dynamic `memory_capacity` updates.
Claimed benefit and compatibility:
- Expected to eliminate signed 32-bit offset overflow in `state.py` on large
continuation pools, prevent `scatter_rows` from corrupting reserved null
slot `0` or dropping writes after Helios dynamically grows `STATE_ROWS`,
record accurate reproduction commands for external recipe CLIs without
introducing plugin discovery, and remove external recipe names and token
IDs from core `ignition`.
- Wire compatibility: Protobuf `ImageSettings` and exported model core
formats are unchanged. Python callers of `prepare_frontend` and
`image_settings` must pass `image_spec: ImageProcessorSpec` (paired updates
are provided in `hyperflare-recipes` and `hyperflare-jetson-recipes`).
Supporting evidence and limitations:
- Ran `pytest tests/preparation/test_core_boundary.py
tests/preparation/test_frontend_spec.py tests/components/test_state.py
tests/components/test_state_gather_fields.py tests/cli` with
`CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1` on an NVIDIA RTX PRO 6000
Blackwell (SM120): 164 passed, 0 failed (including live CUDA execution of
`_scatter_rows` dynamic `memory_capacity`, null-slot-0 protection,
`allow_zero=True`, and `_gather_rows`).
- Limitations: Rust crate tests were not run because no Rust files changed.
Full model core export (`ignition export` + `flare run`) and multi-GPU
tensor-parallel tests were not run.
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
This was referenced Dec 2, 2026
Collaborator
|
A case file has been opened for 683. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Collaborator
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe
Walkthrough
Merge Risk: Medium · up to
|
lukealonso
added a commit
to local-inference-lab/hyperflare-recipes
that referenced
this pull request
Dec 3, 2026
`main` in `local-inference-lab/hyperflare-recipes` now requires `ImageProcessorSpec` and `scatter_rows(..., memory_capacity=...)` from `NVIDIA/hyperflare-inference#683` (`0fca9938`), while `uv.lock` still pinned `ignition` and `flare-heliopause` to `d3d0e783`. Changes (before -> after): - `uv.lock`: advanced `ignition` and `flare-heliopause` along `NVIDIA/hyperflare-inference` `main` from `d3d0e783555c023ba742d53ce7c77833df55d0d0` to `c513e46a79f3b6ac510235aaf09bcf055b841958` (including `#683` and `#684`) while keeping `flashinfer-python` at `a33c0349` and lock revision `5` unchanged. Expected effect: fresh `uv sync` installs pull the `ignition` ABI required by `#131` and `#134`. Verification: `uv lock --check --offline` passed (105 packages resolved, exit 0). Full `uv sync` and `flare-heliopause` wheel rebuild were not run in this environment. Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=6fcc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this change is needed
After separating external recipe packs from core
ignition, three core/recipe boundary and GPU-safety defects remained inignition:ignition.preparation.rebuild_manifest.reproduction_argumentshardcoded'ignition'asargv[0]even thoughignition.cli.mainalready accepts a caller-suppliedprog(for exampleignition-jetsoninhyperflare-jetson-recipes). External recipe packs therefore recorded unreproducibleignition export ...commands in core manifests.ignition/preparation/frontend.pyhardcoded external recipemodel_typestrings (inkling2,inkling2_loop,glm5_next,qwen4_exp,mimo_v2), processor class names, and literal token IDs (154854,154855,18,151655). Keeping checkpoint-specific validation tables insidehyperflare-inferencecouples coreignitionto external recipe changes.ignition/components/state.py(_gather_rows,_gather_rows_three,_scatter_rows,_save_hidden,_request_history) multipliedint32row/slot indices by row strides without casting totl.int64, risking signed 32-bit offset overflow on large hybrid continuation pools (115–215 MiB per row). In addition,_scatter_rowsbaked export-timeSLOTS: tl.constexprinstead of reading Helios's dynamicmemory_capacity(STATE_ROWS), and allowed writes to reserved null continuation slot0(selected >= 0).This PR keeps core
ignitionstrictly at the 12 Helios-ABI modules inignition/components/and introduces no plugin discovery.What changed
progpropagation (ignition/registry.py,ignition/cli/__init__.py,ignition/preparation/rebuild_manifest.py):ignition.cli.mainpassedprogonly toargparse, andreproduction_argumentshardcoded['ignition', 'export', ...].active_prog/current_progContextVarhelpers inignition/registry.py(defaulting to'ignition'), boundactive_prog(prog)inignition.cli.main, and updatedreproduction_arguments/from_planto emit[current_prog(), 'export', ...]with an optionalprog=override.ImageProcessorSpec(ignition/preparation/frontend.py):image_settings(config, model, profile, qwen_model_type=...)andprepare_frontend(..., image_profile=..., qwen_model_type=...)branched on hardcoded external recipe profiles and constants.ImageProcessorSpecdataclass and core HeliosImageSettingswire-payload validation (_validate_image_payload).image_settings(config, model, spec)andprepare_frontend(..., image_spec=...)validate checkpoint metadata against the recipe-owned spec while preserving the exact ProtobufImageSettingswire format.state.pykernel hardening (ignition/components/state.py):_gather_rows,_gather_rows_three,_scatter_rows,_save_hidden, and_request_historydid not cast row/slot/column indices totl.int64, and_scatter_rowschecked(selected >= 0) & (selected < SLOTS).tl.int64across all five Triton kernels. Updatedscatter_rowsto reject writes to reserved null slot0by default (allow_zero=False, withallow_zero=Truefor 0-indexed non-continuation tables such as KV pages) and to accept an optionalmemory_capacityint64device tensor so_scatter_rowsenforces Helios's liveSTATE_ROWSlimit dynamically at replay.tests/components/test_state.py,tests/cli/test_parameters.py,tests/preparation/test_frontend_spec.py):active_progmanifest emission,ImageProcessorSpecvalidation and rejection paths, and CPU/CUDAscatter_rowsnull-slot-0 protection,allow_zero=True, and dynamicmemory_capacity.Claimed benefit and compatibility
state.pyon large continuation pools, preventsscatter_rowsfrom mutating null slot0or dropping writes after Helios dynamically growsSTATE_ROWS, records accurate reproduction commands for external recipe CLIs without introducing plugin discovery, and removes external recipe identifiers from coreignition.ImageSettingsand model core wire formats are unchanged. Python callers ofprepare_frontend/image_settingsmust passimage_spec: ImageProcessorSpec; merge this PR before the companion PRs inlocal-inference-lab/hyperflare-recipesandlocal-inference-lab/hyperflare-jetson-recipes.Supporting evidence and limitations
pytest tests/preparation/test_core_boundary.py tests/preparation/test_frontend_spec.py tests/components/test_state.py tests/components/test_state_gather_fields.py tests/cliwithCUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1on an NVIDIA RTX PRO 6000 Blackwell (SM120): 164 passed, 0 failed, including live CUDA execution of_scatter_rowsdynamicmemory_capacity, null-slot-0 rejection,allow_zero=True, and_gather_rows.ignition export+flare run) and multi-GPU TP tests were not run.Discord: lukealonso