Expand description
GPU-resident optimizer steps executed through scirs2_core::gpu.
Every optimizer here implements crate::GpuOptimizer for f32 and runs a
real compute shader: parameters and gradients are uploaded to device
buffers, a WGSL kernel from crate::shaders::wgsl is dispatched, and the updated
parameters are read back. The per-parameter optimizer state (Adam’s m/v,
SGD’s momentum buffer, …) stays resident in device memory between steps;
crate::GpuOptimizer::move_to_cpu genuinely downloads it and
crate::GpuOptimizer::move_to_gpu genuinely uploads it again.
§Backend support
Only the WebGPU backend (wgpu feature → Vulkan / Metal / DX12) has a
complete compute path in scirs2-core 0.6.x. Constructing an optimizer with
any other backend returns GpuOptimError::UnsupportedOperation rather
than silently computing nothing — in particular the Metal backend registers
empty kernel sources for the optimizer kernels, and CUDA was removed from
scirs2-core in 0.6.x.
§Precision
WGSL compute shaders are f32. The trait is therefore implemented for
f32 only; there is no f64 GPU path and none is faked.
Structs§
- Adagrad
Params - Hyper-parameters for
GpuAdagrad. - Adam
Params - Hyper-parameters shared by
GpuAdamandGpuAdamW. - GpuAdagrad
- GPU Adagrad with learning-rate decay.
- GpuAdam
- GPU Adam with coupled L2 weight decay, numerically matching
optirs_core::optimizers::Adam. - GpuAdamW
- GPU AdamW with decoupled weight decay: the decay term is applied to the parameter and never enters the moment estimates.
- GpuLamb
- GPU LAMB with a real layer-wise trust ratio.
- GpuOptimizer
Config - Configuration shared by every GPU optimizer.
- GpuRmsprop
- GPU RMSprop with optional centering and momentum.
- GpuSgd
- GPU stochastic gradient descent with optional momentum / Nesterov.
- Rmsprop
Params - Hyper-parameters for
GpuRmsprop. - SgdParams
- Hyper-parameters for
GpuSgd.
Constants§
- SUPPORTED_
BACKENDS - Backends that can execute the optimizer kernels, in preference order.