Class CudaCompiledKernel
- Namespace
- DotCompute.Backends.CUDA.Compilation
- Assembly
- DotCompute.Backends.CUDA.dll
Represents a compiled CUDA kernel ready for execution
public sealed class CudaCompiledKernel : ICompiledKernel, IAsyncDisposable, IDisposable
- Inheritance
-
CudaCompiledKernel
- Implements
- Inherited Members
- Extension Methods
Constructors
CudaCompiledKernel(CudaContext, string, string, byte[], CompilationOptions?, ILogger)
Initializes a new instance of the CudaCompiledKernel class.
public CudaCompiledKernel(CudaContext context, string name, string entryPoint, byte[] ptxData, CompilationOptions? options, ILogger logger)
Parameters
contextCudaContextThe context.
namestringThe name.
entryPointstringThe entry point.
ptxDatabyte[]The ptx data.
optionsCompilationOptionsThe options.
loggerILoggerThe logger.
Properties
FunctionHandle
Gets the CUDA function handle for this kernel
public nint FunctionHandle { get; }
Property Value
Id
Gets the unique identifier for this compiled kernel
public Guid Id { get; }
Property Value
Name
Gets or sets the name.
public string Name { get; }
Property Value
- string
The name.
Methods
Dispose()
Performs dispose.
public void Dispose()
DisposeAsync()
Gets dispose asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
The result of the operation.
ExecuteAsync(KernelArguments, CancellationToken)
Gets execute asynchronously.
public ValueTask ExecuteAsync(KernelArguments arguments, CancellationToken cancellationToken = default)
Parameters
argumentsKernelArgumentsThe arguments.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- ValueTask
The result of the operation.
ExecuteWithConfigAsync(KernelArguments, CudaLaunchConfig, CancellationToken)
Executes the kernel with custom launch configuration
public ValueTask ExecuteWithConfigAsync(KernelArguments arguments, CudaLaunchConfig config, CancellationToken cancellationToken = default)
Parameters
argumentsKernelArgumentsconfigCudaLaunchConfigcancellationTokenCancellationToken
Returns
FromCompiledKernel(CompiledKernel)
Attempts to retrieve the CudaCompiledKernel from a CompiledKernel struct
public static CudaCompiledKernel? FromCompiledKernel(CompiledKernel kernel)
Parameters
kernelCompiledKernel
Returns
GetOptimalLaunchConfig(int)
Gets optimal launch configuration for the specified problem size
public CudaLaunchConfig GetOptimalLaunchConfig(int totalElements)
Parameters
totalElementsint
Returns
ToCompiledKernel()
Converts this CudaCompiledKernel to a CompiledKernel struct
public CompiledKernel ToCompiledKernel()