Skip to content

cuda.core: add executable graph node updates - #2473

Draft
Andy-Jost wants to merge 7 commits into
NVIDIA:mainfrom
Andy-Jost:ajost/graph-exec-attachments
Draft

cuda.core: add executable graph node updates#2473
Andy-Jost wants to merge 7 commits into
NVIDIA:mainfrom
Andy-Jost:ajost/graph-exec-attachments

Conversation

@Andy-Jost

Copy link
Copy Markdown
Contributor

Summary

  • Add one append-only CUDA user-object accumulator per executable graph so individual node updates retain replacement resources through all affected launches.
  • Add ephemeral graph[node] views for complete kernel, memcpy, memset, host-callback, child-graph, and event updates, plus executable enable state where CUDA supports it.
  • Cover rollback, source reclamation, independent executables, whole-graph replacement, and in-flight cleanup without private mutation hooks.

Changes

  • Prepare and atomically install executable attachment accumulators during instantiation and whole-graph updates.
  • Route executable updates through cuGraphExecNodeSetParams while CUDA remains authoritative for node association.
  • Document complete-parameter semantics, owner retention, source lifetime, and CUDA 12.2+ requirements.

Notes

GPU tests were intentionally deferred to CI.

Related Work

Closes #2353.
Closes #2354.

@Andy-Jost Andy-Jost added this to the cuda.core 1.2.0 milestone Jul 31, 2026
@Andy-Jost Andy-Jost added P0 High priority - Must do! feature New feature or request cuda.core Everything related to the cuda.core module labels Jul 31, 2026
@Andy-Jost Andy-Jost self-assigned this Jul 31, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@Andy-Jost

Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions github-actions Bot added the cuda.pathfinder Everything related to the cuda.pathfinder module label Jul 31, 2026
Install a private CUDA user object per graph executable so later node updates can retain replacement resources safely.
Expose ephemeral graph-node views that update complete executable parameters while retaining every replacement resource CUDA may still use.
Exercise public mutators, rollback, source reclamation, independent ownership, whole updates, and in-flight cleanup end to end.
@Andy-Jost
Andy-Jost force-pushed the ajost/graph-exec-attachments branch from 450d1d5 to dd97efa Compare July 31, 2026 19:43
@Andy-Jost

Copy link
Copy Markdown
Contributor Author

/ok to test

@Andy-Jost Andy-Jost removed the cuda.pathfinder Everything related to the cuda.pathfinder module label Jul 31, 2026
Instantiation and whole-graph update each went through a prepare/commit
pair. That exposed an opaque transaction type over the internal C++
interface and split the exec ownership contract between C++ and Cython,
unlike every other resource handle, which a single create_* function
owns end to end.

Replace the pairs with create_graph_exec_handle and graph_exec_update.
Each stages a fresh attachment accumulator on the source graph, makes
the CUDA call with the GIL released, and adopts or publishes the result,
so the staging transaction becomes a stack guard in the anonymous
namespace instead of a header type. Cython keeps only what belongs to
it: filling the instantiation params and decoding the failure reasons.
The two driver entry points move into the C++ loader table with the
calls.

Convert the attachment append transaction to the unique_ptr plus
rollback deleter pattern that node attachments already use, which
retires the committed flag in favor of the same release-and-delete
mechanism. Drop GraphExecBox::attachment_object, which nothing reads.
Three gaps remained around owners attached to an executable graph.

Sequential updates to the same node must keep the superseded owner
reachable, because CUDA cannot detach user objects from an executable;
verified by breaking the append into a replace, which fails the new
test on exactly that assertion.

Closing an executable while a launch is in flight must not retire the
accumulator, since the launch still writes through the buffer that an
individual node update attached.

A child-graph update attaches no owner of its own and relies on CUDA
cloning the replacement graph's user object references into the
executable. Assert that contract directly: the callback outlives the
definition that supplied it and is released with the executable.
CUDA accepts user objects on a CUgraph only, so an executable graph can
never receive an owner after it exists. Document the consequence: one
accumulator is retained on the source graph, propagated by instantiation
or whole-graph update, and then released from the source so the
executable becomes its only owner.

Record why an owner is never removed once appended, and correct the two
Scope entries that still described executable graphs as untracked.

State the retention limit in the release notes as well. The API
reference already documents it, but the note is what a reader sees when
adopting the feature, and retention that looks unbounded deserves the
warning there.
@Andy-Jost

Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

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

Labels

cuda.core Everything related to the cuda.core module feature New feature or request P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cuda.core: add atomic update methods for executable graph nodes cuda.core: add append-only attachment ownership for executable graphs

1 participant