Skip to content

ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs - #581

Merged
lukealonso merged 1 commit into
NVIDIA:mainfrom
FujitsuPolycom:perf/ignition-export-use-node-priority
Nov 29, 2026
Merged

lukealonso merged 1 commit into
NVIDIA:mainfrom
FujitsuPolycom:perf/ignition-export-use-node-priority

Conversation

@FujitsuPolycom

@FujitsuPolycom FujitsuPolycom commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

Exported serving graphs that capture overlapped work on higher-priority CUDA streams such as ScratchArena.auxiliary_stream record per-kernel CU_LAUNCH_ATTRIBUTE_PRIORITY attributes, but CUDA ignores kernel-node priorities during replay unless the graph executable is instantiated with CU_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY (8). Recording USE_NODE_PRIORITY alongside permitted flags already present on the captured executable (CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH, 1 -> 9) enables Helios to honor captured stream priorities during cuGraphInstantiateWithFlags. Requesting explicit instantiation flags also requires a retained CUDA graph template (keep_graph=True without post-instantiation release metadata) so export rejects missing or released templates up front instead of passing a zero template handle to Heliopause.

What

  • Preparation graph recording (ignition/preparation/runtime_core.py):
    • Before: record_export_graph retained owners and instantiated the graph without serializing USE_NODE_PRIORITY, so exported serving graphs recorded only executable-derived flags (1).
    • After: record_export_graph defaults instantiation_flags to CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY (8). When instantiation_flags is not None, it validates the bitmask against PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS (9, bits 1 and 8), rejects graphs carrying _flare_graph_metadata or a released/zero raw_cuda_graph() handle, and checks pool ownership before calling retain_object or instantiate_graph. After instantiation, it clears any pre-existing _flare_instantiation_flags attribute, queries cuGraphExecGetFlags through a lazily cached _Cuda driver wrapper, rejects unsupported executable flags, and records prior_flags | instantiation_flags. Passing instantiation_flags=None clears any prior _flare_instantiation_flags override so export falls back to executable-derived or recorded graph metadata. _graphs reuses PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS and rejects zero raw_cuda_graph() handles whenever _flare_instantiation_flags is set.
  • Helios validation and end-to-end CUDA/CUPTI coverage (helios/src/runtime_core/, helios/tests/node_priority_core_fixture.py, tests/preparation/):
    • Helios runtime loading already validates flags & !9 == 0 and forwards serialized flags to cuGraphInstantiateWithFlags. Add a Rust validation unit test (format.rs), Python CPU unit tests covering template-retention guards, pre-mutation rejection, stale-flag clearing, _Cuda caching, and zero-template rejection, and a signed-core CUDA fixture plus Helios NativeResources::load + ReplayWorker test verifying via CUPTI that cuGraphInstantiateWithFlags receives 9 on the serving graph (decode) and 1 on the startup tuning graph (tune), alongside 0-ULP bit-exact main- and auxiliary-stream replay.
  • Compatibility: Existing signed cores keep their recorded graph flags (1) and continue to load and serve without re-export or re-signing. Startup tuning graphs continue to call capture_graph and instantiate_graph directly (flags = 1).

Result

Newly exported serving graphs instantiate with USE_NODE_PRIORITY (8, combined with AUTO_FREE_ON_LAUNCH -> 9) while startup tuning graphs retain flags = 1 and previously signed cores remain loadable without changes.

In paired ABAB multi-GPU flare run serving qualification by @voipmonitor (review) on 4x NVIDIA RTX PRO 6000 Blackwell (SM120) serving DeepSeek-V4.1-Flash TP4 (flags = 1 vs flags = 9 across 135/135 graphs, 91/135 graphs containing 43,290 priority = -5 auxiliary-stream kernels):

  • Stability and accuracy: 0 errors, 0 hangs, 0 CUDA faults; identical VRAM (79.47 GiB weights/rank, 59.8 GiB KV); greedy 4/4 PASS, vision 16/16 PASS, cold NIAH (8K-128K) 16/16 PASS.
  • Cold prefill (8K-128K): flat parity within -0.30% to +0.23% (64K: 59.9k -> 59.9k, 128K: 59.4k -> 59.4k).
  • Decode GPU step latency (mean across paired ABAB):
    • C=1: 5.719 -> 5.631 ms (-1.54%)
    • C=4 @ P=256: 7.247 -> 7.125 ms (-1.68%; B4xW8: 7.68 -> 7.29 ms, -5.08%)
    • C=8 @ P=256: 8.683 -> 8.721 ms (+0.44%; B8xW8: 9.31 -> 9.08 ms, -2.47%)
    • C=16 @ P=256: 10.482 -> 10.464 ms (-0.17%; B16xW8: 15.24 -> 14.42 ms, -5.38%)
    • C=32 @ P=256: 13.172 -> 13.009 ms (-1.24%)
    • C=32 @ P=2048: 13.268 -> 13.071 ms (-1.48%, 1,232.0 -> 1,232.8 tok/s)

