Interface IComputeOrchestrator
- Namespace
- DotCompute.Abstractions.Interfaces
- Assembly
- DotCompute.Abstractions.dll
Orchestrates kernel execution across multiple compute backends with automatic backend selection. This interface bridges the generated kernel code with the runtime infrastructure.
public interface IComputeOrchestrator
Methods
ExecuteAsync<T>(string, IAccelerator, params object[])
Executes a kernel on a specific accelerator instance.
Task<T> ExecuteAsync<T>(string kernelName, IAccelerator accelerator, params object[] args)
Parameters
kernelNamestringThe fully qualified kernel name
acceleratorIAcceleratorThe specific accelerator to use
argsobject[]The kernel arguments
Returns
- Task<T>
The execution result
Type Parameters
TThe return type
ExecuteAsync<T>(string, params object[])
Executes a kernel by name with automatic backend selection and parameter marshaling.
Task<T> ExecuteAsync<T>(string kernelName, params object[] args)
Parameters
Returns
- Task<T>
The execution result
Type Parameters
TThe return type
ExecuteAsync<T>(string, string, params object[])
Executes a kernel with explicit backend preference.
Task<T> ExecuteAsync<T>(string kernelName, string preferredBackend, params object[] args)
Parameters
kernelNamestringThe fully qualified kernel name
preferredBackendstringThe preferred backend for execution
argsobject[]The kernel arguments
Returns
- Task<T>
The execution result
Type Parameters
TThe return type
ExecuteKernelAsync(string, IKernelExecutionParameters)
Executes a kernel with advanced execution parameters.
Task<object?> ExecuteKernelAsync(string kernelName, IKernelExecutionParameters executionParameters)
Parameters
kernelNamestringThe kernel name
executionParametersIKernelExecutionParametersAdvanced execution parameters
Returns
ExecuteKernelAsync(string, object[], CancellationToken)
Executes a kernel with cancellation token support.
Task<object?> ExecuteKernelAsync(string kernelName, object[] args, CancellationToken cancellationToken = default)
Parameters
kernelNamestringThe kernel name
argsobject[]The kernel arguments
cancellationTokenCancellationTokenCancellation token
Returns
ExecuteWithBuffersAsync<T>(string, IEnumerable<IUnifiedMemoryBuffer>, params object[])
Executes a kernel with unified buffer parameters for zero-copy optimization.
Task<T> ExecuteWithBuffersAsync<T>(string kernelName, IEnumerable<IUnifiedMemoryBuffer> buffers, params object[] scalarArgs)
Parameters
kernelNamestringThe fully qualified kernel name
buffersIEnumerable<IUnifiedMemoryBuffer>Unified buffers for zero-copy execution
scalarArgsobject[]Scalar arguments
Returns
- Task<T>
The execution result
Type Parameters
TThe return type
GetOptimalAcceleratorAsync(string)
Gets the optimal accelerator for a specific kernel.
Task<IAccelerator?> GetOptimalAcceleratorAsync(string kernelName)
Parameters
kernelNamestringThe kernel name
Returns
- Task<IAccelerator>
The optimal accelerator or null if none suitable
GetSupportedAcceleratorsAsync(string)
Gets available accelerators that support a specific kernel.
Task<IReadOnlyList<IAccelerator>> GetSupportedAcceleratorsAsync(string kernelName)
Parameters
kernelNamestringThe kernel name
Returns
- Task<IReadOnlyList<IAccelerator>>
Available accelerators supporting the kernel
PrecompileKernelAsync(string, IAccelerator?)
Pre-compiles a kernel for improved runtime performance.
Task PrecompileKernelAsync(string kernelName, IAccelerator? accelerator = null)
Parameters
kernelNamestringThe kernel name to pre-compile
acceleratorIAcceleratorOptional specific accelerator, or null for all suitable accelerators
Returns
- Task
A task representing the pre-compilation operation
ValidateKernelArgsAsync(string, params object[])
Validates kernel arguments before execution.
Task<bool> ValidateKernelArgsAsync(string kernelName, params object[] args)