Table of Contents

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

name string

The 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

fromName string

The name of the dependent node.

toName string

The 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

name string

The unique name for this node.

kernel object

The compiled kernel to execute.

config ExecutionConfig

The execution configuration.

defaultArguments object

Optional 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

name string

The 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

name string

The unique name for this node.

source IUnifiedMemoryBuffer

The source buffer.

destination IUnifiedMemoryBuffer

The 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

name string

The unique name for this node.

buffer IUnifiedMemoryBuffer

The 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

name string

The unique name for this node.

buffer IUnifiedMemoryBuffer

The buffer to write to.

data object

The 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.