Architecture scratchpad · NVIDIA/hyperflare-inference #581

Raw Markdown for agents: https://autobot.eidonix.com/p/3f0fa89c-f9e6-47fc-a83b-fb598ea9dcf7.md

#1 [high] Blocking: unconditional USE_NODE_PRIORITY default is a policy constant, not prepared data, and is unmeasured

ignition/preparation/runtime_core.py:192-243. record_export_graph now has instantiation_flags=CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY as its default, so every exported serving graph (only production caller: ignition/preparation/capture.py:193, record_export_graph(graph, warmup_storage, owners=(function,)), used for the whole serving catalog under exporting = retain_graphs and warmup_storage is not None) is instantiated by Helios with flag 8 — TP and single-GPU, priority streams and not.

Why it matters:

Fix: derive the flag from the recorded graph (set USE_NODE_PRIORITY only when a captured node carries a priority attribute, or when capture actually used a priority stream), or bring a measured served-workload comparison for flare run on both TP and TP1 cores before making it the default.

#2 [high] Should fix: instantiation_flags parameter has no production caller (speculative optional path)

ignition/preparation/runtime_core.py:208-243 and docstring :219-222.

instantiation_flags is a new optional parameter whose None and 0 branches have no caller. Verified call sites of record_export_graph: ignition/preparation/capture.py:18 (import), :193 (only call, no kwarg), plus tests. Startup tuning graphs are built with capture_graph(retain_graphs=True) + instantiate_graph (capture.py:171, 194-197; runtime_core.py:246-269; test fixture tests/preparation/test_recorded_export_graph_cuda.py:62-65 uses capture_graph then instantiate_graph). So the docstring claim "Passing instantiation_flags=None keeps executable-derived flags for startup tuning graphs" describes a path that does not exist: tuning graphs never reach record_export_graph.

Why it matters: AGENTS.md / docs/design-review.md reject "speculative compatibility, fallback layers, or configuration switches without a concrete requirement" and "Do not present scaffolding or partially wired features as supported". The parameter is also the mechanism by which a per-graph special case could creep in later; the export path today needs exactly one behavior.

Fix: drop the parameter and the None/0 validation branches (keep the permitted-flags validation on the executable-derived word), or state the concrete caller that needs it. If kept, correct the docstring to name the real behavior only.

#7 [high] Research summary

Reviewed PR #581 through the architecture-and-scope lens: read the charter, AGENTS.md, docs/design-review.md, every changed file in full context (runtime_core.py, capture.py, both tests) and the consumers on the Rust side (heliopause capture.rs/export mod.rs, helios format.rs and mod.rs), plus the only in-repo source of node priority (scratch.py auxiliary_stream).

Confirmed findings recorded in the scratchpad:

  1. Blocking — instantiation_flags defaults to USE_NODE_PRIORITY for every exported serving graph, so the flag turns on node-priority instantiation for graphs whose capture never asked for priority (nothing in ignition sets a priority kernel-node attribute; only the TP auxiliary stream has one). The design rules require differences to follow prepared data and forbid magic defaults, and the PR has no served-workload measurement, which the charter requires for scheduling-behaviour changes.
  2. Should fix — the new instantiation_flags parameter's None/0 branches have no production caller (startup tuning graphs never call record_export_graph), so the parameter and its docstring claim are scaffolding for a path that does not exist.
  3. Should fix — the change silently rewrites the exported flag word (1 → 9) without a core-format/compatibility statement, without a test that existing flag-1 cores still load through this path, and with the permitted set {1,8} now hardcoded in four places across Python and Rust.
  4. Should fix — the flag-preservation behaviour is asserted only through a monkeypatched _executable_instantiation_flags lambda in CPU tests; the single real-driver assertion is GPU-gated and was skipped in the PR's own evidence run.

Non-findings I verified and cleared: layer placement (Ignition decides, Helios only consumes), no per-model branch, no new captured-graph operation family, and old cores remain loadable (the backward direction of requirement 13 holds; only new-core-on-old-engine is uncovered). PR-description inaccuracies are noted as nits since another reviewer already raised them.

#8 [high] PR context and overlap with the existing review

PR #581 "ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs", author FujitsuPolycom (CONTRIBUTOR), branch perf/ignition-export-use-node-priority into main, head 61f64f18e06cdcb9de76c33765584a97752f3953 (61f64f1), +137/−7 across 3 files, no labels, no CI checks. Opened 2026-11-28, i.e. today relative to the review date. State: open, ready for review, with CHANGES_REQUESTED from voipmonitor (2026-11-28 22:13).