That multi-GPU A/B was collected on the equivalent flags = 9 core manifest produced by commit 7fc5993b; recipes other than DeepSeek-V4.1-Flash and architectures other than SM120 were outside that serving A/B scope.

Evidence

Verified on a clean git archive extraction of commit 4270e9046dab222981d8d8bcc80cbcb1a2843bda (rebased onto origin/main 9a054b49) on WSL2 Linux with 1x NVIDIA GeForce RTX 5090 (SM120) and freshly built flare_heliopause:

  • ruff==0.12.8 check on the 5 touched Python files: passed.
  • cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::: 186 passed, 0 failed, 11 ignored.
  • pytest -v -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py: 57 passed, 14 skipped (CUDA-gated tests in test_runtime_core.py), 0 failed.
  • FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py: 2 passed, 0 skipped, 0 failed — verifying flags_by_name == {"decode": 9, "tune": 1}, negative auxiliary-stream (< 0) and main-stream (0) serialized kernel priorities, CUPTI-observed cuGraphInstantiateWithFlags flags 9 on "decode" and 1 on "tune", retained cuGraphExecGetFlags == 1, and bit-exact ReplayWorker main- and auxiliary-stream outputs.
  • Limitations: Single-GPU SM120 runtime-core export, CUPTI instantiation-flag verification, and ReplayWorker replay ran directly on 4270e9046dab222981d8d8bcc80cbcb1a2843bda; multi-GPU flare run serving A/B was performed by @voipmonitor on DeepSeek-V4.1-Flash TP4 (SM120) using the equivalent flags = 9 manifest at 7fc5993b, leaving other recipes and SM103/SM121 serving A/B outside the measured scope.

Discord: Dooner

@voipmonitor voipmonitor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review & Live SM120 CUDA Test Report (commit 61f64f18)

Verdict: Request changes — end-to-end Heliopause/Helios wiring is already in place (flags & !9 == 0, kernel-node attribute id = 8 CU_LAUNCH_ATTRIBUTE_PRIORITY, forward- and backward-compatible with existing cores) and the live SM120 CUDA export test passes, but two items need attention before merge.

Automated & Live SM120 CUDA Test Results

  • CPU pytest -q tests/preparation/test_capture_graph_metadata.py — 12 passed, 0 failed.
  • Live SM120 CUDA FLARE_RUN_CUDA_TESTS=1 pytest -q tests/preparation/test_recorded_export_graph_cuda.py — 1 passed (3.29s), confirming real cuGraphExecGetFlags Driver API FFI and flags_by_name == {"decode": 9, "tune": 1}.

Findings

  1. [Major] Qualify live exported-core flare run behavior (docs/design-review.md Principle 12):
    Enabling CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY globally activates CTA-level preemption for every kernel captured on ScratchArena.auxiliary_stream (ignition/preparation/scratch.py:83-105) across all recipes. That is desirable for small TP collectives, but any recipe launching heavy compute on auxiliary_stream could see scheduling regressions. Please verify with an end-to-end exported TP core served via flare run (and ideally add a Helios load+replay check asserting cuGraphExecGetFlags == 9 on the Helios-instantiated executable).
  2. [Major] record_export_graph does not validate keep_graph=False / _flare_graph_metadata graphs (ignition/preparation/runtime_core.py:208-242):
    record_export_graph calls instantiate_graph(graph) (which supports _flare_graph_metadata / keep_graph=False) and then unconditionally sets graph._flare_instantiation_flags = prior_flags | instantiation_flags. If a caller passes a keep_graph=False graph, record_export_graph succeeds and fails later in _graphs() / Heliopause (graph=0). When instantiation_flags is not None, validate up front that getattr(graph, "_flare_graph_metadata", None) is None and int(graph.raw_cuda_graph()) != 0. Also consider clearing any pre-existing _flare_instantiation_flags when instantiation_flags=None.
  3. [Minor] PR description inaccuracies (Principle 16):
    • States "rejecting unsupported bits on either source before mutating graph state" — for prior_flags, graph.retain_object(...) and instantiate_graph(graph) have already run before _executable_instantiation_flags(graph) is checked.
    • States "Passing instantiation_flags=None keeps executable-derived flags for startup tuning graphs" — startup tuning graphs do not call record_export_graph at all (they call capture_graph + instantiate_graph).
  4. [Nit] Reuse PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS in _graphs() (runtime_core.py:279) instead of hardcoding flags & ~9, and lazily cache _Cuda() instead of reopening libcuda.so.1 per graph.

@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 581.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 61f64f1 to 18312bd Compare November 29, 2026 00:12
@FujitsuPolycom

Copy link
Copy Markdown
Contributor Author

