Recommendation: Changes Requested
The prog propagation and the five state.py Triton tl.int64 / dynamic memory_capacity / null-slot-0 kernel hardenings are technically sound, clean, and directly aligned with the core/recipe boundary. However, ignition/preparation/frontend.py regresses core Helios wire-contract validation on qwen and deepseek_row_major (allowing invalid payloads through full export to fail only at flare run), exposes a narrow extract(image, model) signature that cannot absorb in-flight PR #483 (gemma4) without another core edit, and scatter_rows has a minor CPU/CUDA validation mismatch plus an undocumented silent default change for 0-indexed external callers.
Merge Risk
Level: Medium
- Late validation failure on malformed image specs:
_validate_image_payload(ignition/preparation/frontend.py:161-183) dropsmain's Helios-required bounds (position_side == 48forqwen;4 <= max_tokens <= 1024andmin_pixels <= 64 MiBfordeepseek_row_major), shifting a cheap preparation check into a post-export core-load rejection in Helios. - Coordinated external-repo break (loud + silent): Removing
image_profile=/qwen_model_type=fails loudly withTypeErrorin external recipe repos as documented, whereas changingscatter_rowsto defaultallow_zero=False(ignition/components/state.py:165, 187, 200) silently drops row-0 stores for any un-updated external 0-indexed caller (such as KV page tables) without raising an error. - No runtime hot-path or wire-format regression:
reproduction_argsis wire-compatible with Helios (helios/src/runtime_core/preparation.rs:105-113) andflare inspect(flare-cli/src/inspect.rs:453-472), and thestate.pychanges add no locks, allocations, or host syncs on the CUDA path (one persistent device-scalar load per_scatter_rowsprogram).
Walkthrough
- CLI
progpropagation (ignition/registry.py:27-29, 37-39, 52-61,ignition/cli/__init__.py:364-372,ignition/preparation/rebuild_manifest.py:231, 262-263, 288, 333-336): Adds_ACTIVE_PROGContextVar(default"ignition"),current_prog(), andactive_prog(prog)mirroringactive_recipesandsource_roots, bindsactive_prog(prog)inignition.cli.main, and emits[program, 'export', ...]inreproduction_arguments/from_planwith an optionalprog=override. - Recipe-owned
ImageProcessorSpec(ignition/preparation/frontend.py:26-68, 138-244, 263-296): Replaces the hardcoded checkpoint/token-ID table (inkling2,glm5_next,qwen4_exp,mimo_v2, etc.) with frozen dataclassImageProcessorSpec,prepare_frontend(..., image_spec=...), and core Helios wire-payload validator_validate_image_payloadcovering the 8IMAGE_PROFILES(padded_grid,glm,radio,moonvit,deepseek_row_major,deepseek4,qwen,mimo). - Triton
state.pykernel hardening (ignition/components/state.py:110-261): Casts row, slot, command, and column indices totl.int64in_gather_rows,_gather_rows_three,_scatter_rows,_save_hidden, and_request_history; extendsscatter_rowswithmemory_capacity=None(read dynamically from device memory viaHAS_CAPACITY) andallow_zero=False(protecting reserved null slot0by default). - Tests (
tests/cli/test_parameters.py:362-368,tests/components/test_state.py:90-152,tests/preparation/test_frontend_spec.py:1-105): Adds unit coverage foractive_progmanifest emission,ImageProcessorSpecvalidation/rejection anddefault_preprocessor, and CPU + gated CUDA tests forscatter_rowsnull-slot protection,allow_zero=True, and livememory_capacitygrowth without recompilation.
Pre-merge Checks
- [PASS] Security / malicious screen: No suspicious code, external exfiltration, or prompt-injection content; standard CLI, preparation, and Triton kernel changes.
- [PASS] Charter & value fit: Removes per-checkpoint
model_typestrings and literal token IDs from coreignitionwhile keeping Helios ABI wire validation in core; no plugin discovery added and core components remain at the 12 Helios-ABI modules (tests/preparation/test_core_boundary.py:11-25). - [WARN] Related / duplicate / conflict check: Conflicts textually with open PRs #483 (
gemma4) and #229 (muse_glimmer) inignition/preparation/frontend.py, and #483 additionally requiressnapshot/tokenizer_configaccess thatImageProcessorSpec.extractdoes not yet provide; complements open PR #659 (null row 0 VMM aliasing). - [WARN] Tests & verification evidence: Author reports 164 passed (0 failed) including
FLARE_RUN_CUDA_TESTS=1on SM120, with unrun checks honestly disclosed (no Rust files touched; full export+serve and multi-GPU TP not run). New tests are well-isolated and exercise real production functions, thoughtests/test_compilation.py(not opened) (callsgather_rows) andrequires_preprocessor=False/_EMPTY_IMAGE_PROFILESrejection paths are untested.
Blockers
None.
Should Fix
- Enforce Helios's wire-level image payload bounds in
_validate_image_payload(ignition/preparation/frontend.py:142-203).- Verified behavior/impact: On
main,image_settingsguaranteedposition_side == 48forqwen(mainfrontend.py:181) andmin_pixels == 295936,max_tokens == 1024fordeepseek_row_major(mainfrontend.py:153-155). In this PR,_validate_positive_intaccepts any positive Pythonint(including values exceeding Protobufuint32/uint64range), while Helios hard-rejectsposition_side != 48andimage_token_id == video_token_idinhelios/src/frontend/images/qwen.rs:19-26(withuint32 position_sideathelios/proto/runtime_core.proto:645) and rejects!(4..=1024).contains(&max_tokens)ormin_pixels > 64 * 1024 * 1024inhelios/src/frontend/images/deepseek_row_major.rs:13-21. A misconfigured recipe spec therefore passes preparation and full GPU export, failing only whenflare runloads the core. - Fix: Validate in
_validate_image_payload:deepseek_row_major:1 <= min_pixels <= 64 * 1024 * 1024and4 <= max_tokens <= 1024.qwen:position_side == 48,image_token_id != video_token_id, andmax_pixels < 2**64(sameuint64bound onmimomax_pixels).- Add unit tests in
tests/preparation/test_frontend_spec.pycovering each rejection.
- Verified behavior/impact: On
- Expose snapshot/tokenizer context to
ImageProcessorSpec.extractso displaced profile PRs don't require another core edit (ignition/preparation/frontend.py:57, 205, 242, 277-295).- Verified behavior/impact:
prepare_frontendalready hassnapshotand parsestokenizer_config.json(not opened) (frontend.py:277), yetimage_settingscallsspec.extract(image, model)with only the processor sub-dict andconfig.json(not opened). Open PR #483 (gemma4,pr/483ignition/preparation/frontend.py:142-167) validates image envelope tokens (image_token,boi_token,eoi_token) againsttokenizer_config.json(not opened) andsnapshot / "tokenizer.json (not opened)". Landingextractwith a 2-argument signature forces an immediate breaking change toImageProcessorSpecwhen #483 rebases. - Fix: Either pass an optional context object/kwargs (e.g.,
snapshotandtokenizer_config) intoimage_settings/spec.extract, or settle the signature explicitly before companion recipe PRs adoptImageProcessorSpec.
- Verified behavior/impact:
- Fix
scatter_rowsCPU/CUDAmemory_capacityrank validation mismatch and document the silentallow_zero=Falsecompatibility impact (ignition/components/state.py:175-189).- Verified behavior/impact: Line 176 accepts any tensor with
memory_capacity.ndim >= 1(e.g., shape(1, 2)), which works on CUDA (tl.load(MemoryCapacity)reads element 0) but crashes on CPU at line 186 (int(memory_capacity[0].item())raisesRuntimeError: a Tensor with 2 elements cannot be converted to Scalar). Additionally, changingscatter_rows's default toallow_zero=Falsesilently drops row-0 writes for any un-updated external 0-indexed caller (unlikeprepare_frontend, which raisesTypeError); the PR's Compatibility & merge-order paragraph only warns aboutprepare_frontend/image_settings. - Fix: Require
memory_capacity.ndim == 1atignition/components/state.py:176(matchingStateStorage.allocate's 1-D[backed_slots, 0]buffer at:89, or index viamemory_capacity.reshape(-1)[0].item()), and explicitly note in the PR Compatibility section that external 0-indexedscatter_rowscallers (e.g. KV page tables) must passallow_zero=Truein the companion recipe PRs.
- Verified behavior/impact: Line 176 accepts any tensor with
Subtract / Simplify
- Collapse
requires_preprocessor+default_preprocessorinto one knob (ignition/preparation/frontend.py:55-56, 290-294).requires_preprocessor: bool = Trueanddefault_preprocessor: str = "preprocessor_config.json (not opened)"split one decision ("which snapshot file to read, or none") across two fields, allowing contradictory states (e.g.,requires_preprocessor=Falsewith a custom filename). Replacing both withdefault_preprocessor: str | None = "preprocessor_config.json (not opened)"(whereNoneskips reading a file and uses{}whenpreprocessor is None) simplifies the spec and theif/elseatfrontend.py:290-294.
- Table-drive
_validate_image_payloadand remove_EMPTY_IMAGE_PROFILES(ignition/preparation/frontend.py:37, 154-202).- The three non-empty branches repeat identical
expected_keys/set(payload) != expected_keysboilerplate alongside a separate_EMPTY_IMAGE_PROFILESfrozenset (:37). A small profile→field-validator table (with absent profiles defaulting to{}) eliminates_EMPTY_IMAGE_PROFILESand makes adding the Helios bounds from Should Fix #1 and future profiles concise. (Also consider whether all 9 declarativeImageProcessorSpecvalidation fields at:46-54are strictly needed by the companion recipe PRs or whether a smaller core spec + shared_expectedhelper would be cleaner.)
- The three non-empty branches repeat identical
Nits
ignition/preparation/rebuild_manifest.py:262: When a caller passes an explicitprog=override, it bypasses the nonempty-string validation performed byactive_prog()(ignition/registry.py:55-56); validatingprogin one helper keeps both paths identical.tests/preparation/test_frontend_spec.py:93:assert {"padded_grid", ..., "mimo"} == IMAGE_PROFILESmirrors a module constant rather than testing behavior; replace with behavioral tests for_EMPTY_IMAGE_PROFILESrejecting non-empty payloads anddefault_preprocessor=None(orrequires_preprocessor=False).tests/cli/test_parameters.py:365-368: Adding a brief test callingmain(..., prog="ignition-jetson")through a stubbed handler (mirroringtests/cli/test_recipe_injection.py:78-98) would cover the fullmain -> active_prog -> current_progwiring end to end.
Dropped on verification
- Upstream Blocker 1.1 ("int64 hardening is unreachable because CUDA
gridDim.ycaps rows at 64 MiB"): False.StateStorage.region(name)(ignition/components/state.py:91-94, verified bytests/components/test_state.py:21) returns a strided view of a single region whoseshape[1](WIDTH) is just that region's element count (e.g.,1forconsumed_tokens,4096forhidden, or one layer's conv/recurrent state), whilestride(0)equalslayout.row_bytes // element_size(the full 115–215 MiB continuation row). ThusgridDim.y = cdiv(WIDTH, 1024)is small (often1), the kernel launches cleanly, andselected * stride(0)genuinely overflows signedint32at ~10–39 slots without thetl.int64casts.docs/TODO.txt:366-367tracks a separate ceiling for single>64 MiBuint8row transfers. - Upstream Correctness 1.3 ("
progshould be threaded viagetattr(args, 'prog', None)atserve.py:237, 338") & Subtraction S3 ("deleteprog=keyword"): False / conflicting.argsfromparse_argshas no.progattribute, bothfrom_plancall sites inignition/cli/serve.py:237, 338run synchronously on the main CLI thread insideignition.cli.main'swith active_prog(prog):block (ignition/cli/__init__.py:370), and offering an optionalprog=Nonekeyword override alongside theContextVarmatches the existing pattern ofresolve(..., recipes=None)(ignition/registry.py:253) andsource_identity(*, extra_roots=())(ignition/preparation/source_identity.py:28). - Upstream Correctness 3.1 ("'12 Helios-ABI modules' is inaccurate because
RETAINED_IGNITION_COMPONENTShas 13 entries"): False / nitpick.tests/preparation/test_core_boundary.py:11-25lists 12 component modules plus package__init__(13 files total); describing that as "keeps coreignitionstrictly at the 12 Helios-ABI modules" is accurate. - Upstream Discovery #2 / Correctness 3.2 ("'move image specs to recipes' is incomplete because
IMAGE_PROFILESand_validate_image_payloadstay in core"): Over-flagged. The 8 profile names inIMAGE_PROFILESare Helios's own ProtobufImageSettings.profileoneof wire tags (helios/proto/runtime_core.proto:613-626), and the PR description explicitly states that core HeliosImageSettingswire-payload validation stays in core while per-checkpoint recipe identifiers (model_type, processor class names, literal token IDs) move to recipes. - Upstream Correctness 3.2 claim that
#229(muse_glimmer) also openstokenizer.json(not opened)/tokenizer_config.json(not opened): False. Verified onpr/229(ignition/preparation/frontend.py:151-166):muse_glimmeronly inspectsconfig,image_processor,model, andvision_configand emits literal envelope strings; only#483(gemma4,pr/483frontend.py:142-167) openstokenizer.json(not opened) andtokenizer_config.json(not opened). - Upstream Discovery #6 / Correctness 3.3 ("
requires_preprocessoris an undisclosed new capability"): Over-flagged. Onmain(ignition/preparation/frontend.py:248),prepare_frontendhardcoded{} if image_profile == "deepseek_row_major" else json.loads(path.read_text());requires_preprocessor=Falsereplaces that hardcoded profile branch (still simplifiable per Subtract #1). - Upstream Subtraction S1 claim ("the 9 declarative knobs have zero users"): Over-stated. All model recipes live in the external
hyperflare-recipesandhyperflare-jetson-recipesrepos named in the PR description, and the 9 fields map directly to the 8 extracted recipes deleted frommainfrontend.py:98-203; kept only as a brief consideration under Subtract #2. - Upstream Principle 14 authorship alarm & "zero CI checks on
70e84eba": Dropped as unverified/speculative. The author is project owner@lukealonso, there is no indication of restricted-model Triton authorship, and GitHub Actions check-run status is not directly inspectable with available tools.