cuda.core: retain graph attachments with per-node user objects#2357
Open
Andy-Jost wants to merge 14 commits into
Open
cuda.core: retain graph attachments with per-node user objects#2357Andy-Jost wants to merge 14 commits into
Andy-Jost wants to merge 14 commits into
Conversation
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
force-pushed
the
graph-node-attachment-user-objects
branch
from
July 14, 2026 23:48
d95680d to
d7e8d3e
Compare
Contributor
Author
|
/ok to test |
Andy-Jost
force-pushed
the
graph-node-attachment-user-objects
branch
from
July 15, 2026 00:42
d7e8d3e to
945672d
Compare
|
Contributor
Author
|
/ok to test |
Andy-Jost
force-pushed
the
graph-node-attachment-user-objects
branch
4 times, most recently
from
July 15, 2026 23:10
807cac8 to
6d7ae74
Compare
Andy-Jost
force-pushed
the
graph-node-attachment-user-objects
branch
from
July 17, 2026 23:38
6d7ae74 to
e7391d3
Compare
Contributor
Author
|
/ok to test |
Andy-Jost
force-pushed
the
graph-node-attachment-user-objects
branch
from
July 18, 2026 00:10
e7391d3 to
8babae5
Compare
Preserve the validated lifetime and failure scenarios as executable specifications for the metadata redesign, alongside independent cleanup clarifications.
Establish canonical per-graph boxes, stable hierarchy ownership, and Level 1 graph identity before rebuilding attachment operations.
Give root and child graph handles stable per-graph boxes while sharing one hierarchy control block and registry identity.
Replace the mutable graph-wide slot table with complete per-node user objects and intrusive deferred cleanup.
Copy and rekey source attachment metadata into embedded graph hierarchies before publishing their canonical boxes.
Unregister and tombstone child graph boxes after CUDA destroys their owner while preserving stable storage for existing handles.
Allow graph-level anonymous attachments so a captured host callback stays safe when CUDA commits it but its node cannot be recovered.
Verify anonymous capture retention and proactive invalidation of child and conditional graph views.
Orient contributors to versioned node ownership, graph hierarchy metadata, clone propagation, invalidation, and deferred cleanup.
Make node identity atomic, preserve tombstoned graph identity, retry deferred cleanup safely, and cover final-reference launch ownership.
Document corrected graph attachment lifetime and callback-safe resource release.
Retain attachment owners and preallocate metadata before CUDA graph mutations so failures cannot leave nodes with unretained resources.
Carry rollback through the prepared attachment deleter so consumer extension modules do not depend on an out-of-line C++ symbol.
Contributor
Author
|
/ok to test |
Andy-Jost
force-pushed
the
graph-node-attachment-user-objects
branch
from
July 20, 2026 15:07
8babae5 to
99333eb
Compare
Preserve the general no-invalidation guarantee while documenting borrowed child graphs as a narrow driver-owned exception, and tighten implementation comments for reviewers.
Andy-Jost
marked this pull request as ready for review
July 20, 2026 19:20
Andy-Jost
requested review from
leofang and
mdboom
and removed request for
leofang
July 20, 2026 19:22
Contributor
Author
|
/ok to test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the graph attachment lifetime problem described in #2350. Each resource-bearing node version now has an immutable attachment owned through its own CUDA user object, so source-graph mutation cannot release resources still used by clones, executable graphs, or in-flight launches.
Implementing that ownership change also required cuda-core's metadata to follow CUDA's graph topology and mutation boundaries. Each graph hierarchy keeps root, child, and conditional graph state coherent; clone and embed paths copy and rekey that metadata, and prepare/commit operations publish it only after the corresponding CUDA mutation succeeds. Together, these pieces make cuda-core's bookkeeping match the lifetimes CUDA actually enforces.
Changes
Review guide
cuda_core/cuda/core/_cpp/GRAPH_ATTACHMENTS.mdfor the ownership model, graph hierarchy, common operations, and invariants.resource_handles.cpp/.hppfor per-node user objects, canonical graph boxes, clone metadata import, handle invalidation, and deferred cleanup._resource_handles.*andgraph/*.pyxfor the Cython integration and CUDA-operation ordering.Test coverage
pre-commit run --all-filesRelated Work