Table of Contents

Class CudaKernelLauncher

Namespace
DotCompute.Backends.CUDA.Compilation
Assembly
DotCompute.Backends.CUDA.dll

Enhanced CUDA kernel launcher with automatic configuration optimization

public sealed class CudaKernelLauncher
Inheritance
CudaKernelLauncher
Inherited Members

Constructors

CudaKernelLauncher(CudaContext, ILogger)

Initializes a new instance of the CudaKernelLauncher class.

public CudaKernelLauncher(CudaContext context, ILogger logger)

Parameters

context CudaContext

The context.

logger ILogger

The logger.

Methods

CalculateOptimalLaunchConfig(KernelArguments)

Calculates optimal launch configuration based on device properties and workload

public CudaLaunchConfig CalculateOptimalLaunchConfig(KernelArguments arguments)

Parameters

arguments KernelArguments

Returns

CudaLaunchConfig

GetOptimalConfigFor1D(int, int?)

Gets optimal configuration for a specific workload pattern

public CudaLaunchConfig GetOptimalConfigFor1D(int totalElements, int? preferredBlockSize = null)

Parameters

totalElements int
preferredBlockSize int?

Returns

CudaLaunchConfig

GetOptimalConfigFor2D(int, int)

Gets optimal configuration for 2D workloads (e.g., image processing)

public CudaLaunchConfig GetOptimalConfigFor2D(int width, int height)

Parameters

width int
height int

Returns

CudaLaunchConfig

GetOptimalConfigFor3D(int, int, int)

Gets optimal configuration for 3D workloads

public CudaLaunchConfig GetOptimalConfigFor3D(int width, int height, int depth)

Parameters

width int
height int
depth int

Returns

CudaLaunchConfig

LaunchCooperativeKernelAsync(nint, KernelArguments, CudaLaunchConfig?, CancellationToken)

Launches a CUDA cooperative kernel for grid-wide synchronization (CUDA 13.0+)

public Task LaunchCooperativeKernelAsync(nint function, KernelArguments arguments, CudaLaunchConfig? config = null, CancellationToken cancellationToken = default)

Parameters

function nint
arguments KernelArguments
config CudaLaunchConfig?
cancellationToken CancellationToken

Returns

Task

LaunchKernelAsync(nint, KernelArguments, CudaLaunchConfig?, CancellationToken)

Launches a CUDA kernel with automatic configuration optimization

public Task LaunchKernelAsync(nint function, KernelArguments arguments, CudaLaunchConfig? config = null, CancellationToken cancellationToken = default)

Parameters

function nint
arguments KernelArguments
config CudaLaunchConfig?
cancellationToken CancellationToken

Returns

Task

ValidateLaunchConfig(CudaLaunchConfig)

Validates launch configuration against device limits with Ada-specific checks

public bool ValidateLaunchConfig(CudaLaunchConfig config)

Parameters

config CudaLaunchConfig

Returns

bool