Table of Contents

Class KernelExecutionContext

Namespace
DotCompute.Abstractions.Execution
Assembly
DotCompute.Abstractions.dll

Represents the execution context for a kernel.

public class KernelExecutionContext
Inheritance
KernelExecutionContext
Inherited Members

Properties

AcceleratorId

Gets or sets the target accelerator for execution.

public string? AcceleratorId { get; set; }

Property Value

string

Buffers

Gets or sets the memory buffers for this execution context.

public Dictionary<int, IUnifiedMemoryBuffer<byte>> Buffers { get; }

Property Value

Dictionary<int, IUnifiedMemoryBuffer<byte>>

CompilationInfo

Gets or sets compilation information for the kernel.

public string? CompilationInfo { get; set; }

Property Value

string

EnableDebugMode

Gets or sets a value indicating whether to enable debug mode for this execution.

public bool EnableDebugMode { get; set; }

Property Value

bool

EnableProfiling

Gets or sets a value indicating whether to enable profiling for this execution.

public bool EnableProfiling { get; set; }

Property Value

bool

ExecutionId

Gets or sets the unique identifier for this execution context.

public Guid ExecutionId { get; set; }

Property Value

Guid

KernelName

Gets or sets the name of the kernel being executed.

public string? KernelName { get; set; }

Property Value

string

LocalWorkSize

Gets or sets the local work size for kernel execution.

public Dim3 LocalWorkSize { get; set; }

Property Value

Dim3

MemoryOptimizationLevel

Gets or sets the memory optimization level for this execution.

public MemoryOptimizationLevel MemoryOptimizationLevel { get; set; }

Property Value

MemoryOptimizationLevel

Name

Gets or sets the kernel name (alias for KernelName).

public string? Name { get; set; }

Property Value

string

OptimizationLevel

Gets or sets the optimization level for this execution.

public OptimizationLevel OptimizationLevel { get; set; }

Property Value

OptimizationLevel

Parameters

Gets or sets additional execution parameters.

public Dictionary<string, object> Parameters { get; }

Property Value

Dictionary<string, object>

Scalars

Gets or sets the scalar parameters for this execution context.

public Dictionary<int, object> Scalars { get; }

Property Value

Dictionary<int, object>

TimeoutMilliseconds

Gets or sets the maximum execution time in milliseconds.

public int? TimeoutMilliseconds { get; set; }

Property Value

int?

Timestamp

Gets or sets the timestamp when this context was created.

public DateTime Timestamp { get; set; }

Property Value

DateTime

WorkDimensions

Gets or sets the work dimensions for kernel execution.

public Dim3 WorkDimensions { get; set; }

Property Value

Dim3

Methods

CreateDefault()

Creates a default execution context.

public static KernelExecutionContext CreateDefault()

Returns

KernelExecutionContext

A new instance of KernelExecutionContext with default settings.

GetBuffer(KernelExecutionContext, int)

Gets a buffer parameter by index (static access).

public static IUnifiedMemoryBuffer<byte>? GetBuffer(KernelExecutionContext context, int index)

Parameters

context KernelExecutionContext

The execution context.

index int

The buffer index.

Returns

IUnifiedMemoryBuffer<byte>

The memory buffer.

GetBuffer(int)

Gets a buffer parameter by index.

public IUnifiedMemoryBuffer<byte>? GetBuffer(int index)

Parameters

index int

The buffer index.

Returns

IUnifiedMemoryBuffer<byte>

The memory buffer.

GetScalar<T>(int)

Gets a scalar parameter by index.

public T? GetScalar<T>(int index)

Parameters

index int

The parameter index.

Returns

T

The scalar value.

Type Parameters

T

The scalar type.

SetParameter(int, object)

Sets a parameter value for the kernel execution.

public void SetParameter(int index, object value)

Parameters

index int

The parameter index.

value object

The parameter value.