Class KernelArgumentsExtensions
- Namespace
- DotCompute.Core.Extensions
- Assembly
- DotCompute.Core.dll
Extension methods for KernelArguments to support metadata storage. Uses a WeakKeyDictionary approach to avoid memory leaks.
public static class KernelArgumentsExtensions
- Inheritance
-
KernelArgumentsExtensions
- Inherited Members
Methods
GetBlockDimensions(KernelArguments)
Gets block dimensions from the kernel arguments.
public static (int x, int y, int z) GetBlockDimensions(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
GetExecutionOptions(KernelArguments)
Gets execution options from the kernel arguments.
public static KernelExecutionOptions? GetExecutionOptions(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
- KernelExecutionOptions
Execution options or null
GetExecutionStream(KernelArguments)
Gets execution stream from the kernel arguments.
public static object? GetExecutionStream(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
- object
Execution stream or null
GetGlobalWorkSize(KernelArguments)
Gets global work size from the kernel arguments.
public static int[]? GetGlobalWorkSize(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
- int[]
Global work size array or null
GetGridDimensions(KernelArguments)
Gets grid dimensions from the kernel arguments.
public static (int x, int y, int z) GetGridDimensions(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
GetLaunchConfiguration(KernelArguments)
Gets launch configuration from the kernel arguments.
public static object? GetLaunchConfiguration(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
- object
Launch configuration or null
GetLocalWorkSize(KernelArguments)
Gets local work size from the kernel arguments.
public static int[]? GetLocalWorkSize(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
- int[]
Local work size array or null
GetMetadata<T>(KernelArguments, string, T)
Gets metadata from the kernel arguments.
public static T GetMetadata<T>(this KernelArguments arguments, string key, T defaultValue = default)
Parameters
argumentsKernelArgumentsThe kernel arguments
keystringThe metadata key
defaultValueTThe default value to return if key is not found
Returns
- T
The metadata value or default value
Type Parameters
TThe type of the metadata value
GetSharedMemorySize(KernelArguments)
Gets shared memory size from the kernel arguments.
public static int GetSharedMemorySize(this KernelArguments arguments)
Parameters
argumentsKernelArgumentsThe kernel arguments
Returns
- int
Shared memory size in bytes or 0
SetBlockDimensions(KernelArguments, (int x, int y, int z))
Sets block dimensions in the kernel arguments.
public static void SetBlockDimensions(this KernelArguments arguments, (int x, int y, int z) blockDim)
Parameters
SetExecutionOptions(KernelArguments, KernelExecutionOptions)
Sets execution options in the kernel arguments.
public static void SetExecutionOptions(this KernelArguments arguments, KernelExecutionOptions options)
Parameters
argumentsKernelArgumentsThe kernel arguments
optionsKernelExecutionOptionsExecution options
SetExecutionStream(KernelArguments, object)
Sets execution stream in the kernel arguments.
public static void SetExecutionStream(this KernelArguments arguments, object stream)
Parameters
argumentsKernelArgumentsThe kernel arguments
streamobjectExecution stream
SetGlobalWorkSize(KernelArguments, int[])
Sets global work size for OpenCL-style kernels.
public static void SetGlobalWorkSize(this KernelArguments arguments, int[] globalWorkSize)
Parameters
argumentsKernelArgumentsThe kernel arguments
globalWorkSizeint[]Global work size array
SetGridDimensions(KernelArguments, (int x, int y, int z))
Sets grid dimensions in the kernel arguments.
public static void SetGridDimensions(this KernelArguments arguments, (int x, int y, int z) gridDim)
Parameters
SetLaunchConfiguration(KernelArguments, object)
Sets launch configuration in the kernel arguments.
public static void SetLaunchConfiguration(this KernelArguments arguments, object launchConfig)
Parameters
argumentsKernelArgumentsThe kernel arguments
launchConfigobjectLaunch configuration
SetLocalWorkSize(KernelArguments, int[])
Sets local work size for OpenCL-style kernels.
public static void SetLocalWorkSize(this KernelArguments arguments, int[] localWorkSize)
Parameters
argumentsKernelArgumentsThe kernel arguments
localWorkSizeint[]Local work size array
SetMetadata(KernelArguments, string, object?)
Sets metadata for the kernel arguments.
public static void SetMetadata(this KernelArguments arguments, string key, object? value)
Parameters
argumentsKernelArgumentsThe kernel arguments
keystringThe metadata key
valueobjectThe metadata value
SetSharedMemorySize(KernelArguments, int)
Sets shared memory size in the kernel arguments.
public static void SetSharedMemorySize(this KernelArguments arguments, int sharedMemorySize)
Parameters
argumentsKernelArgumentsThe kernel arguments
sharedMemorySizeintShared memory size in bytes