@voipmonitor Addressed at 18312bd04a34df8750637b8500b17e1eca50984a (rebased onto main ba3afb13a7e9836080c23eadf8e1c17ee96e6e7a). The PR description has also been updated so the validation order, instantiation_flags=None semantics, SM120 runtime-core proof, and remaining multi-GPU qualification limits stand on their own.

  1. [Major] Qualify Helios runtime load + replay with USE_NODE_PRIORITY (helios/tests/node_priority_core_fixture.py, helios/src/runtime_core/node_priority_tests.rs, tests/preparation/test_recorded_export_graph_cuda.py):

    • Fix: Added an end-to-end signed-core fixture and Helios NativeResources::load + ReplayWorker GPU test (exported_node_priority_core_instantiates_and_replays_in_helios). The fixture captures "decode" via capture_forwards -> record_export_graph with both a main-stream branch (priority = 0) and a ScratchArena(device=0, overlap=True).auxiliary_stream branch (priority < 0) alongside a "tune" TuningGraph (capture_graph + instantiate_graph, flags = 1), and publishes a signed payload core via export_model. Note on cuGraphExecGetFlags: on the live SM120 CUDA 13 driver, cuGraphInstantiateWithFlags(exec, graph, 9) consumes CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY (8) during instantiation and cuGraphExecGetFlags(exec) returns 1 (AUTO_FREE_ON_LAUNCH only; instantiating with flags = 8 alone returns 0). Accordingly, node_priority_tests.rs subscribes CUPTI (cuGraphInstantiateWithFlags exit callback) around NativeResources::load to assert that Helios passes flags == 9 on "decode" and flags == 1 on "tune" for the exact owner.executables handles, verifies decoded CU_LAUNCH_ATTRIBUTE_PRIORITY (id = 8) kernel attributes (< 0 and 0), asserts cuGraphExecGetFlags == 1 on both live CUgraphExec handles, and verifies 0-ULP bit-exact ReplayWorker outputs across poisoned-output replays.
    • Verification (18312bd0): FLARE_RUN_CUDA_TESTS=1 python -m pytest -q -rs tests/preparation/test_recorded_export_graph_cuda.py on 1x NVIDIA GeForce RTX 5090 (SM120) -> 2 passed, 0 skipped, 0 failed; cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core -> 182 passed, 11 ignored, 0 failed.
    • Remaining limit: Single-GPU (1x NVIDIA GeForce RTX 5090, SM120) runtime-core export, instantiation, and replay are verified on this commit; multi-GPU tensor-parallel flare run serving and per-recipe ScratchArena.auxiliary_stream CTA-preemption scheduling qualification remain open hardware qualification and are disclosed explicitly in the PR body.
  2. [Major] Validate keep_graph=False / _flare_graph_metadata / raw_cuda_graph() == 0 up front and clear stale _flare_instantiation_flags (ignition/preparation/runtime_core.py:213-266):

    • Fix: When instantiation_flags is not None, record_export_graph now validates requested instantiation_flags bits, getattr(graph, "_flare_graph_metadata", None) is None, and int(graph.raw_cuda_graph()) != 0 (catching released-template RuntimeError as ValueError) before retain_object or instantiate_graph. After instantiation, any pre-existing _flare_instantiation_flags attribute is cleared via delattr, so instantiation_flags=None (or a subsequent failed prior_flags check) never leaves stale _flare_instantiation_flags behind. _graphs() also rejects zero raw_cuda_graph() handles when _flare_instantiation_flags is set.
    • Verification (18312bd0): python -m pytest -q -rs tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py -> 34 passed, 14 skipped, 0 failed, covering _flare_graph_metadata rejection, keep_graph=False released-template rejection, raw_cuda_graph() == 0 rejection without mutating _retained.objects or instantiations, and clearing stale _flare_instantiation_flags when instantiation_flags=None.
    • Remaining limit: None within the declared contract.
  3. [Minor] PR description inaccuracies (Principle 16):

    • Fix: Rewrote both passages in the commit message and PR body to state the exact validation sequence (requested instantiation_flags, template retention, and pool ownership checked before retain_object/instantiate_graph; prior_flags inspected via cuGraphExecGetFlags after instantiation before setting _flare_instantiation_flags) and to explain accurately that instantiation_flags=None clears prior _flare_instantiation_flags overrides on record_export_graph callers, whereas startup tuning graphs call capture_graph + instantiate_graph directly without calling record_export_graph.
    • Remaining limit: None.
  4. [Nit] Reuse PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS in _graphs() and lazily cache _Cuda() (ignition/preparation/runtime_core.py:93-95, 199-210, 305-313):

    • Fix: Replaced flags & ~9 in _graphs() with flags & ~PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS and added @lru_cache(maxsize=1) _cuda_driver() for _executable_instantiation_flags.
    • Verification (18312bd0): Covered by test_capture_graph_metadata.py::test_executable_instantiation_flags_reuses_cached_cuda_driver and test_runtime_core.py::test_template_export_rejects_unsupported_flags (70 passed, 14 skipped, 0 failed across the preparation/hook CPU suite).
    • Remaining limit: None.

Could you take another look at 18312bd0?

@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The downstream Heliopause/Helios pipeline already accepts USE_NODE_PRIORITY (8) and live SM120 export passes, but the PR globally enables CTA-priority scheduling on every exported serving graph with no flare run serving measurement, breaks keep_graph=False graphs, and leaks stale instantiation flags.

  • Blockers: 1
  • Should fix: 3
  • Subtractive suggestions: 2
  • Nits: 1

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

