pub struct SIMDOptimizer { /* private fields */ }Expand description
SIMD operations for optimizer kernels
Implementations§
Source§impl SIMDOptimizer
impl SIMDOptimizer
Sourcepub fn new(config: SIMDConfig) -> Self
pub fn new(config: SIMDConfig) -> Self
Create a new SIMD optimizer with configuration
Sourcepub fn detect_capabilities() -> SIMDConfig
pub fn detect_capabilities() -> SIMDConfig
Detect available SIMD instruction sets
Sourcepub unsafe fn adam_update_avx2(
&self,
params: &mut [f32],
gradients: &[f32],
momentum: &mut [f32],
velocity: &mut [f32],
lr: f32,
beta1: f32,
beta2: f32,
eps: f32,
step: i32,
) -> Result<()>
pub unsafe fn adam_update_avx2( &self, params: &mut [f32], gradients: &[f32], momentum: &mut [f32], velocity: &mut [f32], lr: f32, beta1: f32, beta2: f32, eps: f32, step: i32, ) -> Result<()>
SIMD-optimized Adam update with AVX2
Sourcepub unsafe fn adamw_update_avx2(
&self,
params: &mut [f32],
gradients: &[f32],
momentum: &mut [f32],
velocity: &mut [f32],
lr: f32,
beta1: f32,
beta2: f32,
eps: f32,
weight_decay: f32,
step: i32,
) -> Result<()>
pub unsafe fn adamw_update_avx2( &self, params: &mut [f32], gradients: &[f32], momentum: &mut [f32], velocity: &mut [f32], lr: f32, beta1: f32, beta2: f32, eps: f32, weight_decay: f32, step: i32, ) -> Result<()>
SIMD-optimized AdamW update with AVX2 (decoupled weight decay)
Sourcepub unsafe fn sgd_momentum_update_avx2(
&self,
params: &mut [f32],
gradients: &[f32],
momentum: &mut [f32],
lr: f32,
momentum_factor: f32,
weight_decay: f32,
nesterov: bool,
) -> Result<()>
pub unsafe fn sgd_momentum_update_avx2( &self, params: &mut [f32], gradients: &[f32], momentum: &mut [f32], lr: f32, momentum_factor: f32, weight_decay: f32, nesterov: bool, ) -> Result<()>
SIMD-optimized SGD with momentum update
Sourcepub unsafe fn clip_gradients_avx2(
&self,
gradients: &mut [f32],
max_norm: f32,
) -> Result<f32>
pub unsafe fn clip_gradients_avx2( &self, gradients: &mut [f32], max_norm: f32, ) -> Result<f32>
SIMD-optimized gradient clipping
Sourcepub unsafe fn vector_add_avx2(
&self,
a: &mut [f32],
b: &[f32],
scale: f32,
) -> Result<()>
pub unsafe fn vector_add_avx2( &self, a: &mut [f32], b: &[f32], scale: f32, ) -> Result<()>
SIMD-optimized vector addition (for gradient accumulation)
Sourcepub unsafe fn dot_product_avx2(&self, a: &[f32], b: &[f32]) -> Result<f32>
pub unsafe fn dot_product_avx2(&self, a: &[f32], b: &[f32]) -> Result<f32>
SIMD-optimized dot product
Sourcepub fn adam_update_fallback(
&self,
params: &mut [f32],
gradients: &[f32],
momentum: &mut [f32],
velocity: &mut [f32],
lr: f32,
beta1: f32,
beta2: f32,
eps: f32,
step: i32,
) -> Result<()>
pub fn adam_update_fallback( &self, params: &mut [f32], gradients: &[f32], momentum: &mut [f32], velocity: &mut [f32], lr: f32, beta1: f32, beta2: f32, eps: f32, step: i32, ) -> Result<()>
Fallback implementations for non-x86 architectures
Sourcepub fn adam_update(
&self,
params: &mut [f32],
gradients: &[f32],
momentum: &mut [f32],
velocity: &mut [f32],
lr: f32,
beta1: f32,
beta2: f32,
eps: f32,
step: i32,
) -> Result<()>
pub fn adam_update( &self, params: &mut [f32], gradients: &[f32], momentum: &mut [f32], velocity: &mut [f32], lr: f32, beta1: f32, beta2: f32, eps: f32, step: i32, ) -> Result<()>
Auto-dispatch to best available implementation
Sourcepub fn adamw_update(
&self,
params: &mut [f32],
gradients: &[f32],
momentum: &mut [f32],
velocity: &mut [f32],
lr: f32,
beta1: f32,
beta2: f32,
eps: f32,
weight_decay: f32,
step: i32,
) -> Result<()>
pub fn adamw_update( &self, params: &mut [f32], gradients: &[f32], momentum: &mut [f32], velocity: &mut [f32], lr: f32, beta1: f32, beta2: f32, eps: f32, weight_decay: f32, step: i32, ) -> Result<()>
Auto-dispatch AdamW
Sourcepub fn get_performance_info(&self) -> SIMDPerformanceInfo
pub fn get_performance_info(&self) -> SIMDPerformanceInfo
Get performance statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SIMDOptimizer
impl RefUnwindSafe for SIMDOptimizer
impl Send for SIMDOptimizer
impl Sync for SIMDOptimizer
impl Unpin for SIMDOptimizer
impl UnwindSafe for SIMDOptimizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more