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
contextCudaContextloggerILogger<CudaGraphManager>
Methods
AddChildGraphNode(CudaGraph, CudaGraph, CudaGraphNode[]?)
Add child graph node
public CudaGraphNode AddChildGraphNode(CudaGraph parentGraph, CudaGraph childGraph, CudaGraphNode[]? dependencies = null)
Parameters
parentGraphCudaGraphchildGraphCudaGraphdependenciesCudaGraphNode[]
Returns
AddEventRecordNode(CudaGraph, nint, CudaGraphNode[]?)
Add event record node
public CudaGraphNode AddEventRecordNode(CudaGraph graph, nint eventHandle, CudaGraphNode[]? dependencies = null)
Parameters
graphCudaGrapheventHandlenintdependenciesCudaGraphNode[]
Returns
AddEventWaitNode(CudaGraph, nint, CudaGraphNode[]?)
Add event wait node
public CudaGraphNode AddEventWaitNode(CudaGraph graph, nint eventHandle, CudaGraphNode[]? dependencies = null)
Parameters
graphCudaGrapheventHandlenintdependenciesCudaGraphNode[]
Returns
AddHostNode(CudaGraph, HostNodeParams, CudaGraphNode[]?)
Add host function callback node
public CudaGraphNode AddHostNode(CudaGraph graph, HostNodeParams nodeParams, CudaGraphNode[]? dependencies = null)
Parameters
graphCudaGraphnodeParamsHostNodeParamsdependenciesCudaGraphNode[]
Returns
AddKernelNode(CudaGraph, KernelNodeParams, CudaGraphNode[]?)
Add kernel node to graph
public CudaGraphNode AddKernelNode(CudaGraph graph, KernelNodeParams nodeParams, CudaGraphNode[]? dependencies = null)
Parameters
graphCudaGraphnodeParamsKernelNodeParamsdependenciesCudaGraphNode[]
Returns
AddMemcpyNode(CudaGraph, MemcpyNodeParams, CudaGraphNode[]?)
Add memory copy node to graph
public CudaGraphNode AddMemcpyNode(CudaGraph graph, MemcpyNodeParams nodeParams, CudaGraphNode[]? dependencies = null)
Parameters
graphCudaGraphnodeParamsMemcpyNodeParamsdependenciesCudaGraphNode[]
Returns
AddMemsetNode(CudaGraph, MemsetNodeParams, CudaGraphNode[]?)
Add memory set node to graph
public CudaGraphNode AddMemsetNode(CudaGraph graph, MemsetNodeParams nodeParams, CudaGraphNode[]? dependencies = null)
Parameters
graphCudaGraphnodeParamsMemsetNodeParamsdependenciesCudaGraphNode[]
Returns
BeginCapture(nint, string, CudaGraphCaptureMode)
Begin stream capture to build a graph
public GraphCaptureContext BeginCapture(nint stream, string graphName, CudaGraphCaptureMode mode = CudaGraphCaptureMode.Global)
Parameters
streamnintgraphNamestringmodeCudaGraphCaptureMode
Returns
Clone(CudaGraph, string)
Clone an existing graph
public CudaGraph Clone(CudaGraph sourceGraph, string newName)
Parameters
Returns
CreateGraph(string, GraphConfiguration?)
Create a new CUDA graph
public CudaGraph CreateGraph(string name, GraphConfiguration? config = null)
Parameters
namestringconfigGraphConfiguration
Returns
DestroyGraph(string)
Destroy graph and free resources
public void DestroyGraph(string graphName)
Parameters
graphNamestring
Dispose()
Performs dispose.
public void Dispose()
ExportToDot(CudaGraph)
Export graph to DOT format for visualization
public string ExportToDot(CudaGraph graph)
Parameters
graphCudaGraph
Returns
GetStatistics(string)
Get graph statistics
public GraphStatistics GetStatistics(string graphName)
Parameters
graphNamestring
Returns
Instantiate(CudaGraph)
Instantiate graph for execution
public CudaGraphExecutable Instantiate(CudaGraph graph)
Parameters
graphCudaGraph
Returns
LaunchAsync(CudaGraphExecutable, nint, CancellationToken)
Launch instantiated graph
public Task<GraphExecutionResult> LaunchAsync(CudaGraphExecutable executable, nint stream, CancellationToken cancellationToken = default)
Parameters
executableCudaGraphExecutablestreamnintcancellationTokenCancellationToken
Returns
Optimize(CudaGraph, GraphOptimizationOptions)
Optimize graph for execution
public void Optimize(CudaGraph graph, GraphOptimizationOptions options)
Parameters
graphCudaGraphoptionsGraphOptimizationOptions
TryUpdate(CudaGraphExecutable, CudaGraph)
Update graph executable with new graph definition
public bool TryUpdate(CudaGraphExecutable executable, CudaGraph newGraph)
Parameters
executableCudaGraphExecutablenewGraphCudaGraph