@flare-autobot flare-autobot added area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed. labels Nov 29, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

Revision 18312bd resolves all Round 1 Python correctness items, but the global default-on USE_NODE_PRIORITY still lacks served-workload flare run qualification.

  • Blockers: 1 · Should fix: 0 · Subtract/Simplify: 3 · Nits: 2
Walkthrough
  • ignition/preparation/runtime_core.py: Adds AUTO_FREE_ON_LAUNCH (1), USE_NODE_PRIORITY (8), PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS (9), cached _cuda_driver() / _executable_instantiation_flags(), pre-mutation validation in record_export_graph, stale-flag clearing, and zero-template rejection in _graphs().
  • helios/tests/node_priority_core_fixture.py & helios/src/runtime_core/node_priority_tests.rs: Add a signed single-rank export fixture and an #[ignore]d Rust test covering protobuf flags (9/1), launch-priority attributes, CUPTI instantiation arguments, readback (1), and bit-exact ReplayWorker replay.
  • helios/src/runtime_core/format.rs:868-879: Pins the flags & !9 != 0 validation contract.
  • tests/preparation/test_capture_graph_metadata.py, test_runtime_core.py, test_recorded_export_graph_cuda.py: Add CPU unit tests for pre-mutation rejection, stale-flag clearing, driver caching, and zero-template rejection, plus SM120 end-to-end wiring.
Merge Risk: Medium · up to 18312bd
  • Global GPU scheduling policy shift without served-workload qualification: Every exported serving graph now records USE_NODE_PRIORITY (8) via capture_forwards -> record_export_graph, activating CTA preemption for all kernels captured on ScratchArena.auxiliary_stream without a served-workload A/B baseline.
  • Unobservable in runtime telemetry: CUDA consumes bit 8 during instantiation, so cuGraphExecGetFlags reads back 1, and no Helios metric observes GPU-side priority arbitration.
  • Low format/runtime-stability risk: Existing signed cores remain valid, startup tuning graphs retain flags = 1, and no serving hot-path locks, queues, or allocations are added.
Pre-merge checks: ✅ 2 passed · ⚠️ 2 warnings
  • ✅ Security / malicious screen: No unsafe external inputs, secret handling, or suspicious native/FFI patterns; CUPTI callback and libloading usage match existing test conventions.
  • ⚠️ Charter & value fit: Right architectural layer, but labeled performance while flipping a global scheduling default with no served-workload flare run measurement.
  • ✅ Related / duplicate / conflict check: Genuinely additive and not superseded; downstream Heliopause/Helios plumbing already supports flags = 9.
  • ⚠️ Tests & verification evidence: Mechanism and CPU contracts are well-tested, but no multi-GPU TP flare run serving or latency/throughput A/B evidence has been collected.

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

@voipmonitor voipmonitor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 18312bd0 — all Round 1 Python/Rust correctness, validation, and Helios-wiring items are cleanly resolved!

  • Pre-mutation validation in record_export_graph cleanly rejects keep_graph=False, _flare_graph_metadata, and raw_cuda_graph() == 0 before retain_object/instantiate_graph, and instantiation_flags=None clears stale _flare_instantiation_flags.
  • _cuda_driver() caching and PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS reuse in _graphs() look great.
  • Great addition of node_priority_tests.rs (CUPTI cuGraphInstantiateWithFlags exit callback confirming flags=9/1 on live Helios NativeResources::load, CU_LAUNCH_ATTRIBUTE_PRIORITY attributes, and 0-ULP ReplayWorker parity).

