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
contextCudaContextThe context.
loggerILoggerThe logger.
Methods
CalculateOptimalLaunchConfig(KernelArguments)
Calculates optimal launch configuration based on device properties and workload
public CudaLaunchConfig CalculateOptimalLaunchConfig(KernelArguments arguments)
Parameters
argumentsKernelArguments
Returns
GetOptimalConfigFor1D(int, int?)
Gets optimal configuration for a specific workload pattern
public CudaLaunchConfig GetOptimalConfigFor1D(int totalElements, int? preferredBlockSize = null)
Parameters
Returns
GetOptimalConfigFor2D(int, int)
Gets optimal configuration for 2D workloads (e.g., image processing)
public CudaLaunchConfig GetOptimalConfigFor2D(int width, int height)
Parameters
Returns
GetOptimalConfigFor3D(int, int, int)
Gets optimal configuration for 3D workloads
public CudaLaunchConfig GetOptimalConfigFor3D(int width, int height, int depth)
Parameters
Returns
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
functionnintargumentsKernelArgumentsconfigCudaLaunchConfig?cancellationTokenCancellationToken
Returns
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
functionnintargumentsKernelArgumentsconfigCudaLaunchConfig?cancellationTokenCancellationToken
Returns
ValidateLaunchConfig(CudaLaunchConfig)
Validates launch configuration against device limits with Ada-specific checks
public bool ValidateLaunchConfig(CudaLaunchConfig config)
Parameters
configCudaLaunchConfig