Overlap with voipmonitor's posted review (so the report does not present duplicates as new):

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

#9 [high] Exact changed code and line anchors for the report

ignition/preparation/runtime_core.py at head 61f64f1:

Main-branch baseline (for the before/after): runtime_core.py at main has def record_export_graph(graph, storage, *, owners=()) with no flags parameter (:192-206), and _graphs at :245-255 emits executable=<raw_cuda_graph_exec()> — i.e. the flag word was previously derived from the executable only.

Test anchors: tests/preparation/test_capture_graph_metadata.py:117 monkeypatches runtime_core._executable_instantiation_flags to lambda graph: graph.exec_flags; :204-254 extend the export test; :261-302 new test_capture_forwards_export_sets_node_priority_instantiation_flag. tests/preparation/test_recorded_export_graph_cuda.py:85-87 changed the GPU assertion to flags_by_name == {"decode": 9, "tune": 1} (was index.ranks[0].graphs[0].flags == 1).

#3 [medium] Should fix: core-format compatibility statement and single source of truth for permitted flags

ignition/preparation/runtime_core.py:238-242 (also :282-287 in _graphs, and helios/src/runtime_core/format.rs:495 graph.flags & !9 != 0).

The PR silently widens the accepted flag vocabulary of the exported core format from "executable-derived flags observed on the captured executable" (previously only AUTO_FREE_ON_LAUNCH, bit 1 — see tests/preparation/test_recorded_export_graph_cuda.py old assert flags == 1) to bits {1, 8}. Bit 8 is now emitted instead of the previously derived value, so a core exported by this branch carries flags=9 where the same graph previously carried flags=1.

Consequences to check against the compatibility rule ("Every engine version must load models supported by previous engine versions ...", AGENTS.md#model-core-compatibility, principle 13):

Fix: name the permitted set once per layer (constant in Rust too), state the new written value and its required engine revision in the core format/design doc, and add/extend a compatibility check (existing core with flags=1 still loads and replays; new core with 9 loads on this engine).

#4 [medium] Should fix: the flag-preservation claim is verified only by a mocked query, not the real driver call

tests/preparation/test_capture_graph_metadata.py:117 (monkeypatch.setattr(runtime_core, "_executable_instantiation_flags", lambda graph: graph.exec_flags)), tests/preparation/test_capture_graph_metadata.py:261-302 (test_capture_forwards_export_sets_node_priority_instantiation_flag).

The behavior this PR adds is one driver query (cuGraphExecGetFlags) whose result is combined with a constant. The CPU tests replace the query with a lambda and assert 1 | 8 == 9; that asserts arithmetic on constants, not that the export path reads the real executable's flags. AGENTS.md: "Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness." The only test that exercises the real call is tests/preparation/test_recorded_export_graph_cuda.py:86 assert flags_by_name == {"decode": 9, "tune": 1}, which is skipif FLARE_RUN_CUDA_TESTS != 1 — skipped in the PR's own evidence run (46 passed, 15 skipped). Prior reviewer reported it passing on an SM120, which is useful, but the PR description does not claim it and the CI has no checks.

What would settle it: a GPU test asserting the pre-existing executable flag word is preserved for a graph instantiated without AUTO_FREE (the real _executable_instantiation_flags path) — i.e. run the check against a real CUDAGraph rather than the Graph stub.

#6 [medium] Rules cited and files read

Rules cited in this review:

Changed files read in context: ignition/preparation/runtime_core.py (whole file), ignition/preparation/capture.py (whole file), tests/preparation/test_capture_graph_metadata.py (diff + surrounding), tests/preparation/test_recorded_export_graph_cuda.py (whole file), plus consumers: heliopause/src/export/capture.rs (executable_flags :517, record_graph :582, graph_metadata :760, validation :2820), heliopause/src/export/mod.rs:106-117 (GraphHandle), helios/src/runtime_core/format.rs:495/575, helios/src/runtime_core/mod.rs:984-1012 and :1215-1220, ignition/preparation/scratch.py:83-105, ignition/preparation/execution.py:254-322.

#5 [low] Verified non-findings and scope checks that pass

Verified non-findings (checked, not defects):

Prose/description issues worth listing as nits (not in my lens's blocking set, kept brief because voipmonitor already raised them):