Skip to main content

Module gpu_kernels

Module gpu_kernels 

Source
Expand description

GPU kernel implementations for batch special-function evaluation.

This module houses compute-shader sources and host-side dispatch stubs for two GPU backends:

Sub-moduleBackendFeature flagDefault
wgslWebGPU (WGSL shaders)gpu via scirs2-core/gpuoff
cudaCUDA / ROCmcuda_kernelsoff

Both backends currently provide stub implementations that return “not available” errors. The actual dispatch logic lives in crate::gpu_dispatch which calls these stubs under DispatchTarget::Gpu and falls back to the CPU rayon path automatically.

§Pure Rust policy

The cuda_kernels feature is off by default. CUDA depends on C dynamic libraries (libcuda.so, libcudart.so) which violate the Pure Rust Policy unless feature-gated. WebGPU is Pure Rust (via wgpu) but the host-side integration with scirs2-core/gpu is not yet stabilised.

Modules§

cuda
CUDA/ROCm kernel dispatch stubs for batch special-function evaluation.
wgsl
WGSL compute-shader kernels for WebGPU-backed dispatch of batch special functions.

Enums§

CudaDispatchError
Error type for CUDA/ROCm dispatch.
WgslDispatchError
Error type for WGSL/WebGPU dispatch.

Constants§

BESSEL_J0_PTX_STUB
Inline PTX stub for batch Bessel J₀ evaluation.
BESSEL_J0_WGSL
WGSL compute shader for batch Bessel J₀ evaluation.
ERFC_WGSL
WGSL compute shader for batch erfc evaluation.
ERFINV_WGSL
WGSL compute shader for batch inverse-erf evaluation.
ERF_PTX_STUB
Inline PTX stub for batch erf evaluation.
ERF_WGSL
WGSL compute shader for batch erf evaluation.
GAMMA_PTX_STUB
Inline PTX stub for batch Gamma evaluation on CUDA devices.
GAMMA_WGSL
WGSL compute shader for batch Gamma evaluation (Lanczos g=7 approximation).
LGAMMA_WGSL
WGSL compute shader for batch log-gamma evaluation.

Functions§

bessel_j0_batch_cuda
Attempt batch Bessel J₀ evaluation on a CUDA device.
bessel_j0_batch_wgpu
Stub: returns WgslDispatchError::GpuNotAvailable when wgpu_kernels is off.
erf_batch_cuda
Attempt batch erf evaluation on a CUDA device.
erf_batch_wgpu
Stub: returns WgslDispatchError::GpuNotAvailable when wgpu_kernels is off.
erfc_batch_wgpu
Stub: returns WgslDispatchError::GpuNotAvailable when wgpu_kernels is off.
erfinv_batch_wgpu
Stub: returns WgslDispatchError::GpuNotAvailable when wgpu_kernels is off.
gamma_batch_cuda
Attempt batch Gamma evaluation on a CUDA device.
gamma_batch_wgpu
Stub: returns WgslDispatchError::GpuNotAvailable when wgpu_kernels is off.
lgamma_batch_wgpu
Stub: returns WgslDispatchError::GpuNotAvailable when wgpu_kernels is off.