Table of Contents

Class CudaGraphManager

Namespace
DotCompute.Backends.CUDA.Execution.Graph
Assembly
DotCompute.Backends.CUDA.dll

Manages CUDA graph creation, execution, and optimization

public sealed class CudaGraphManager : IDisposable
Inheritance
CudaGraphManager
Implements
Inherited Members
Extension Methods

Constructors

CudaGraphManager(CudaContext, ILogger<CudaGraphManager>)

Manages CUDA graph creation, execution, and optimization

public CudaGraphManager(CudaContext context, ILogger<CudaGraphManager> logger)

Parameters

context CudaContext
logger ILogger<CudaGraphManager>

Methods

AddChildGraphNode(CudaGraph, CudaGraph, CudaGraphNode[]?)

Add child graph node

public CudaGraphNode AddChildGraphNode(CudaGraph parentGraph, CudaGraph childGraph, CudaGraphNode[]? dependencies = null)

Parameters

parentGraph CudaGraph
childGraph CudaGraph
dependencies CudaGraphNode[]

Returns

CudaGraphNode

AddEventRecordNode(CudaGraph, nint, CudaGraphNode[]?)

Add event record node

public CudaGraphNode AddEventRecordNode(CudaGraph graph, nint eventHandle, CudaGraphNode[]? dependencies = null)

Parameters

graph CudaGraph
eventHandle nint
dependencies CudaGraphNode[]

Returns

CudaGraphNode

AddEventWaitNode(CudaGraph, nint, CudaGraphNode[]?)

Add event wait node

public CudaGraphNode AddEventWaitNode(CudaGraph graph, nint eventHandle, CudaGraphNode[]? dependencies = null)

Parameters

graph CudaGraph
eventHandle nint
dependencies CudaGraphNode[]

Returns

CudaGraphNode

AddHostNode(CudaGraph, HostNodeParams, CudaGraphNode[]?)

Add host function callback node

public CudaGraphNode AddHostNode(CudaGraph graph, HostNodeParams nodeParams, CudaGraphNode[]? dependencies = null)

Parameters

graph CudaGraph
nodeParams HostNodeParams
dependencies CudaGraphNode[]

Returns

CudaGraphNode

AddKernelNode(CudaGraph, KernelNodeParams, CudaGraphNode[]?)

Add kernel node to graph

public CudaGraphNode AddKernelNode(CudaGraph graph, KernelNodeParams nodeParams, CudaGraphNode[]? dependencies = null)

Parameters

graph CudaGraph
nodeParams KernelNodeParams
dependencies CudaGraphNode[]

Returns

CudaGraphNode

AddMemcpyNode(CudaGraph, MemcpyNodeParams, CudaGraphNode[]?)

Add memory copy node to graph

public CudaGraphNode AddMemcpyNode(CudaGraph graph, MemcpyNodeParams nodeParams, CudaGraphNode[]? dependencies = null)

Parameters

graph CudaGraph
nodeParams MemcpyNodeParams
dependencies CudaGraphNode[]

Returns

CudaGraphNode

AddMemsetNode(CudaGraph, MemsetNodeParams, CudaGraphNode[]?)

Add memory set node to graph

public CudaGraphNode AddMemsetNode(CudaGraph graph, MemsetNodeParams nodeParams, CudaGraphNode[]? dependencies = null)

Parameters

graph CudaGraph
nodeParams MemsetNodeParams
dependencies CudaGraphNode[]

Returns

CudaGraphNode

BeginCapture(nint, string, CudaGraphCaptureMode)

Begin stream capture to build a graph

public GraphCaptureContext BeginCapture(nint stream, string graphName, CudaGraphCaptureMode mode = CudaGraphCaptureMode.Global)

Parameters

stream nint
graphName string
mode CudaGraphCaptureMode

Returns

GraphCaptureContext

Clone(CudaGraph, string)

Clone an existing graph

public CudaGraph Clone(CudaGraph sourceGraph, string newName)

Parameters

sourceGraph CudaGraph
newName string

Returns

CudaGraph

CreateGraph(string, GraphConfiguration?)

Create a new CUDA graph

public CudaGraph CreateGraph(string name, GraphConfiguration? config = null)

Parameters

name string
config GraphConfiguration

Returns

CudaGraph

DestroyGraph(string)

Destroy graph and free resources

public void DestroyGraph(string graphName)

Parameters

graphName string

Dispose()

Performs dispose.

public void Dispose()

ExportToDot(CudaGraph)

Export graph to DOT format for visualization

public string ExportToDot(CudaGraph graph)

Parameters

graph CudaGraph

Returns

string

GetStatistics(string)

Get graph statistics

public GraphStatistics GetStatistics(string graphName)

Parameters

graphName string

Returns

GraphStatistics

Instantiate(CudaGraph)

Instantiate graph for execution

public CudaGraphExecutable Instantiate(CudaGraph graph)

Parameters

graph CudaGraph

Returns

CudaGraphExecutable

LaunchAsync(CudaGraphExecutable, nint, CancellationToken)

Launch instantiated graph

public Task<GraphExecutionResult> LaunchAsync(CudaGraphExecutable executable, nint stream, CancellationToken cancellationToken = default)

Parameters

executable CudaGraphExecutable
stream nint
cancellationToken CancellationToken

Returns

Task<GraphExecutionResult>

Optimize(CudaGraph, GraphOptimizationOptions)

Optimize graph for execution

public void Optimize(CudaGraph graph, GraphOptimizationOptions options)

Parameters

graph CudaGraph
options GraphOptimizationOptions

TryUpdate(CudaGraphExecutable, CudaGraph)

Update graph executable with new graph definition

public bool TryUpdate(CudaGraphExecutable executable, CudaGraph newGraph)

Parameters

executable CudaGraphExecutable
newGraph CudaGraph

Returns

bool