Recommendation: Changes Requested
Revision 18312bd cleanly fixes all Python correctness and review items from Round 1 — up-front validation of keep_graph=False / _flare_graph_metadata / zero templates before graph mutation, clearing stale _flare_instantiation_flags, reusing PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS, caching _Cuda(), and adding an end-to-end single-GPU SM120 Helios NativeResources::load + CUPTI + ReplayWorker verification test. (Note that the earlier 2026-11-29 00:15 Autobot comment still cited the pre-push keep_graph=False and stale-flag bugs, both of which are resolved at 18312bd.) However, the standing Round 1 Blocker (@voipmonitor Major #1 and charter / docs/design-review.md Principle 12) remains unresolved: this performance-labeled PR enables USE_NODE_PRIORITY (8) globally by default for every exported serving graph with zero served-workload flare run TP measurement or CTA-preemption regression qualification on a real model checkpoint.
Merge Risk
Level: Medium
- Global GPU scheduling policy shift without served-workload qualification: Every exported serving graph now records
USE_NODE_PRIORITY(8) viacapture_forwards->record_export_graph(ignition/preparation/capture.py:193,ignition/preparation/runtime_core.py:218), activating GPU-side CTA preemption for all kernels captured onScratchArena.auxiliary_stream(ignition/preparation/scratch.py:83-105) across all out-of-tree recipes without any served-workload A/B baseline. - Unobservable in runtime telemetry: As proven by the PR's own test (
helios/src/runtime_core/node_priority_tests.rs:216-219), CUDA consumes bit8duringcuGraphInstantiateWithFlagssocuGraphExecGetFlagsreads back1, and no Helios metric observes GPU-side priority arbitration — making a scheduling regression invisible without an explicitflare runA/B check. - Low format/runtime-stability risk: Existing signed cores (flags
0/1) remain valid (helios/src/runtime_core/format.rs:495), startup tuning graphs retainflags = 1, and no serving hot-path locks, queues, or allocations are added.
Walkthrough
ignition/preparation/runtime_core.py: DefinesCUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH(1),CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY(8), andPERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS(9), plus lazily cached_cuda_driver()and_executable_instantiation_flags(graph)(:93-95, 197-210). Updatesrecord_export_graph(:213-266) to defaultinstantiation_flags=8, validate requested bits /_flare_graph_metadataabsence / non-zeroraw_cuda_graph()and pool ownership beforeretain_objectandinstantiate_graph, clear any stale_flare_instantiation_flagsviadelattr, and combineprior_flags | instantiation_flagsafter instantiation. Updates_graphs()(:305-313) to reusePERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGSand reject zero templates when flags are set.helios/tests/node_priority_core_fixture.py&helios/src/runtime_core/node_priority_tests.rs(registered inhelios/src/runtime_core/mod.rs:26-27): Add a signed single-rank export fixture capturing a"decode"graph (main streampriority = 0+ScratchArena.auxiliary_streampriority < 0) and"tune"TuningGraph(flags = 1), and an#[ignore]d Rust test verifying protobufflags(9/1), decodedCU_LAUNCH_ATTRIBUTE_PRIORITY(id = 8) attributes, CUPTI-interceptedcuGraphInstantiateWithFlagsarguments (9/1),cuGraphExecGetFlagsreadback (1), and bit-exactReplayWorkerreplay across poisoned outputs.helios/src/runtime_core/format.rs:868-879: Addsgraph_instantiation_flags_accept_auto_free_and_node_priority_onlypinningCore::validate'sflags & !9 != 0contract.tests/preparation/test_capture_graph_metadata.py,tests/preparation/test_runtime_core.py,tests/preparation/test_recorded_export_graph_cuda.py: Add CPU unit tests for pre-mutation rejection, stale-flag clearing,_cuda_drivercaching, and zero-template rejection, and wire the SM120 CUDA suite to runnode_priority_core_fixture.pyfollowed by the Helios Rust test.
Pre-merge Checks
- [PASS] Security / malicious screen: No unsafe external inputs, secret handling, or suspicious native/FFI patterns; CUPTI callback and
libloadingusage innode_priority_tests.rsmatch existing test conventions (heliopause/src/export/recorder.rs:33-43,helios/tests/tools/allocation_watch.rs:13-96). - [WARN] Charter & value fit: Right architectural layer (Ignition export only, model-agnostic, preserves old core compatibility), but labeled
performanceand flips a global scheduling default (instantiation_flags=8) with no served-workloadflare runmeasurement (docs/design-review.md:106-115, Charter #210). - [PASS] Related / duplicate / conflict check: Genuinely additive and not superseded (
#585was closed by the author;#314and#397touch adjacent files without semantic conflict). Downstream Heliopause/Helios plumbing (heliopause/src/export/capture.rs:791-794, 2823;helios/src/runtime_core/format.rs:495,mod.rs:1218-1221) already supportsflags = 9. - [WARN] Tests & verification evidence: Mechanism and CPU contracts are well-tested (
182Rust tests +70Python tests + single-GPU RTX 5090 SM120 end-to-end export/CUPTI/replay test), and CI compilesnode_priority_tests.rson Linux and Windows (.github/workflows/native-serving.yml:63 (not opened), 68), but no multi-GPU TPflare runserving or latency/throughput A/B evidence has been collected.
Blockers
- Global default-on
USE_NODE_PRIORITYlacks served-workloadflare runqualification (ignition/preparation/runtime_core.py:213-219,ignition/preparation/capture.py:193,ignition/preparation/scratch.py:83-105):- Verified behavior & impact:
record_export_graphdefaultsinstantiation_flags=CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY(8), and its sole production callercapture_forwards(capture.py:193) passes no override. Every newly exported serving graph therefore embedsflags = 9(1 | 8), which Helios passes verbatim tocuGraphInstantiateWithFlags(helios/src/runtime_core/mod.rs:1218-1221). This globally activates CTA-level preemption for every kernel captured onScratchArena.auxiliary_stream(scratch.py:93-97) across all out-of-tree recipes (since commit4d957175moved collective wrappers out of core Ignition). Whilenode_priority_tests.rsproves the single-GPU instantiation mechanism works, the PR carries theperformancelabel with zero served-workloadflare runTP latency/throughput measurements againstmain, leaving the standing@voipmonitorRound 1 Major #1 anddocs/design-review.md:106-115(Principle 12) / Charter #210 evidence requirement unmet. - Concrete fix: Either (a) run an A/B
flare runserving benchmark on an exported TP core (comparingmainvs. this PR on a real recipe usingScratchArena.auxiliary_streamand confirming no CTA-preemption regression on heavy-compute auxiliary-stream recipes) and attach the measurements and commands to the PR description, or (b) obtain explicit maintainer sign-off (e.g.,@voipmonitor/@lukealonso) to land the mechanism as a correctness fix without a served benchmark and remove theperformanceframing/label (or gate it behind an explicit recipe/preparation option if global default-on is not desired yet).
- Verified behavior & impact:
Should Fix
None.
Subtract / Simplify
- Deduplicate flag-mask and retained-template validation (
ignition/preparation/runtime_core.py:232-246, 259-264, 305-312):- The bitmask check (
type(v) is not int or v < 0 or v & ~PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS) is repeated three times, and the non-zeroraw_cuda_graph()check is repeated twice with identical error messages. Extracting small helpers (_validate_instantiation_flags/_retained_template_handle) removes the duplication and also gives_graphs()(:309) the sameRuntimeError -> ValueErrornormalization thatrecord_export_graph(:241-244) already performs.
- The bitmask check (
- Factor repeated context-set / copy / sync boilerplate in
helios/src/runtime_core/node_priority_tests.rs:230-246, 252-272, 279-308, 315-346:- The test repeats the
cuCtxSetCurrent+cuMemsetD8_v2/cuMemcpyHtoD_v2/cuMemcpyDtoH_v2+cuCtxSynchronizesequence four times acrossselector,source,main_output, andaux_output. Two small local test helper closures/functions operating onBufferSpan(memset_span/upload_span/download_span) would trim ~45–50 lines of repetitive driver plumbing. (Note:NativeResources::upload/downloadcannot be used here becauseexport_modelexports VMM allocations nameddevice-*, not per-buffer allocation names.)
- The test repeats the
- Optional cleanup once policy is settled —
instantiation_flagskeyword parameter (ignition/preparation/runtime_core.py:213-219):- No production caller passes
instantiation_flags(capture.py:193);Noneand0are exercised only by unit tests (tests/preparation/test_capture_graph_metadata.py:234, 242, 254). Once maintainers decide between unconditionalUSE_NODE_PRIORITYvs. recipe/preparation opt-in, either delete the unused parameter (AGENTS.md:188-193) or wire it to the actual preparation/recipe option.
- No production caller passes
Nits
- PR description ("Before:" bullet): States "and
_Cuda()reopened the CUDA driver library on each call", which describes the prior PR commit (61f64f18) rather thanmain(whererecord_export_graphdid not call_Cuda()). ignition/preparation/runtime_core.py:96-98: Three blank lines instead of two between_cuda_driverandclass RuntimeCore.
Dropped on verification
- Upstream F1 sub-claim ("needs a runtime driver-capability probe because serving hosts may reject bit 8"): Dropped as speculative.
CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY(8) has been supported since CUDA 12.0, and Flare's supported targets are SM103/SM120/SM121 (Blackwell, CUDA 12.8+/13.x). Retained only the verifiedflare run/ CTA-preemption qualification and Charter #210 evidence blocker. - Upstream F2 ("read
_executable_instantiation_flagsbeforeinstantiate_graph; deleting_flare_instantiation_flagsbefore theprior_flagscheck lets aNoneretry silently downgrade"): Dropped as factually false. Forkeep_graph=Truegraphs (ignition/preparation/capture.py:171,tests/preparation/test_capture_graph_metadata.py:44-55), no executable exists untilinstantiate_graph(graph)runs atruntime_core.py:254. Moreover, clearing stale_flare_instantiation_flagsat:255-256prevents stale overrides whenprior_flagsis invalid; an executable with unsupported flags (e.g.,2) is still rejected byCore::validate(helios/src/runtime_core/format.rs:495), not silently downgraded. - Upstream F3 ("tuning graphs and metadata graphs silently lose node priority"): Dropped as false / intentional design. Startup
TuningGraphs (ignition/preparation/execution.py(not opened)) do not callrecord_export_graph, have noScratchArena.auxiliary_streambranches, and are explicitly documented and tested to keepflags = 1. - Upstream F4 ("post-
reset()error blames flags;executable_flags()readback loses bit 8"): Dropped as low-signal. The message"graph instantiation flags require a retained CUDA graph template"is accurate for a zero template handle, and when_flare_instantiation_flagsis present Heliopause usesSome(flags)(heliopause/src/export/capture.rs:791-792), not theexecutable_flagsfallback. - Upstream F5 ("Windows
nvcuda.dllparity of cached_Cudais untested;check()raisesRuntimeErrorinstead ofValueError"): Dropped as false / low-signal._Cuda(runtime_core.py:76-90) is pre-existing code,_cuda_driver()directly answers@voipmonitor's Round 1 Nit #4, and CUDA driver errors raisingRuntimeErrormatchescore_storage.pyandvirtual_storage.py. - Upstream F6 ("
#[ignore]+.unwrap()on env vars innode_priority_tests.rspanics on bare runs andstd::mem::forgetleakslibcupti"): Dropped as false.#[ignore]+std::env::var_os(...).unwrap()is the exact repo convention across every sibling GPU test (helios/src/runtime_core/cooperative_tests.rs:42-45,event_tests.rs:15-17, 56-63,programmatic_edge_tests.rs:11-14), and keepinglibcuptimapped after unsubscribe is an intentional, documented crash guard (node_priority_tests.rs:112-113). - Upstream F7 ("PR body cargo features mismatch
runtime-core,servervsruntime-core"): Dropped as false. The PR body reports two distinct commands: Layer 1 CPUcargo test ... --features runtime-core,server --lib runtime_core(182 passed) and Layer 2pytest tests/preparation/test_recorded_export_graph_cuda.py(which invokes--no-default-features --features runtime-coreinternally). - Upstream S1 ("replace raw CUDA copies in
node_priority_tests.rswithNativeResources::upload/download"): Dropped as broken.NativeResources::upload/download(helios/src/runtime_core/mod.rs:1448-1511) look upself.allocations, whichexport_model(runtime_core.py:371) names"device-0", etc. — callingowner.upload("source", ...)orowner.download("selector")would fail at runtime withunknown allocation. Replaced with a valid local span-helper suggestion underSubtract / Simplify. - Upstream S4 ("inline
storage.cudaand delete_cuda_driver()"): Dropped.record_export_graph's duck-typedstoragecontract only requires.pooland.graph_pool(VirtualStoragehas neither), and_cuda_driver()is a 3-line helper explicitly requested in Round 1 Nit #4. - Upstream S5/S6/S7 (fixture scaffold duplication, standalone
allocation_watch.rsCUPTI struct, untouched Rust literal9atformat.rs:495): Dropped as low-signal / untouched-line churn on Round 2+.