Table of Contents

Class DotComputeKernel<TIn, TOut>

Namespace
Orleans.GpuBridge.Backends.DotCompute
Assembly
Orleans.GpuBridge.Backends.DotCompute.dll

DotCompute kernel adapter that wraps IAccelerator and ICompiledKernel. Provides Orleans.GpuBridge integration for DotCompute kernels.

public sealed class DotComputeKernel<TIn, TOut> : GpuKernelBase<TIn, TOut>, IGpuKernel<TIn, TOut>, IDisposable

Type Parameters

TIn

Input type for kernel execution

TOut

Output type for kernel execution

Inheritance
GpuKernelBase<TIn, TOut>
DotComputeKernel<TIn, TOut>
Implements
IGpuKernel<TIn, TOut>
Inherited Members

Constructors

DotComputeKernel(IAccelerator, KernelDefinition, CompilationOptions?, Func<TIn, KernelArgument[]>?, Func<IUnifiedMemoryBuffer, TOut>?)

Creates a new DotCompute kernel adapter.

public DotComputeKernel(IAccelerator accelerator, KernelDefinition kernelDefinition, CompilationOptions? compilationOptions = null, Func<TIn, KernelArgument[]>? inputConverter = null, Func<IUnifiedMemoryBuffer, TOut>? outputConverter = null)

Parameters

accelerator IAccelerator

DotCompute accelerator instance

kernelDefinition KernelDefinition

Kernel definition with source code

compilationOptions CompilationOptions

Compilation options (null = default)

inputConverter Func<TIn, KernelArgument[]>

Function to convert TIn to KernelArgument[]

outputConverter Func<IUnifiedMemoryBuffer, TOut>

Function to convert GPU buffer to TOut

Properties

BackendProvider

Backend provider name

public override string BackendProvider { get; }

Property Value

string

IsGpuAccelerated

Whether kernel uses GPU acceleration (true for non-CPU accelerators)

public override bool IsGpuAccelerated { get; }

Property Value

bool

KernelId

Unique kernel identifier

public override string KernelId { get; }

Property Value

string

Methods

Dispose()

Dispose kernel resources and free GPU memory.

public override void Dispose()

ExecuteAsync(TIn, CancellationToken)

Execute kernel with single input.

public override Task<TOut> ExecuteAsync(TIn input, CancellationToken cancellationToken = default)

Parameters

input TIn
cancellationToken CancellationToken

Returns

Task<TOut>

ExecuteBatchAsync(TIn[], CancellationToken)

Execute kernel with batch input (optimized for GPU).

public override Task<TOut[]> ExecuteBatchAsync(TIn[] inputs, CancellationToken cancellationToken = default)

Parameters

inputs TIn[]
cancellationToken CancellationToken

Returns

Task<TOut[]>

GetEstimatedExecutionTimeMicroseconds(int)

Get estimated execution time for input size. Uses GPU timing provider if available for accurate profiling.

public override long GetEstimatedExecutionTimeMicroseconds(int inputSize)

Parameters

inputSize int

Returns

long

Remarks

Execution time estimation strategy: 1. If ITimingProvider is available, use timer resolution for accuracy bounds 2. Use empirical measurements from past executions (if available) 3. Fall back to heuristic based on accelerator type and input size

Heuristics are based on typical memory-bound kernel performance: - GPU: ~0.1μs per element (high bandwidth, parallel execution) - CPU: ~1μs per element (sequential or limited parallelism)

GetMemoryRequirements()

Get memory requirements for kernel execution.

public override KernelMemoryRequirements GetMemoryRequirements()

Returns

KernelMemoryRequirements

InitializeAsync(CancellationToken)

Initialize kernel by compiling to GPU code.

public override Task InitializeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

WarmupAsync(CancellationToken)

Warmup kernel for optimal performance (JIT compilation, cache warming).

public override Task WarmupAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task