Table of Contents

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

IAccelerator

Methods

EnqueueExecution(CompiledKernel, KernelArgument[], KernelExecutionConfig)

Enqueues a kernel for execution without waiting.

KernelExecutionHandle EnqueueExecution(CompiledKernel kernel, KernelArgument[] arguments, KernelExecutionConfig executionConfig)

Parameters

kernel CompiledKernel

The compiled kernel to execute.

arguments KernelArgument[]

The kernel arguments.

executionConfig KernelExecutionConfig

The 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

kernel CompiledKernel

The compiled kernel to execute.

arguments KernelArgument[]

The kernel arguments.

executionConfig KernelExecutionConfig

The execution configuration.

cancellationToken CancellationToken

Cancellation 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

kernel CompiledKernel

The compiled kernel to execute.

arguments KernelArgument[]

The kernel arguments.

executionConfig KernelExecutionConfig

The execution configuration.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<KernelExecutionResult>

Execution result.

GetOptimalExecutionConfig(CompiledKernel, int[])

Gets the optimal execution configuration for a kernel.

KernelExecutionConfig GetOptimalExecutionConfig(CompiledKernel kernel, int[] problemSize)

Parameters

kernel CompiledKernel

The compiled kernel.

problemSize int[]

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

kernel CompiledKernel

The compiled kernel to profile.

arguments KernelArgument[]

The kernel arguments.

executionConfig KernelExecutionConfig

The execution configuration.

iterations int

Number of iterations to run.

cancellationToken CancellationToken

Cancellation 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

handle KernelExecutionHandle

The execution handle.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<KernelExecutionResult>

Execution result.