Skip to content

cuda.core: expose GraphDefinition cloning #2438

Description

@Andy-Jost

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 CUgraph with cuGraphClone().
  • 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.

Activity

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

Metadata

Metadata

Assignees

Labels

P1Medium priority - Should docuda.coreEverything related to the cuda.core modulefeatureNew feature or requesttriageNeeds the team's attention

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions