cuda.core: expose GraphDefinition cloning
Open
@Andy-Jost is already working on this.
Since Jul 28, 2026.
cuda.core
feature
P0
- Dominant language
- Cython
- Stars
- 3.4k
- Forks
- 329
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 116
Description
Background
CUDA provides cuGraphClone() to create an independent copy of a graph definition and cuGraphNodeFindInClone() to map source nodes to their clones. cuda.core already handles CUDA-created clones internally when embedding child graphs, including copying and rekeying attachment metadata, but GraphDefinition does not expose cloning publicly.
Scope
Add a public cloning API for GraphDefinition, including:
- Clone the underlying
CUgraphwithcuGraphClone(). - Create an independent cuda.core graph hierarchy for the clone.
- Copy and rekey node attachment metadata across the complete hierarchy, including nested child graphs.
- Provide a supported way to map or reconstruct corresponding nodes in the clone.
- Preserve resource ownership and lifetime guarantees without coupling later source and clone mutations.
- Document the API and add release notes.
Acceptance criteria
- A graph definition can be cloned through a public cuda.core API.
- Source and clone can be mutated, instantiated, and destroyed independently.
- Nodes, edges, parameters, child graphs, and supported graph metadata are preserved.
- Attached resources remain alive independently for each graph and are released at the appropriate lifetime boundary.
- Tests cover node mapping, nested child graphs, attachments, mutation isolation, executable behavior, and cleanup.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.