Table of Contents

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

context CudaContext

The context.

name string

The name.

entryPoint string

The entry point.

ptxData byte[]

The ptx data.

options CompilationOptions

The options.

logger ILogger

The logger.

Properties

FunctionHandle

Gets the CUDA function handle for this kernel

public nint FunctionHandle { get; }

Property Value

nint

Id

Gets the unique identifier for this compiled kernel

public Guid Id { get; }

Property Value

Guid

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

arguments KernelArguments

The arguments.

cancellationToken CancellationToken

The 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

arguments KernelArguments
config CudaLaunchConfig
cancellationToken CancellationToken

Returns

ValueTask

FromCompiledKernel(CompiledKernel)

Attempts to retrieve the CudaCompiledKernel from a CompiledKernel struct

public static CudaCompiledKernel? FromCompiledKernel(CompiledKernel kernel)

Parameters

kernel CompiledKernel

Returns

CudaCompiledKernel

GetOptimalLaunchConfig(int)

Gets optimal launch configuration for the specified problem size

public CudaLaunchConfig GetOptimalLaunchConfig(int totalElements)

Parameters

totalElements int

Returns

CudaLaunchConfig

ToCompiledKernel()

Converts this CudaCompiledKernel to a CompiledKernel struct

public CompiledKernel ToCompiledKernel()

Returns

CompiledKernel