Table of Contents

Interface IKernelPipelineBuilder

Namespace
DotCompute.Abstractions.Pipelines
Assembly
DotCompute.Abstractions.dll

Simple builder interface for creating compute kernel pipelines

public interface IKernelPipelineBuilder

Methods

AddStage(string, params object[])

Adds a kernel stage to the pipeline

IKernelPipelineBuilder AddStage(string kernelName, params object[] parameters)

Parameters

kernelName string

Name of the kernel to execute

parameters object[]

Parameters for kernel execution

Returns

IKernelPipelineBuilder

The pipeline builder for method chaining

Create()

Creates a pipeline instance from the current builder configuration

object Create()

Returns

object

A pipeline instance that can be executed

ExecuteAsync<T>(T, CancellationToken)

Executes the pipeline with the given input data

Task<T> ExecuteAsync<T>(T input, CancellationToken cancellationToken = default)

Parameters

input T

Input data

cancellationToken CancellationToken

Cancellation token

Returns

Task<T>

Pipeline execution result

Type Parameters

T

Input/output data type

ExecutePipelineAsync<T>(CancellationToken)

Executes the pipeline and returns the specified output type

Task<T> ExecutePipelineAsync<T>(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token

Returns

Task<T>

Pipeline execution result

Type Parameters

T

Output data type

FromData<T>(T[])

Creates a new pipeline starting with input data array (compatibility method)

IKernelPipelineBuilder FromData<T>(T[] inputData) where T : unmanaged

Parameters

inputData T[]

The input data array to process

Returns

IKernelPipelineBuilder

A new pipeline initialized with the input data

Type Parameters

T

The element type of the input data

FromStream<T>(IAsyncEnumerable<T>)

Creates a pipeline starting with an async data stream (compatibility method)

IKernelPipelineBuilder FromStream<T>(IAsyncEnumerable<T> inputStream) where T : unmanaged

Parameters

inputStream IAsyncEnumerable<T>

The async enumerable input stream

Returns

IKernelPipelineBuilder

A new streaming pipeline

Type Parameters

T

The element type of the input stream

Transform<TInput, TOutput>(Func<TInput, TOutput>)

Adds a transformation stage to the pipeline

IKernelPipelineBuilder Transform<TInput, TOutput>(Func<TInput, TOutput> transform)

Parameters

transform Func<TInput, TOutput>

Transformation function

Returns

IKernelPipelineBuilder

The pipeline builder for method chaining

Type Parameters

TInput

Input data type

TOutput

Output data type