Only remaining gate (Principle 12): Because this enables USE_NODE_PRIORITY (8) globally by default on every exported serving graph (activating CTA preemption for all kernels captured on ScratchArena.auxiliary_stream across all recipes), we still need a live served-workload A/B measurement on flare run (flags=1 vs flags=9 on a real TP core) confirming zero regression across decode/prefill overlap before merging (or gate it behind an explicit opt-in if full multi-recipe qualification isn't ready yet).

@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 18312bd to 7fc5993 Compare November 29, 2026 15:59
@FujitsuPolycom FujitsuPolycom changed the title ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs ignition: add opt-in --use-node-priority flag for exported CUDA graphs Nov 29, 2026
@FujitsuPolycom

Copy link
Copy Markdown
Contributor Author

@voipmonitor Thanks for the review! We took the explicit opt-in option in 7fc5993 (rebased onto origin/main 44f59df) so default exported cores stay completely unchanged until full multi-recipe lare run A/B qualification is done:

  • Default preserved ( lags=1): RecipeParameters.use_node_priority,
    ecord_export_graph, and capture_forwards all default to False (instantiation_flags=None), keeping executable-derived AUTO_FREE_ON_LAUNCH (1) on every default export across all recipes and leaving existing signed cores unaffected.
  • Explicit opt-in ( lags=9): Added universal --use-node-priority / --no-use-node-priority CLI flags and [preparation] use_node_priority in config.toml (CLI overrides config; serialized into Plan, BasePreparationConfig, PreparationManifest, and
    eproduction_args; explicit flags rejected on ignition bench and ignition debug-serve). Scoped propagation (export_node_priority) flows through @with_autotune_effort, serve._prepare, serve._export_hosts,
    ank_group._peer, and host_ranks.serve_peer so single-GPU, local TP, and multi-host TP ranks agree without per-recipe edits. Helios continues to load and honor both lags=1 and lags=9 cores.
  • Documentation & follow-up: Updated docs/cli-design.md and docs/runtime-core-design.md, and recorded multi-recipe lare run served-workload A/B measurement ( lags=1 vs lags=9) in docs/TODO.txt.
  • Verification on exact rebased commit 7fc5993 (git archive, 1x RTX 5090 SM120, freshly built lare_heliopause):
    • cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::: 185 passed, 0 failed, 11 ignored.
    • CLI/config/planning/core-boundary/hook/preparation CPU pytest suites: 169 passed, 14 skipped (CUDA-gated tests in est_runtime_core.py), 0 failed (full ests/cli: 135 passed, 0 failed).
    • FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py: 2 passed, 0 skipped, 0 failed — confirming via CUPTI cuGraphInstantiateWithFlags receives 1/1 for default decode/ une and 9/1 for opt-in decode/ une, retained cuGraphExecGetFlags == 1, and bit-exact ReplayWorker replay on both signed cores.

Could you please take another look at 7fc5993?

@voipmonitor voipmonitor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified opt-in --use-node-priority revision 7fc5993b on top of origin/main (44f59df5) plus full live 4× RTX PRO 6000 Blackwell (SM120) TP4 exported-core flare run paired ABAB qualification (flags=1 vs flags=9).

1. Unit, Rust & Live SM120 CUDA/CUPTI Verification (7fc5993b)

  • Clean opt-in CLI/config wiring: use_node_priority defaults to False (flags=1), cleanly threaded through config.py, parameters.py, planning.py, serve.py, host_ranks.py, rank_group.py, tuning.py (export_node_priority contextvar), capture.py, and runtime_core.py; properly rejected on ignition bench and ignition debug-serve.
  • CPU pytest (tests/cli/test_{commands,config,parameters}.py + tests/preparation/...): 161 passed, 14 skipped, 0 failed.
  • Rust runtime_core: cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core — 185 passed, 0 failed, 11 ignored.
  • Live SM120 CUDA + Helios CUPTI Replay (GPU 4): FLARE_RUN_CUDA_TESTS=1 pytest tests/preparation/test_recorded_export_graph_cuda.py — 2 passed, 0 failed (verifying default flags=1 vs opt-in flags=9 via CUPTI cuGraphInstantiateWithFlags and bit-exact ReplayWorker replay).

2. Live 4× SM120 TP4 Exported-Core flare run Paired ABAB Qualification (flags=1 vs flags=9)

Exported two apples-to-apples DeepSeek-V4.1-Flash TP4 cores (--max-concurrency 32 --image-concurrency 4 --mtp-draft-tokens 7 --mtp-only --row-shard-prefill --row-shard-attention --autotune-effort default, Core B reusing Core A's weights), differing solely in serving graph flags:

  • Core manifest verification: Exact match across all 4 ranks — 135/135 graphs, 9,728 kernels/rank, 91/135 graphs containing 43,290 priority=-5 (auxiliary_stream) kernels; Core A recorded flags=1 on 135/135, Core B recorded flags=9 on 135/135.
  • Paired ABAB (A1 → B1 → A2 → B2, RAM Engram, C=32, MTP-7):
    • Stability & qualification: 0 errors, 0 hangs, 0 CUDA faults, identical VRAM (79.47 GiB weights/rank, 59.8 GiB KV); Greedy 17*23=391 4/4 PASS, 4× Vision 16/16 PASS, Cold NIAH 8K–128K 16/16 PASS.
    • Cold prefill (8K–128K, warm-GPU A2 vs B mean): flat parity within -0.30% to +0.23% (64K: 59.9k → 59.9k, 128K: 59.4k → 59.4k).
    • Decode GPU step latency (mean across paired ABAB):
      • C=1: 5.719 → 5.631 ms (-1.54%)
      • C=4 @ P=256: 7.247 → 7.125 ms (-1.68%, B4xW8: 7.68 → 7.29 ms, -5.08%)
      • C=8 @ P=256: 8.683 → 8.721 ms (+0.44%, B8xW8: 9.31 → 9.08 ms, -2.47%)
      • C=16 @ P=256: 10.482 → 10.464 ms (-0.17%, B16xW8: 15.24 → 14.42 ms, -5.38%)
      • C=32 @ P=256: 13.172 → 13.009 ms (-1.24%)
      • C=32 @ P=2048: 13.268 → 13.071 ms (-1.48%, 1,232.0 → 1,232.8 tok/s)

Clean, safe opt-in design with real multi-GPU hardware qualification — ready to merge.

Why:
Exported serving graphs that capture overlapped work on higher-priority CUDA
streams such as `ScratchArena.auxiliary_stream` record per-kernel
`CU_LAUNCH_ATTRIBUTE_PRIORITY` attributes, but CUDA ignores kernel-node
priorities during replay unless the graph executable is instantiated with
`CU_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY` (`8`). Recording
`USE_NODE_PRIORITY` alongside permitted flags already present on the captured
executable (`CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`, `1` -> `9`)
enables Helios to honor captured stream priorities during
`cuGraphInstantiateWithFlags`. Requesting explicit instantiation flags also
requires a retained CUDA graph template (`keep_graph=True` without
post-instantiation release metadata) so export rejects missing or released
templates before handing a zero template handle to Heliopause.

What:
- `ignition/preparation/runtime_core.py`:
  - Before: `record_export_graph` retained owners and instantiated the graph
    without serializing `USE_NODE_PRIORITY`, so exported serving graphs kept
    only executable-derived flags (`1`).
  - After: `record_export_graph` defaults `instantiation_flags` to
    `CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY` (`8`). When
    `instantiation_flags` is not `None`, it validates the bitmask against
    `PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS` (`9`, bits `1` and `8`), rejects
    graphs carrying `_flare_graph_metadata` or a released/zero
    `raw_cuda_graph()` handle, and verifies pool ownership before calling
    `retain_object` or `instantiate_graph`. After instantiation, it clears any
    pre-existing `_flare_instantiation_flags` attribute, queries
    `cuGraphExecGetFlags` through a lazily cached `_Cuda` driver wrapper,
    rejects unsupported executable flags, and records
    `prior_flags | instantiation_flags`. Passing `instantiation_flags=None`
    clears any prior `_flare_instantiation_flags` override so export falls back
    to executable-derived or recorded graph metadata. `_graphs` reuses
    `PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS` and rejects zero
    `raw_cuda_graph()` handles when `_flare_instantiation_flags` is set.
- `helios/src/runtime_core/` (`format.rs`, `mod.rs`, `node_priority_tests.rs`),
  `helios/tests/node_priority_core_fixture.py`, and `tests/preparation/`
  (`test_capture_graph_metadata.py`, `test_recorded_export_graph_cuda.py`,
  `test_runtime_core.py`):
  - Helios runtime loading already validates `flags & !9 == 0` and passes
    serialized flags to `cuGraphInstantiateWithFlags`. Add Rust validation
    coverage, Python CPU unit tests for template-retention guards,
    pre-mutation rejection, stale-flag clearing, `_Cuda` caching, and
    zero-template rejection, plus a signed-core CUDA fixture and Helios
    `NativeResources::load` + `ReplayWorker` test verifying via CUPTI that
    `cuGraphInstantiateWithFlags` receives `9` on the serving graph and `1` on
    the startup tuning graph with bit-exact main- and auxiliary-stream replay.
- Compatibility: Existing signed cores keep their recorded graph flags (`1`)
  and load and serve without re-export or re-signing. Startup tuning graphs
  continue to call `capture_graph` and `instantiate_graph` directly
  (`flags = 1`).

Result:
Newly exported serving graphs instantiate with `USE_NODE_PRIORITY` (`8`,
combined with `AUTO_FREE_ON_LAUNCH` -> `9`) while startup tuning graphs keep
`flags = 1` and existing signed cores remain compatible. In paired ABAB
multi-GPU `flare run` serving qualification by `@voipmonitor` (review
`PRR_kwDOVRNQZM8AAAABa9GF4Q`) on `4x NVIDIA RTX PRO 6000 Blackwell` (SM120)
with `DeepSeek-V4.1-Flash` TP4 (`flags = 1` vs `flags = 9` across `135/135`
graphs, `91/135` containing `43,290` `priority = -5` auxiliary-stream kernels),
`flags = 9` produced zero errors, hangs, or CUDA faults, identical VRAM
(`79.47 GiB` weights/rank, `59.8 GiB` KV), 4/4 greedy, 16/16 vision, and 16/16
cold NIAH (`8K-128K`) passes, flat cold prefill (`-0.30%` to `+0.23%`), and
decode GPU step latency reductions of `-1.24%` to `-1.68%` at `C=1`, `C=4`, and
`C=32` (with wide `W=8` speculative buckets `B4xW8`, `B8xW8`, and `B16xW8`
improving `-2.47%` to `-5.38%`, and `C=8`/`C=16` overall means at
`+0.44%`/`-0.17%`). That multi-GPU A/B used the equivalent `flags = 9` core
manifest generated by commit `7fc5993b`; recipes other than
`DeepSeek-V4.1-Flash` and architectures other than SM120 were outside that
serving A/B scope.

Evidence:
- Verified on a clean `git archive` extraction with freshly built
  `flare_heliopause` on WSL2 Linux with `1x NVIDIA GeForce RTX 5090` (SM120):
  - `ruff==0.12.8 check` on the 5 touched Python files: passed.
  - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::`: 186 passed, 0 failed, 11 ignored.
  - `pytest -v -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py`: 57 passed, 14 skipped (CUDA-gated tests in `test_runtime_core.py`), 0 failed.
  - `FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py`: 2 passed, 0 skipped, 0 failed (verifying `flags_by_name == {"decode": 9, "tune": 1}`, negative auxiliary-stream kernel priority, CUPTI-observed `cuGraphInstantiateWithFlags` flags `9` on `"decode"` and `1` on `"tune"`, retained `cuGraphExecGetFlags == 1`, and bit-exact `ReplayWorker` main- and auxiliary-stream outputs).
- Multi-GPU serving A/B evidence: `@voipmonitor` review `PRR_kwDOVRNQZM8AAAABa9GF4Q`
  on `4x NVIDIA RTX PRO 6000 Blackwell` (SM120) TP4 `DeepSeek-V4.1-Flash`
  (`flags = 1` vs `flags = 9`, paired ABAB, `135/135` graphs).
- Limitations: Single-GPU SM120 runtime-core export, CUPTI instantiation-flag
  verification, and `ReplayWorker` replay ran directly on this commit; multi-GPU
  `flare run` serving A/B was performed by `@voipmonitor` on `DeepSeek-V4.1-Flash`
  TP4 (SM120) on the equivalent `flags = 9` manifest at `7fc5993b`, leaving
  other recipes and SM103/SM121 serving A/B outside the measured scope.

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 7fc5993 to 4270e90 Compare November 29, 2026 17:50
@FujitsuPolycom FujitsuPolycom changed the title ignition: add opt-in --use-node-priority flag for exported CUDA graphs ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs Nov 29, 2026
@FujitsuPolycom

Copy link
Copy Markdown
Contributor Author

@lukealonso @voipmonitor With @voipmonitor's paired 4× SM120 TP4 DeepSeek-V4.1-Flash ABAB qualification confirming zero faults/errors, -1.2% to -1.7% decode step latency reductions at C=1/C=4/C=32, -2.5% to -5.4% reductions on wide W=8 speculative buckets (B4xW8, B8xW8, B16xW8), and flat parity on C=8/C=16 (+0.44%/-0.17%) and cold prefill (-0.30% to +0.23%), we dropped the opt-in CLI/config switch so exported serving graphs always set USE_NODE_PRIORITY.

Updated PR #581 to 4270e9046dab222981d8d8bcc80cbcb1a2843bda (rebased onto origin/main 9a054b49), restoring the minimal 8-file always-on change:

  • Removed opt-in plumbing: Dropped the --use-node-priority CLI flag, [preparation] use_node_priority config key, planner/manifest/rank propagation, and flag docs so record_export_graph sets CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY (8, combined with AUTO_FREE_ON_LAUNCH -> 9) by default on exported serving graphs while startup tuning graphs keep flags = 1 and previously signed cores remain unchanged and compatible.
  • Updated PR title and body to reflect the always-on behavior, @voipmonitor's paired 4× SM120 TP4 ABAB serving results and scope limits, and exact re-verification on 4270e9046dab222981d8d8bcc80cbcb1a2843bda.
  • Verification on clean git archive 4270e9046dab222981d8d8bcc80cbcb1a2843bda (1x RTX 5090 SM120, freshly built flare_heliopause):
    • ruff==0.12.8 check on all 5 touched Python files: passed.
    • cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::: 186 passed, 0 failed, 11 ignored.
    • pytest -v -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py: 57 passed, 14 skipped (CUDA-gated tests in test_runtime_core.py), 0 failed.
    • FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py: 2 passed, 0 skipped, 0 failed (CUPTI cuGraphInstantiateWithFlags receives 9 on "decode" and 1 on "tune", retained cuGraphExecGetFlags == 1, bit-exact ReplayWorker replay).

Could you take another look at 4270e9046dab222981d8d8bcc80cbcb1a2843bda?

@flare-autobot flare-autobot added triage:review Proposed change needs code review; this does not imply merge readiness. and removed triage:validation Proposed implementation needs acceptance evidence; no claim that a reported defect is fixed. labels Nov 29, 2026
@lukealonso
lukealonso merged commit eee6a9f into NVIDIA:main Nov 29, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Ready To Merge

Head 4270e90 resolves the sole Round 2 blocker (live multi-GPU flare run served-workload A/B qualification) via @voipmonitor's paired 4× SM120 TP4 DeepSeek-V4.1-Flash ABAB (0 errors/faults/hangs, 100% accuracy pass, flat prefill, and -1.2% to -1.7% decode latency gains across C=1/C=4/C=32 with -2.5% to -5.4% on W=8 speculative buckets), while keeping the minimal 8-file footprint and no speculative CLI/config switch. All Round 1 items remain re-verified on 4270e90 with no new correctness, safety, or compatibility regressions; note the earlier APPROVED covered opt-in 7fc5993b, and non-DeepSeek-V4.1-Flash recipes plus SM103/SM121 remain outside the measured A/B scope.

  • Blockers: 0 · Should fix: 0 · Subtract/Simplify: 2 · Nits: 2
Walkthrough
  • ignition/preparation/runtime_core.py:93-95, 197-266: Adds CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH (1), CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY (8), PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS (9), lazily cached _cuda_driver() + _executable_instantiation_flags(), and updates record_export_graph to default instantiation_flags to 8. Validates requested flags, absence of _flare_graph_metadata, live non-zero raw_cuda_graph(), and pool ownership before retain_object/instantiate_graph; clears pre-existing _flare_instantiation_flags after instantiation; queries cuGraphExecGetFlags, rejects unsupported executable bits, and records prior_flags | instantiation_flags.
  • ignition/preparation/runtime_core.py:306-312: Reuses PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS in _graphs() and rejects a zero raw_cuda_graph() handle whenever _flare_instantiation_flags is set.
  • helios/src/runtime_core/format.rs:868-879: Adds unit test graph_instantiation_flags_accept_auto_free_and_node_priority_only pinning 0/1/8/9 accepted and 2/4/16/u64::MAX rejected.
  • helios/src/runtime_core/mod.rs:26-27, helios/src/runtime_core/node_priority_tests.rs, helios/tests/node_priority_core_fixture.py: Adds a signed single-rank export fixture (decode with main + ScratchArena.auxiliary_stream branches and tune startup tuning graph) and an #[ignore]d Rust test verifying serialized flags (9/1), CU_LAUNCH_ATTRIBUTE_PRIORITY (< 0 and 0), CUPTI-observed cuGraphInstantiateWithFlags flags (9/1), cuGraphExecGetFlags == 1 readback, and 0-ULP bit-exact ReplayWorker replay.
  • tests/preparation/test_capture_graph_metadata.py, tests/preparation/test_runtime_core.py, tests/preparation/test_recorded_export_graph_cuda.py: Adds CPU tests for template-retention guards, pre-mutation rejection, stale-flag clearing, _cuda_driver() caching, zero-template rejection in _graphs(), and SM120 end-to-end fixture + Helios CUPTI replay wiring.
Merge Risk: Medium · up to 4270e90
  • Global GPU scheduling policy activation for auxiliary_stream graphs: Every newly exported serving graph via capture_forwards -> record_export_graph (ignition/preparation/capture.py:193, ignition/preparation/runtime_core.py:213-266) now records flags = 9 (AUTO_FREE_ON_LAUNCH | USE_NODE_PRIORITY), causing Helios (helios/src/runtime_core/mod.rs:1220-1224) to honor captured CU_LAUNCH_ATTRIBUTE_PRIORITY (id = 8) attributes on ScratchArena.auxiliary_stream kernels. While paired 4× SM120 TP4 ABAB passed cleanly on DeepSeek-V4.1-Flash (91/135 graphs, 43,290 priority = -5 kernels), other recipes and SM103/SM121 were not measured in that ABAB, and there is no separate flag to disable bit 8 independently of --no-stream-overlap.
  • Approval-to-head delta: @voipmonitor's 16:57 APPROVED review was given on 7fc5993b (opt-in --use-node-priority); 4270e90 reverts the opt-in plumbing to restore the always-on 18312bd behavior on top of main 9a054b49.
  • Low format, compatibility, and serving-path stability risk: Existing signed cores keep flags = 1 and continue to load unchanged; startup tuning graphs keep flags = 1; Heliopause (heliopause/src/export/capture.rs:791-794, 2840-2841) and Helios (helios/src/runtime_core/format.rs:495, mod.rs:989-1018, 1223) already support flags & !9 == 0 and kernel priority attribute id = 8; no serving hot-path locks, queues, buffering, or allocations are added.
Pre-merge checks: ✅ 3 passed · ⚠️ 1 warnings
  • ✅ Security / malicious screen: No unsafe external inputs, secret handling, or suspicious native/FFI patterns; CUPTI callback/FFI and libloading usage in node_priority_tests.rs are test-only and properly unsubscribed on drop. No prompt-injection or instruction-override attempts found in PR material.
  • ✅ Charter & value fit: Fixes an incomplete CUDA graph instantiation contract in Ignition (ScratchArena.auxiliary_stream at ignition/preparation/scratch.py:91-97 already creates highest-priority streams and Heliopause/Helios already support flags & !9 == 0 and priority attribute id = 8), avoids adding a speculative CLI/config switch (AGENTS.md:188-190), preserves core compatibility, and discloses all four required PR description sections and scope limits honestly.
  • ✅ Related / duplicate / conflict check: Genuinely additive and clean against main 9a054b49; does not touch ignition/preparation/capture.py, so there is no conflict with open PR fix(ignition): seed warmup workspaces inside export storage pool #606.
  • ⚠️ Tests & verification evidence: CPU pytest (python-cpu.yml), Rust unit tests, and single-GPU SM120 CUDA/CUPTI replay tests all pass directly on 4270e90, and paired 4× SM120 TP4 flare run ABAB passed on the equivalent flags = 9 manifest at 7fc5993b; however, CUDA-gated / #[ignore]d tests do not run in CI, non-DeepSeek recipes and SM103/SM121 were outside the ABAB scope, and @voipmonitor's earlier APPROVED review was on opt-in revision 7fc5993b.

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:review Proposed change needs code review; this does not imply merge readiness.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants