Skip to main content

SimdKernel

Trait SimdKernel 

Source
pub trait SimdKernel: Send + Sync {
    // Required methods
    fn batch_add(&self, a: &[f64], b: &[f64], out: &mut [f64]);
    fn batch_sub(&self, a: &[f64], b: &[f64], out: &mut [f64]);
    fn batch_mul(&self, a: &[f64], b: &[f64], out: &mut [f64]);
    fn batch_div(&self, a: &[f64], b: &[f64], out: &mut [f64]);
    fn batch_fma(&self, a: &[f64], b: &[f64], c: &[f64], out: &mut [f64]);
    fn batch_sqrt(&self, a: &[f64], out: &mut [f64]);
    fn batch_neg(&self, a: &[f64], out: &mut [f64]);
    fn batch_abs(&self, a: &[f64], out: &mut [f64]);
    fn name(&self) -> &'static str;
}
Expand description

Batch arithmetic operations, abstracted over SIMD width and ISA.

Implementations must be Send + Sync so the global singleton is safe across thread boundaries. Each method operates element-wise over equal- length slices; callers guarantee slice lengths match.

Required Methods§

Source

fn batch_add(&self, a: &[f64], b: &[f64], out: &mut [f64])

Element-wise addition: out[i] = a[i] + b[i].

Source

fn batch_sub(&self, a: &[f64], b: &[f64], out: &mut [f64])

Element-wise subtraction: out[i] = a[i] - b[i].

Source

fn batch_mul(&self, a: &[f64], b: &[f64], out: &mut [f64])

Element-wise multiplication: out[i] = a[i] * b[i].

Source

fn batch_div(&self, a: &[f64], b: &[f64], out: &mut [f64])

Element-wise division: out[i] = a[i] / b[i].

Source

fn batch_fma(&self, a: &[f64], b: &[f64], c: &[f64], out: &mut [f64])

Fused multiply-add: out[i] = a[i] * b[i] + c[i].

Source

fn batch_sqrt(&self, a: &[f64], out: &mut [f64])

Element-wise square root: out[i] = sqrt(a[i]).

Source

fn batch_neg(&self, a: &[f64], out: &mut [f64])

Element-wise negation: out[i] = -a[i].

Source

fn batch_abs(&self, a: &[f64], out: &mut [f64])

Element-wise absolute value: out[i] = |a[i]|.

Source

fn name(&self) -> &'static str

Short name for logging/introspection.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SimdKernel for Avx2Kernel

Available on x86-64 only.
Source§

impl SimdKernel for ScalarKernel