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
TInInput data type
TOutOutput 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
DisplayName
Kernel display name for diagnostics and logging
string DisplayName { get; }
Property Value
IsGpuAccelerated
Whether this kernel is GPU-accelerated or CPU fallback
bool IsGpuAccelerated { get; }
Property Value
IsInitialized
Whether this kernel is currently initialized and ready for execution
bool IsInitialized { get; }
Property Value
KernelId
Unique identifier for this kernel instance
string KernelId { get; }
Property Value
Methods
ExecuteAsync(TIn, CancellationToken)
Executes the kernel with single input
Task<TOut> ExecuteAsync(TIn input, CancellationToken cancellationToken = default)
Parameters
inputTInInput data
cancellationTokenCancellationTokenCancellation 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
inputsTIn[]Batch of input data
cancellationTokenCancellationTokenCancellation token
Returns
- Task<TOut[]>
Batch of kernel execution results
GetEstimatedExecutionTimeMicroseconds(int)
Gets estimated execution time for given input size
long GetEstimatedExecutionTimeMicroseconds(int inputSize)
Parameters
inputSizeintSize 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
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Task representing the initialization operation
ValidateInput(TIn)
Validates that input data meets kernel requirements
KernelValidationResult ValidateInput(TIn input)
Parameters
inputTInInput 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
cancellationTokenCancellationTokenCancellation token
Returns
- Task
Task representing the warmup operation