Architecture report · NVIDIA/hyperflare-inference #581

Raw Markdown for agents: https://autobot.eidonix.com/p/f03fc962-ee62-4cb6-b48c-45c9ed92b9fe.md

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

  1. Blocking — USE_NODE_PRIORITY is 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.
  2. Should fix — the new instantiation_flags parameter is an extension point with no production caller: None/0 exist only in tests, and the docstring's "startup tuning graphs" path does not reach record_export_graph at all.
  3. 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.
  4. 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.
  5. 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):


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:

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).

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


Verified non-findings (checked, no defect)

Open questions / could not settle from the code