Architecture-and-scope review — PR #581 "ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs"
PR #581 (FujitsuPolycom, CONTRIBUTOR), branch perf/ignition-export-use-node-priority → main, head 61f64f18e06cdcb9de76c33765584a97752f3953 (61f64f1), +137/−7 across 3 files (ignition/preparation/runtime_core.py +38/−1, tests/preparation/test_capture_graph_metadata.py +96/−3, tests/preparation/test_recorded_export_graph_cuda.py +3/−3). Open, ready for review, CHANGES_REQUESTED from voipmonitor (2026-11-28), no CI checks.
Key findings
- Blocking —
USE_NODE_PRIORITYis turned on unconditionally for every exported serving graph by a Python default (runtime_core.py:213). Nothing in Ignition ties this to prepared data; the only in-repo source of node priority is the TP scratch auxiliary stream, and the exported metadata already carries the per-node priority attribute that a data-driven condition could key on. The change also has no served-workload measurement, which the charter requires for a behaviour change of this kind. - Should fix — the new
instantiation_flagsparameter is an extension point with no production caller:None/0exist only in tests, and the docstring's "startup tuning graphs" path does not reachrecord_export_graphat all. - Should fix — the exported flag word changes from 1 to 9 with no core-format/compatibility statement, no load test for pre-existing cores through this path, and the permitted set duplicated in four hardcoded places across Python and Rust.
- Should fix — the advertised "preserve executable-derived flags" behaviour is only demonstrated against a mocked driver query; the one real-CUDA assertion is skipped in the PR's own evidence run.
- Non-findings verified clean: layer placement, no per-model special case, no new captured-graph operation family, old cores still load.
Rules applied (from the repository):
- Charter: "Solve the right problem in the right place"; "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)"; "Be explicit and pin everything. No magic defaults" (charter also lists "No per-model special cases or flags" in its review standard). AGENTS.md§contribution-scope-and-rejection-criteria: "Reject unsupported abstractions and churn. Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement"; "Require focused, meaningful validation. Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness".AGENTS.md§model-core-compatibility: "Every engine version must load models supported by previous engine versions without re-export … Preserve loading and serving compatibility when changing core metadata".docs/design-review.md: principle 1 ("Express differences through cache schemes and prepared layout metadata reusable across models"), principle 12 (performance claims require actual Helios service measurements), principle 13 (core compatibility), principle 16 (four-part description, no claims beyond evidence).
Blocking
B1. Node-priority instantiation is a policy constant applied to every exported core, not prepared data — and it is unmeasured
ignition/preparation/runtime_core.py:208-243
208 def record_export_graph(
209 graph,
210 storage,
211 *,
212 owners=(),
213 instantiation_flags=CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY,
214 ):
...
238 if instantiation_flags is not None:
239 prior_flags = _executable_instantiation_flags(graph)
240 if prior_flags & ~PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS:
241 raise ValueError("captured graph executable carries unsupported CUDA instantiation flags")
242 graph._flare_instantiation_flags = prior_flags | instantiation_flags
with CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY = 8 at :193.
Because the value is the default, the flag applies to every graph that goes through the export path. The only production caller is ignition/preparation/capture.py:192-193:
192 if exporting:
193 graph = record_export_graph(graph, warmup_storage, owners=(function,))
and exporting = retain_graphs and warmup_storage is not None (capture.py:170) covers the entire serving catalog — every graph of every recipe, on TP and single-GPU layouts alike.
Why this is a scope/architecture problem, not a style preference:
- No prepared data justifies the difference. The only in-repo source of non-default priority is
ignition/preparation/scratch.py:83-105(auxiliary_stream,cuStreamCreateWithPriority(..., greatest)), which exists only for overlapped TP scratch plans; searchingignition/forpriorityyields only that stream plus unrelated scheduler/memory-inventory hits (noCU_LAUNCH_ATTRIBUTE_PRIORITY, nocuLaunchKernelEx). So for the large majority of graphs the flag selects a scheduling mode the captured graph never asked for. That is exactly the "magic default" the charter forbids. - The correct trigger is already available as data. heliopause serializes kernel-node attributes including id 8 (
heliopause/src/export/capture.rs:462,:544-569region) and Helios replays them (helios/src/runtime_core/mod.rs:984-1012;format.rs:575accepts id 8). So "enable node priority only when a recorded node actually carries a priority attribute (or capture used a priority stream)" is derivable at export time — the design rule "express differences through prepared layout metadata reusable across models" is satisfiable here, which removes the need for the constant default. - No evidence. The PR states: "Live CUDA export, nondefault kernel-priority instantiation across target drivers, and signed-core
flare runreplay remain open GPU qualification on this revision." The charter's evidence rule requires a served-workload speedup overmainbefore a scheduling-behaviour change lands, and the change alters instantiation flags for every core produced on this branch. voipmonitor's review raises the concrete mechanism (the flag applies to every kernel captured onScratchArena.auxiliary_stream, so heavy compute on the priority stream can preempt main-stream work); my finding is the architectural framing: the default, not a per-graph decision, is what makes that blast radius unavoidable.
Fix: derive the flag from the recorded graph (recorded node priority attribute / capture stream priority) rather than defaulting it on, or bring a measured served-workload flare run comparison on both a TP and a TP1 core before making it unconditional.
Should fix
S1. instantiation_flags is a speculative extension point — its None/0 paths have no production caller
ignition/preparation/runtime_core.py:208-243 (docstring :219-222)
The docstring says: "When instantiation_flags is set, export combines those flags with any permitted flags already carried by the instantiated executable … " and the PR body says "Passing instantiation_flags=None keeps executable-derived flags for startup tuning graphs". Verified call sites of record_export_graph: ignition/preparation/capture.py:18 (import), capture.py:193 (the only production call, no kwarg), tests/preparation/test_capture_rank_readiness.py:61 (not opened) (a local stub), and the tests under tests/preparation/test_capture_graph_metadata.py:206/225/234/240/248/254/317/358/372. Startup tuning graphs are created with capture_graph(retain_graphs=True) and instantiate_graph (capture.py:194-197; fixture tests/preparation/test_recorded_export_graph_cuda.py:62-65), never through record_export_graph. So the None branch exists only to preserve the pre-PR behaviour on a path that no longer calls this function.
Why it matters: AGENTS.md rejects "extension points … and configuration switches without a concrete requirement"; the parameter is precisely where a future per-graph flag special case would be threaded in, and today the export path needs exactly one behaviour. It also produces a docstring claim that misdescribes the code (see N1).
Fix: drop the parameter and its None/0 branching (keep the permitted-flags validation against the executable-derived word), or name the concrete caller that needs it and rewrite the docstring to that one behaviour.
S2. The exported flag word silently changes (1 → 9) with no format/compatibility statement and a duplicated permitted set
ignition/preparation/runtime_core.py:238-242, :282-286; helios/src/runtime_core/format.rs:495; heliopause/src/export/capture.rs:589, :2820-2823
Before this PR the exported graph entry carried executable=<handle> and the flag word was whatever the captured executable reported (in practice AUTO_FREE_ON_LAUNCH = 1; the old assertion in tests/preparation/test_recorded_export_graph_cuda.py was flags == 1). After it, _graphs emits dict(name=…, graph=…, instantiate_flags=9) (:282-286, with a literal flags & ~9 at :284).
- Backward direction is fine: old cores still say 1, and
helios/src/runtime_core/format.rs:495(graph.flags & !9 != 0),heliopause/src/export/capture.rs:589and:2823all accept 9. That satisfies "every engine version must load models supported by previous engine versions". - The other direction is not covered: a core produced on this branch carries 9, so any engine revision whose validator accepted only bit 1 rejects it. Nothing in this PR states the minimum engine revision for cores it writes, and
docs/core-format-design.md(not opened) describes "instantiation flags" only generically — there is no statement of what values export may write. That is a core-metadata semantic change without the corresponding documentation/compatibility statement thatAGENTS.md§model-core-compatibility asks for. - Duplication: the permitted set
{1,8}now appears as the Python tuple (runtime_core.py:194-197), the bare literal~9(:284),!9inhelios/src/runtime_core/format.rs:495, and!9twice inheliopause/src/export/capture.rs:589,:2823. Each place states the same CUDA vocabulary independently.
Fix: name the permitted set once per layer (a Rust constant to match PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS), state in the core-format doc that export may write bits {1,8} and what engine revision that requires, and add a load test for a pre-existing flags=1 core through this path.
S3. The flag-preservation behaviour is asserted only against a mocked driver query
tests/preparation/test_capture_graph_metadata.py:113, :206-242
monkeypatch.setattr(runtime_core, "_executable_instantiation_flags", lambda graph: graph.exec_flags) replaces the one driver call this PR introduces (cuGraphExecGetFlags, runtime_core.py:200-205), and the assertions then check constant arithmetic (1|8 == 9 at :215-218, 0|8 == 8 at :226-229, 1|0 == 1 at :234-235). Under AGENTS.md's validation rule, mocks that bypass the behaviour cannot establish runtime correctness — here the untested part is exactly the claim the PR exists for (that the real executable's flags are preserved and combined).
The only real-driver assertion is tests/preparation/test_recorded_export_graph_cuda.py:85-86 (assert flags_by_name == {"decode": 9, "tune": 1}), inside a test gated by @pytest.mark.skipif(os.environ.get("FLARE_RUN_CUDA_TESTS") != "1", …) (:14) — part of the 15 skipped in the PR's own evidence run.
What would settle it (test-only): a GPU run asserting the pre-PR executable flag word survives for a graph instantiated without auto-free through the real _executable_instantiation_flags, i.e. exercising the actual CUDAGraph rather than the Graph stub. Until then the combination logic on the preserve path is inferred, not shown.
Nits
- N1 — description claims ordering the code does not have.
runtime_core.py:236-242performsgraph.retain_object(...)(:236) andinstantiate_graph(graph)(:237) before_executable_instantiation_flagsand theprior_flagsvalidation (:239-241). The PR body's "rejecting unsupported bits on either source before mutating graph state" is true only for the requested word (:224-229); on an unsupported executable flag, graph state has already been mutated.AGENTS.md§required-pr-descriptions forbids claims not backed by behaviour. (voipmonitor raised the description inaccuracies too.) - N2 — description describes a path that does not exist. "Passing
instantiation_flags=Nonekeeps executable-derived flags for startup tuning graphs" — see S1; no startup tuning graph reachesrecord_export_graph.
Verified non-findings (checked, no defect)
- Layer placement is right. The decision is made on the Ignition/export side and only consumed by Helios (
cuGraphInstantiateWithFlagswithgraph.flagsathelios/src/runtime_core/mod.rs:1215-1220; wire fieldheliopause/src/export/mod.rs:114). No model computation or scheduling policy moves into the runtime, and no Helios change is needed or made — Helios already accepted both bits and already replays kernel-node attribute id 8. - No per-model special case. The change is model-agnostic: no recipe identity, allowlist, or per-family branch, consistent with the charter's "keep the runtime small and model-agnostic".
- No new captured-graph operation family, so no new op-contract approval is implicated.
- Forward compatibility of existing artifacts holds in the load direction (old cores with flags=1 are still accepted everywhere; see S2 for the uncovered direction).
Open questions / could not settle from the code
- Whether node priority actually helps on the served workload — needs the GPU/served-workload measurement the PR defers; no number exists in the PR or the repo.
- Whether a priority-stream-only trigger matches intent for non-TP layouts: I can show the auxiliary priority stream is TP-overlap-only (
scratch.py:83-105) but not that every such graph needs the flag, and not that no other capture path (e.g.ignition/preparation/execution.pywarm streams) would want it — a design call for the author. - voipmonitor's separate
keep_graph=False/_flare_graph_metadatavalidation point is outside this lens; I did not verify or repeat it.