Interface IKernelExecutor
- Namespace
- DotCompute.Abstractions.Interfaces.Kernels
- Assembly
- DotCompute.Abstractions.dll
Interface for executing compiled kernels on accelerators.
public interface IKernelExecutor
Properties
Accelerator
Gets the accelerator this executor targets.
IAccelerator Accelerator { get; }
Property Value
Methods
EnqueueExecution(CompiledKernel, KernelArgument[], KernelExecutionConfig)
Enqueues a kernel for execution without waiting.
KernelExecutionHandle EnqueueExecution(CompiledKernel kernel, KernelArgument[] arguments, KernelExecutionConfig executionConfig)
Parameters
kernelCompiledKernelThe compiled kernel to execute.
argumentsKernelArgument[]The kernel arguments.
executionConfigKernelExecutionConfigThe execution configuration.
Returns
- KernelExecutionHandle
An execution handle to track the operation.
ExecuteAndWaitAsync(CompiledKernel, KernelArgument[], KernelExecutionConfig, CancellationToken)
Executes a kernel and waits for completion.
ValueTask<KernelExecutionResult> ExecuteAndWaitAsync(CompiledKernel kernel, KernelArgument[] arguments, KernelExecutionConfig executionConfig, CancellationToken cancellationToken = default)
Parameters
kernelCompiledKernelThe compiled kernel to execute.
argumentsKernelArgument[]The kernel arguments.
executionConfigKernelExecutionConfigThe execution configuration.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<KernelExecutionResult>
Execution result.
ExecuteAsync(CompiledKernel, KernelArgument[], KernelExecutionConfig, CancellationToken)
Executes a compiled kernel.
ValueTask<KernelExecutionResult> ExecuteAsync(CompiledKernel kernel, KernelArgument[] arguments, KernelExecutionConfig executionConfig, CancellationToken cancellationToken = default)
Parameters
kernelCompiledKernelThe compiled kernel to execute.
argumentsKernelArgument[]The kernel arguments.
executionConfigKernelExecutionConfigThe execution configuration.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<KernelExecutionResult>
Execution result.
GetOptimalExecutionConfig(CompiledKernel, int[])
Gets the optimal execution configuration for a kernel.
KernelExecutionConfig GetOptimalExecutionConfig(CompiledKernel kernel, int[] problemSize)
Parameters
kernelCompiledKernelThe compiled kernel.
problemSizeint[]The problem size.
Returns
- KernelExecutionConfig
Optimal execution configuration.
ProfileAsync(CompiledKernel, KernelArgument[], KernelExecutionConfig, int, CancellationToken)
Profiles kernel execution.
ValueTask<KernelProfilingResult> ProfileAsync(CompiledKernel kernel, KernelArgument[] arguments, KernelExecutionConfig executionConfig, int iterations = 100, CancellationToken cancellationToken = default)
Parameters
kernelCompiledKernelThe compiled kernel to profile.
argumentsKernelArgument[]The kernel arguments.
executionConfigKernelExecutionConfigThe execution configuration.
iterationsintNumber of iterations to run.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<KernelProfilingResult>
Profiling results.
WaitForCompletionAsync(KernelExecutionHandle, CancellationToken)
Waits for a kernel execution to complete.
ValueTask<KernelExecutionResult> WaitForCompletionAsync(KernelExecutionHandle handle, CancellationToken cancellationToken = default)
Parameters
handleKernelExecutionHandleThe execution handle.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<KernelExecutionResult>
Execution result.