Table of Contents

Interface IGpuKernel<TIn, TOut>

Namespace
Orleans.GpuBridge.Abstractions.Kernels
Assembly
Orleans.GpuBridge.Abstractions.dll

Core abstraction for GPU kernel execution. Provides Orleans-integrated kernel lifecycle and execution contract.

public interface IGpuKernel<TIn, TOut> : IDisposable

Type Parameters

TIn

Input data type

TOut

Output result type

Inherited Members

Remarks

This abstraction allows consumers to:

  • Use DotCompute directly for full power (advanced users)
  • Use Orleans-integrated facade for standard patterns (GpuGrain)
  • Switch between CPU and GPU backends transparently

Properties

BackendProvider

Backend provider this kernel is running on

string BackendProvider { get; }

Property Value

string

DisplayName

Kernel display name for diagnostics and logging

string DisplayName { get; }

Property Value

string

IsGpuAccelerated

Whether this kernel is GPU-accelerated or CPU fallback

bool IsGpuAccelerated { get; }

Property Value

bool

IsInitialized

Whether this kernel is currently initialized and ready for execution

bool IsInitialized { get; }

Property Value

bool

KernelId

Unique identifier for this kernel instance

string KernelId { get; }

Property Value

string

Methods

ExecuteAsync(TIn, CancellationToken)

Executes the kernel with single input

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

Parameters

input TIn

Input data

cancellationToken CancellationToken

Cancellation token

Returns

Task<TOut>

Kernel execution result

ExecuteBatchAsync(TIn[], CancellationToken)

Executes the kernel with batch input for optimal throughput

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

Parameters

inputs TIn[]

Batch of input data

cancellationToken CancellationToken

Cancellation token

Returns

Task<TOut[]>

Batch of kernel execution results

GetEstimatedExecutionTimeMicroseconds(int)

Gets estimated execution time for given input size

long GetEstimatedExecutionTimeMicroseconds(int inputSize)

Parameters

inputSize int

Size of input data

Returns

long

Estimated execution time in microseconds

GetMemoryRequirements()

Gets memory requirements for this kernel

KernelMemoryRequirements GetMemoryRequirements()

Returns

KernelMemoryRequirements

Memory requirements in bytes

InitializeAsync(CancellationToken)

Initializes the kernel and prepares GPU resources

Task InitializeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token

Returns

Task

Task representing the initialization operation

ValidateInput(TIn)

Validates that input data meets kernel requirements

KernelValidationResult ValidateInput(TIn input)

Parameters

input TIn

Input data to validate

Returns

KernelValidationResult

Validation result with error details if invalid

WarmupAsync(CancellationToken)

Warms up the kernel for optimal performance (JIT compilation, GPU kernel compilation, cache warming)

Task WarmupAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token

Returns

Task

Task representing the warmup operation