Class GraphBuilder
- Namespace
- DotCompute.Backends.OpenCL.Execution
- Assembly
- DotCompute.Backends.OpenCL.dll
Provides a fluent API for building command graphs.
public sealed class GraphBuilder
- Inheritance
-
GraphBuilder
- Inherited Members
Methods
AddBarrier(string)
Adds a synchronization barrier node to the graph.
public GraphBuilder AddBarrier(string name)
Parameters
namestringThe unique name for this node.
Returns
- GraphBuilder
The builder for method chaining.
AddDependency(string, string)
Adds a dependency between two nodes.
public GraphBuilder AddDependency(string fromName, string toName)
Parameters
fromNamestringThe name of the dependent node.
toNamestringThe name of the node that must complete first.
Returns
- GraphBuilder
The builder for method chaining.
Exceptions
- ArgumentException
Thrown when a node is not found.
AddKernelExecution(string, object, ExecutionConfig, object?)
Adds a kernel execution node to the graph.
public GraphBuilder AddKernelExecution(string name, object kernel, ExecutionConfig config, object? defaultArguments = null)
Parameters
namestringThe unique name for this node.
kernelobjectThe compiled kernel to execute.
configExecutionConfigThe execution configuration.
defaultArgumentsobjectOptional default arguments for the kernel.
Returns
- GraphBuilder
The builder for method chaining.
Exceptions
- ArgumentNullException
Thrown when required parameters are null.
- InvalidOperationException
Thrown when a node with the same name exists.
AddMarker(string)
Adds a marker node for timing or debugging purposes.
public GraphBuilder AddMarker(string name)
Parameters
namestringThe unique name for this node.
Returns
- GraphBuilder
The builder for method chaining.
AddMemoryCopy(string, IUnifiedMemoryBuffer, IUnifiedMemoryBuffer)
Adds a memory copy operation node to the graph.
public GraphBuilder AddMemoryCopy(string name, IUnifiedMemoryBuffer source, IUnifiedMemoryBuffer destination)
Parameters
namestringThe unique name for this node.
sourceIUnifiedMemoryBufferThe source buffer.
destinationIUnifiedMemoryBufferThe destination buffer.
Returns
- GraphBuilder
The builder for method chaining.
AddMemoryRead(string, IUnifiedMemoryBuffer)
Adds a memory read operation node to the graph.
public GraphBuilder AddMemoryRead(string name, IUnifiedMemoryBuffer buffer)
Parameters
namestringThe unique name for this node.
bufferIUnifiedMemoryBufferThe buffer to read from.
Returns
- GraphBuilder
The builder for method chaining.
AddMemoryWrite(string, IUnifiedMemoryBuffer, object)
Adds a memory write operation node to the graph.
public GraphBuilder AddMemoryWrite(string name, IUnifiedMemoryBuffer buffer, object data)
Parameters
namestringThe unique name for this node.
bufferIUnifiedMemoryBufferThe buffer to write to.
dataobjectThe data to write.
Returns
- GraphBuilder
The builder for method chaining.
Build()
Builds the final graph from the accumulated nodes and dependencies.
public Graph Build()
Returns
- Graph
A complete graph ready for execution.
Exceptions
- InvalidOperationException
Thrown when the graph is empty.