#[repr(transparent)]pub struct Bf16(pub u16);Expand description
bfloat16 (E8M7), stored as its raw u16 bit pattern.
Conversions run through the native convert kernel;
PartialEq/PartialOrd are float-semantic (via f32), not bitwise.
Tuple Fields§
§0: u16Implementations§
Source§impl Bf16
impl Bf16
Sourcepub const NEG_INFINITY: Bf16
pub const NEG_INFINITY: Bf16
Negative infinity.
Sourcepub const fn from_bits(bits: u16) -> Bf16
pub const fn from_bits(bits: u16) -> Bf16
Construct from a bfloat16 bit pattern without conversion.
§Examples
let one = eunomia::Bf16::from_bits(0x3F80);
assert_eq!(one.to_f32(), 1.0);Sourcepub const fn to_bits(self) -> u16
pub const fn to_bits(self) -> u16
Return the unchanged bfloat16 bit pattern.
§Examples
let payload = eunomia::Bf16::from_bits(0x7FC5);
assert_eq!(payload.to_bits(), 0x7FC5);Sourcepub fn from_f64(value: f64) -> Bf16
pub fn from_f64(value: f64) -> Bf16
Narrow from f64 via f32 — exact for bfloat16 (f32 exceeds the
2·8 + 2 bits double rounding requires).
Sourcepub fn widen_slice(src: &[Bf16], dst: &mut [f32])
pub fn widen_slice(src: &[Bf16], dst: &mut [f32])
Widen a slice of Bf16 into f32 (a shift — exact). Writes
min(src.len(), dst.len()) elements; the loop autovectorizes.
Sourcepub fn narrow_slice(src: &[f32], dst: &mut [Bf16])
pub fn narrow_slice(src: &[f32], dst: &mut [Bf16])
Narrow a slice of f32 into Bf16, rounding to nearest with ties to
even. Writes min(src.len(), dst.len()) elements; the loop autovectorizes.
Trait Implementations§
Source§impl AddAssign for Bf16
impl AddAssign for Bf16
Source§fn add_assign(&mut self, rhs: Bf16)
fn add_assign(&mut self, rhs: Bf16)
Performs the
+= operation. Read moreSource§impl AmxSupport for Bf16
impl AmxSupport for Bf16
Source§impl Avx512Support for Bf16
impl Avx512Support for Bf16
Source§fn has_avx512() -> bool
fn has_avx512() -> bool
Returns true if the current CPU supports AVX-512 extensions/fallbacks for this type.
impl Copy for Bf16
Source§impl FloatElement for Bf16
impl FloatElement for Bf16
Source§fn signum(self) -> Self
fn signum(self) -> Self
Sign of
self: 1 for positive/+0, -1 for negative/-0, NaN for
NaN (matching f64::signum / num_traits::Float::signum).Source§fn powi(self, n: i32) -> Self
fn powi(self, n: i32) -> Self
self raised to an integer power via exponentiation by squaring. Read moreSource§fn erfc(self) -> Self
fn erfc(self) -> Self
Complementary error function
erfc(self) = 1 - erf(self), computed without
the cancellation error of 1 - erf for large self.Source§fn lgamma(self) -> Self
fn lgamma(self) -> Self
Natural logarithm of the absolute value of the gamma function,
ln|Γ(self)|.Source§fn default_epsilon() -> Selfwhere
Self: RealField,
fn default_epsilon() -> Selfwhere
Self: RealField,
Machine epsilon (
nalgebra::RealField::default_epsilon compatibility alias). Read moreSource§fn pi() -> Selfwhere
Self: RealField,
fn pi() -> Selfwhere
Self: RealField,
Returns
π as this float type (nalgebra compatibility alias for RealField::PI).Source§fn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Componentwise maximum (method form; prefer
NumericElement::max_scalar in new code).Source§impl FmaSupport for Bf16
impl FmaSupport for Bf16
Source§impl MulAssign for Bf16
impl MulAssign for Bf16
Source§fn mul_assign(&mut self, rhs: Bf16)
fn mul_assign(&mut self, rhs: Bf16)
Performs the
*= operation. Read moreSource§impl NumericElement for Bf16
impl NumericElement for Bf16
Source§const MIN_VALUE: Bf16 = Bf16::NEG_INFINITY
const MIN_VALUE: Bf16 = Bf16::NEG_INFINITY
The minimum representable finite value (negative infinity or
i32::MIN). Read moreSource§const MAX_VALUE: Bf16 = Bf16::INFINITY
const MAX_VALUE: Bf16 = Bf16::INFINITY
The maximum representable finite value (positive infinity or
i32::MAX). Read moreSource§const BYTE_WIDTH: usize = 2
const BYTE_WIDTH: usize = 2
Number of bytes per element.
Source§fn sqrt(self) -> Bf16
fn sqrt(self) -> Bf16
Square root. Floats follow IEEE 754 (
NaN for negative inputs); integers
return the exact floor integer square root (isqrt), with negative signed
inputs defined to return 0 (integers have no NaN to signal the domain
error). No f64 round-trip, so the integer result is exact for all operands.Source§fn count_ones(self) -> u32
fn count_ones(self) -> u32
Count set bits (population count).
Source§fn min_scalar(self, other: Self) -> Selfwhere
Self: PartialOrd,
fn min_scalar(self, other: Self) -> Selfwhere
Self: PartialOrd,
Source§fn max_scalar(self, other: Self) -> Selfwhere
Self: PartialOrd,
fn max_scalar(self, other: Self) -> Selfwhere
Self: PartialOrd,
Source§fn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
Saturating addition. Read more
Source§fn saturating_mul(self, rhs: Self) -> Self
fn saturating_mul(self, rhs: Self) -> Self
Saturating multiplication. Read more
Source§fn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
Source§fn checked_mul(self, rhs: Self) -> Option<Self>
fn checked_mul(self, rhs: Self) -> Option<Self>
Source§impl PartialOrd for Bf16
impl PartialOrd for Bf16
impl Pod for Bf16
impl Pod for Bf16
Source§impl RemAssign for Bf16
impl RemAssign for Bf16
Source§fn rem_assign(&mut self, rhs: Bf16)
fn rem_assign(&mut self, rhs: Bf16)
Performs the
%= operation. Read moreSource§impl SimdKernel<Bf16> for Scalar
impl SimdKernel<Bf16> for Scalar
Source§const LANE_COUNT: usize = 8
const LANE_COUNT: usize = 8
Number of primitive elements of type
T in one Vector.Source§const UNROLL_FACTOR: usize = 4
const UNROLL_FACTOR: usize = 4
Loop unrolling register accumulation factor to break loop-carried dependency chains.
Source§type Vector = [Bf16; 8]
type Vector = [Bf16; 8]
The underlying raw register/vector type for this architecture and element type.
Source§unsafe fn load_aligned(ptr: *const Bf16) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn load_aligned(ptr: *const Bf16) -> <Scalar as SimdKernel<Bf16>>::Vector
Load a vector from an aligned pointer. Read more
Source§unsafe fn load_unaligned(
ptr: *const Bf16,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn load_unaligned( ptr: *const Bf16, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Load a vector from an unaligned pointer. Read more
Source§unsafe fn store_aligned(
ptr: *mut Bf16,
val: <Scalar as SimdKernel<Bf16>>::Vector,
)
unsafe fn store_aligned( ptr: *mut Bf16, val: <Scalar as SimdKernel<Bf16>>::Vector, )
Store a vector to an aligned pointer. Read more
Source§unsafe fn store_unaligned(
ptr: *mut Bf16,
val: <Scalar as SimdKernel<Bf16>>::Vector,
)
unsafe fn store_unaligned( ptr: *mut Bf16, val: <Scalar as SimdKernel<Bf16>>::Vector, )
Store a vector to an unaligned pointer. Read more
Source§unsafe fn add(
a: <Scalar as SimdKernel<Bf16>>::Vector,
b: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn add( a: <Scalar as SimdKernel<Bf16>>::Vector, b: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Elementwise addition:
a + b. Read moreSource§unsafe fn mul(
a: <Scalar as SimdKernel<Bf16>>::Vector,
b: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn mul( a: <Scalar as SimdKernel<Bf16>>::Vector, b: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Elementwise multiplication:
a * b. Read moreSource§unsafe fn sub(
a: <Scalar as SimdKernel<Bf16>>::Vector,
b: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn sub( a: <Scalar as SimdKernel<Bf16>>::Vector, b: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Elementwise subtraction:
a - b. Read moreSource§unsafe fn neg(
a: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn neg( a: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Elementwise negate:
-a. Read moreSource§unsafe fn fmadd(
a: <Scalar as SimdKernel<Bf16>>::Vector,
b: <Scalar as SimdKernel<Bf16>>::Vector,
c: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn fmadd( a: <Scalar as SimdKernel<Bf16>>::Vector, b: <Scalar as SimdKernel<Bf16>>::Vector, c: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Fused multiply-add:
(a * b) + c. Read moreSource§unsafe fn sum_reduce(v: <Scalar as SimdKernel<Bf16>>::Vector) -> Bf16
unsafe fn sum_reduce(v: <Scalar as SimdKernel<Bf16>>::Vector) -> Bf16
Horizontal sum of all lanes. Read more
Source§unsafe fn compress(
src: <Scalar as SimdKernel<Bf16>>::Vector,
mask: <Scalar as SimdKernel<Bf16>>::Mask,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn compress( src: <Scalar as SimdKernel<Bf16>>::Vector, mask: <Scalar as SimdKernel<Bf16>>::Mask, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Compress: pack selected lanes (where
mask[i]=1) into the low lanes of the result. Read moreSource§unsafe fn expand(
src: <Scalar as SimdKernel<Bf16>>::Vector,
mask: <Scalar as SimdKernel<Bf16>>::Mask,
fill: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn expand( src: <Scalar as SimdKernel<Bf16>>::Vector, mask: <Scalar as SimdKernel<Bf16>>::Mask, fill: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Source§unsafe fn gather(
base: *const Bf16,
indices: <Scalar as SimdKernel<Bf16>>::IndexVector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn gather( base: *const Bf16, indices: <Scalar as SimdKernel<Bf16>>::IndexVector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Source§unsafe fn gather_masked(
base: *const Bf16,
indices: <Scalar as SimdKernel<Bf16>>::IndexVector,
mask: <Scalar as SimdKernel<Bf16>>::Mask,
src: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn gather_masked( base: *const Bf16, indices: <Scalar as SimdKernel<Bf16>>::IndexVector, mask: <Scalar as SimdKernel<Bf16>>::Mask, src: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Masked gather: gather active lanes; inactive lanes take value from
src. Read moreSource§unsafe fn mask_from_bools(bits: &[bool]) -> <Scalar as SimdKernel<Bf16>>::Mask
unsafe fn mask_from_bools(bits: &[bool]) -> <Scalar as SimdKernel<Bf16>>::Mask
Construct a mask from a slice of booleans (length must equal
LANE_COUNT). Read moreSource§unsafe fn leading_k_mask(k: usize) -> <Scalar as SimdKernel<Bf16>>::Mask
unsafe fn leading_k_mask(k: usize) -> <Scalar as SimdKernel<Bf16>>::Mask
Construct a mask with the first
k lanes active and the rest inactive. Read moreSource§unsafe fn splat(val: Bf16) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn splat(val: Bf16) -> <Scalar as SimdKernel<Bf16>>::Vector
Broadcast a scalar value to all lanes. Read more
Source§unsafe fn mask_to_bitmask(mask: <Scalar as SimdKernel<Bf16>>::Mask) -> u64
unsafe fn mask_to_bitmask(mask: <Scalar as SimdKernel<Bf16>>::Mask) -> u64
Convert the native mask back to a raw
u64 bitmask. Read moreSource§unsafe fn mask_to_vector(
mask: <Scalar as SimdKernel<Bf16>>::Mask,
) -> <Scalar as SimdKernel<Bf16>>::Vector
unsafe fn mask_to_vector( mask: <Scalar as SimdKernel<Bf16>>::Mask, ) -> <Scalar as SimdKernel<Bf16>>::Vector
Convert the native mask back to a vector register where active lanes
are set to
T::ALL_ONES and inactive lanes to T::ZERO. Read moreSource§unsafe fn vector_to_mask(
v: <Scalar as SimdKernel<Bf16>>::Vector,
) -> <Scalar as SimdKernel<Bf16>>::Mask
unsafe fn vector_to_mask( v: <Scalar as SimdKernel<Bf16>>::Vector, ) -> <Scalar as SimdKernel<Bf16>>::Mask
Convert a comparison-result vector into the native mask, the inverse of
SimdKernel::mask_to_vector. Read moreSource§const LANE_BOUND_CHECK: () = _
const LANE_BOUND_CHECK: () = _
Compile-time guard that
LANE_COUNT fits the fixed
MAX_SIMD_LANES scalar-fallback stack buffers. Referencing this const in
the buffer-using default methods forces the assertion to be evaluated for
each concrete backend at monomorphization, turning a would-be silent
stack-buffer overflow into a compile error.Source§const SUPPORTS_NT_STORE: bool = false
const SUPPORTS_NT_STORE: bool = false
Whether this backend provides a non-temporal (cache-bypassing) store
via
store_streaming. Backends leaving this
false keep the regular store default; callers gate the streaming path
on this const so it is a compile-time branch, dead-code-eliminated where
unsupported.Source§unsafe fn store_streaming(ptr: *mut T, val: Self::Vector)
unsafe fn store_streaming(ptr: *mut T, val: Self::Vector)
Store a vector with a non-temporal (streaming) hint that bypasses the
cache, avoiding the read-for-ownership traffic a normal write-allocate
pays for write-only data larger than the last-level cache (measured 1.71×
on out-of-LLC AVX2 f32 elementwise writes; see
streaming_bench). Read moreSource§fn stream_write_barrier()
fn stream_write_barrier()
Fence ordering this backend’s non-temporal stores before subsequent
reads. No-op by default (only meaningful where
store_streaming is a weakly ordered
non-temporal store).Source§unsafe fn masked_load_unaligned(
ptr: *const T,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_load_unaligned( ptr: *const T, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_store_unaligned(
ptr: *mut T,
mask: Self::Mask,
val: Self::Vector,
)
unsafe fn masked_store_unaligned( ptr: *mut T, mask: Self::Mask, val: Self::Vector, )
Masked store: active lanes written to
ptr, inactive lanes left unchanged. Read moreSource§unsafe fn masked_add(
a: Self::Vector,
b: Self::Vector,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_add( a: Self::Vector, b: Self::Vector, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_mul(
a: Self::Vector,
b: Self::Vector,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_mul( a: Self::Vector, b: Self::Vector, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_fmadd(
a: Self::Vector,
b: Self::Vector,
c: Self::Vector,
mask: Self::Mask,
) -> Self::Vector
unsafe fn masked_fmadd( a: Self::Vector, b: Self::Vector, c: Self::Vector, mask: Self::Mask, ) -> Self::Vector
Source§unsafe fn masked_sum_reduce(v: Self::Vector, mask: Self::Mask) -> T
unsafe fn masked_sum_reduce(v: Self::Vector, mask: Self::Mask) -> T
Masked horizontal sum: only lanes where
mask[i]=1 contribute. Read moreSource§unsafe fn mask_from_bitmask(bm: u64) -> Self::Mask
unsafe fn mask_from_bitmask(bm: u64) -> Self::Mask
Convert a raw
u64 bitmask to the architecture-native mask type. Read moreSource§unsafe fn scan_vector<Op, SMode>(v: Self::Vector, carry: T) -> (Self::Vector, T)
unsafe fn scan_vector<Op, SMode>(v: Self::Vector, carry: T) -> (Self::Vector, T)
Perform an intra-vector prefix scan (inclusive or exclusive) of the vector,
using the specified
ScanOp strategy and starting carry value.
Returns the scanned vector and the final carry value. Read moreSource§unsafe fn div(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn div(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise division:
a / b. Read moreSource§unsafe fn bitand(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitand(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise AND:
a & b. Read moreSource§unsafe fn bitor(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitor(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise OR:
a | b. Read moreSource§unsafe fn bitxor(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitxor(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise XOR:
a ^ b. Read moreSource§unsafe fn recip_sqrt(a: Self::Vector) -> Self::Vector
unsafe fn recip_sqrt(a: Self::Vector) -> Self::Vector
Source§unsafe fn cmp_eq(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_eq(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise equal:
a == b. Read moreSource§unsafe fn cmp_ne(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_ne(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise not equal:
a != b. Read moreSource§unsafe fn cmp_lt(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_lt(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise less than:
a < b. Read moreSource§unsafe fn cmp_le(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_le(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise less than or equal:
a <= b. Read moreSource§unsafe fn cmp_gt(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_gt(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise greater than:
a > b. Read moreSource§unsafe fn cmp_ge(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_ge(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise greater than or equal:
a >= b. Read moreSource§unsafe fn blend(
mask: Self::Vector,
true_val: Self::Vector,
false_val: Self::Vector,
) -> Self::Vector
unsafe fn blend( mask: Self::Vector, true_val: Self::Vector, false_val: Self::Vector, ) -> Self::Vector
Elementwise blend: select lanes from
true_val where the sign bit of mask is set,
and from false_val otherwise. Read moreSource§unsafe fn min_reduce(v: Self::Vector) -> T
unsafe fn min_reduce(v: Self::Vector) -> T
Horizontal minimum across all lanes. Read more
Source§unsafe fn max_reduce(v: Self::Vector) -> T
unsafe fn max_reduce(v: Self::Vector) -> T
Horizontal maximum across all lanes. Read more
Source§unsafe fn popcount(a: Self::Vector) -> Self::Vector
unsafe fn popcount(a: Self::Vector) -> Self::Vector
Elementwise population count (number of set bits). Read more
Source§unsafe fn horizontal_bitwise_and(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_and(v: Self::Vector) -> T
Horizontal bitwise AND across all lanes. Read more
Source§unsafe fn horizontal_bitwise_or(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_or(v: Self::Vector) -> T
Horizontal bitwise OR across all lanes. Read more
Source§unsafe fn horizontal_bitwise_xor(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_xor(v: Self::Vector) -> T
Horizontal bitwise XOR across all lanes. Read more
Source§unsafe fn swap_adjacent(v: Self::Vector) -> Self::Vector
unsafe fn swap_adjacent(v: Self::Vector) -> Self::Vector
Swap each adjacent lane pair:
[a0, a1, a2, a3, ...] -> [a1, a0, a3, a2, ...]. Read moreSource§unsafe fn dup_even(v: Self::Vector) -> Self::Vector
unsafe fn dup_even(v: Self::Vector) -> Self::Vector
Duplicate even lanes into odd lanes:
[a0, a1, a2, a3, ...] -> [a0, a0, a2, a2, ...]. Read moreSource§unsafe fn dup_odd(v: Self::Vector) -> Self::Vector
unsafe fn dup_odd(v: Self::Vector) -> Self::Vector
Duplicate odd lanes into even lanes:
[a0, a1, a2, a3, ...] -> [a1, a1, a3, a3, ...]. Read moreSource§impl SimdKernel<Bf16> for Avx2
Available on x86 or x86-64 only.
impl SimdKernel<Bf16> for Avx2
Available on x86 or x86-64 only.
Source§const LANE_COUNT: usize = 16
const LANE_COUNT: usize = 16
Number of primitive elements of type
T in one Vector.Source§const UNROLL_FACTOR: usize = 4
const UNROLL_FACTOR: usize = 4
Loop unrolling register accumulation factor to break loop-carried dependency chains.
Source§type Vector = [Bf16; 16]
type Vector = [Bf16; 16]
The underlying raw register/vector type for this architecture and element type.
Source§unsafe fn load_aligned(ptr: *const Bf16) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn load_aligned(ptr: *const Bf16) -> <Avx2 as SimdKernel<Bf16>>::Vector
Load a vector from an aligned pointer. Read more
Source§unsafe fn load_unaligned(ptr: *const Bf16) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn load_unaligned(ptr: *const Bf16) -> <Avx2 as SimdKernel<Bf16>>::Vector
Load a vector from an unaligned pointer. Read more
Source§unsafe fn store_aligned(ptr: *mut Bf16, val: <Avx2 as SimdKernel<Bf16>>::Vector)
unsafe fn store_aligned(ptr: *mut Bf16, val: <Avx2 as SimdKernel<Bf16>>::Vector)
Store a vector to an aligned pointer. Read more
Source§unsafe fn store_unaligned(
ptr: *mut Bf16,
val: <Avx2 as SimdKernel<Bf16>>::Vector,
)
unsafe fn store_unaligned( ptr: *mut Bf16, val: <Avx2 as SimdKernel<Bf16>>::Vector, )
Store a vector to an unaligned pointer. Read more
Source§unsafe fn add(
a: <Avx2 as SimdKernel<Bf16>>::Vector,
b: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn add( a: <Avx2 as SimdKernel<Bf16>>::Vector, b: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Elementwise addition:
a + b. Read moreSource§unsafe fn mul(
a: <Avx2 as SimdKernel<Bf16>>::Vector,
b: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn mul( a: <Avx2 as SimdKernel<Bf16>>::Vector, b: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Elementwise multiplication:
a * b. Read moreSource§unsafe fn sub(
a: <Avx2 as SimdKernel<Bf16>>::Vector,
b: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn sub( a: <Avx2 as SimdKernel<Bf16>>::Vector, b: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Elementwise subtraction:
a - b. Read moreSource§unsafe fn neg(
a: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn neg( a: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Elementwise negate:
-a. Read moreSource§unsafe fn fmadd(
a: <Avx2 as SimdKernel<Bf16>>::Vector,
b: <Avx2 as SimdKernel<Bf16>>::Vector,
c: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn fmadd( a: <Avx2 as SimdKernel<Bf16>>::Vector, b: <Avx2 as SimdKernel<Bf16>>::Vector, c: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Fused multiply-add:
(a * b) + c. Read moreSource§unsafe fn sum_reduce(v: <Avx2 as SimdKernel<Bf16>>::Vector) -> Bf16
unsafe fn sum_reduce(v: <Avx2 as SimdKernel<Bf16>>::Vector) -> Bf16
Horizontal sum of all lanes. Read more
Source§unsafe fn compress(
src: <Avx2 as SimdKernel<Bf16>>::Vector,
mask: <Avx2 as SimdKernel<Bf16>>::Mask,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn compress( src: <Avx2 as SimdKernel<Bf16>>::Vector, mask: <Avx2 as SimdKernel<Bf16>>::Mask, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Compress: pack selected lanes (where
mask[i]=1) into the low lanes of the result. Read moreSource§unsafe fn expand(
src: <Avx2 as SimdKernel<Bf16>>::Vector,
mask: <Avx2 as SimdKernel<Bf16>>::Mask,
fill: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn expand( src: <Avx2 as SimdKernel<Bf16>>::Vector, mask: <Avx2 as SimdKernel<Bf16>>::Mask, fill: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Source§unsafe fn gather(
base: *const Bf16,
indices: <Avx2 as SimdKernel<Bf16>>::IndexVector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn gather( base: *const Bf16, indices: <Avx2 as SimdKernel<Bf16>>::IndexVector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Source§unsafe fn gather_masked(
base: *const Bf16,
indices: <Avx2 as SimdKernel<Bf16>>::IndexVector,
mask: <Avx2 as SimdKernel<Bf16>>::Mask,
src: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn gather_masked( base: *const Bf16, indices: <Avx2 as SimdKernel<Bf16>>::IndexVector, mask: <Avx2 as SimdKernel<Bf16>>::Mask, src: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Masked gather: gather active lanes; inactive lanes take value from
src. Read moreSource§unsafe fn mask_from_bools(bits: &[bool]) -> <Avx2 as SimdKernel<Bf16>>::Mask
unsafe fn mask_from_bools(bits: &[bool]) -> <Avx2 as SimdKernel<Bf16>>::Mask
Construct a mask from a slice of booleans (length must equal
LANE_COUNT). Read moreSource§unsafe fn leading_k_mask(k: usize) -> <Avx2 as SimdKernel<Bf16>>::Mask
unsafe fn leading_k_mask(k: usize) -> <Avx2 as SimdKernel<Bf16>>::Mask
Construct a mask with the first
k lanes active and the rest inactive. Read moreSource§unsafe fn splat(val: Bf16) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn splat(val: Bf16) -> <Avx2 as SimdKernel<Bf16>>::Vector
Broadcast a scalar value to all lanes. Read more
Source§unsafe fn mask_to_bitmask(mask: <Avx2 as SimdKernel<Bf16>>::Mask) -> u64
unsafe fn mask_to_bitmask(mask: <Avx2 as SimdKernel<Bf16>>::Mask) -> u64
Convert the native mask back to a raw
u64 bitmask. Read moreSource§unsafe fn mask_to_vector(
mask: <Avx2 as SimdKernel<Bf16>>::Mask,
) -> <Avx2 as SimdKernel<Bf16>>::Vector
unsafe fn mask_to_vector( mask: <Avx2 as SimdKernel<Bf16>>::Mask, ) -> <Avx2 as SimdKernel<Bf16>>::Vector
Convert the native mask back to a vector register where active lanes
are set to
T::ALL_ONES and inactive lanes to T::ZERO. Read moreSource§unsafe fn vector_to_mask(
v: <Avx2 as SimdKernel<Bf16>>::Vector,
) -> <Avx2 as SimdKernel<Bf16>>::Mask
unsafe fn vector_to_mask( v: <Avx2 as SimdKernel<Bf16>>::Vector, ) -> <Avx2 as SimdKernel<Bf16>>::Mask
Convert a comparison-result vector into the native mask, the inverse of
SimdKernel::mask_to_vector. Read moreSource§const LANE_BOUND_CHECK: () = _
const LANE_BOUND_CHECK: () = _
Compile-time guard that
LANE_COUNT fits the fixed
MAX_SIMD_LANES scalar-fallback stack buffers. Referencing this const in
the buffer-using default methods forces the assertion to be evaluated for
each concrete backend at monomorphization, turning a would-be silent
stack-buffer overflow into a compile error.Source§const SUPPORTS_NT_STORE: bool = false
const SUPPORTS_NT_STORE: bool = false
Whether this backend provides a non-temporal (cache-bypassing) store
via
store_streaming. Backends leaving this
false keep the regular store default; callers gate the streaming path
on this const so it is a compile-time branch, dead-code-eliminated where
unsupported.Source§unsafe fn store_streaming(ptr: *mut T, val: Self::Vector)
unsafe fn store_streaming(ptr: *mut T, val: Self::Vector)
Store a vector with a non-temporal (streaming) hint that bypasses the
cache, avoiding the read-for-ownership traffic a normal write-allocate
pays for write-only data larger than the last-level cache (measured 1.71×
on out-of-LLC AVX2 f32 elementwise writes; see
streaming_bench). Read moreSource§fn stream_write_barrier()
fn stream_write_barrier()
Fence ordering this backend’s non-temporal stores before subsequent
reads. No-op by default (only meaningful where
store_streaming is a weakly ordered
non-temporal store).Source§unsafe fn masked_load_unaligned(
ptr: *const T,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_load_unaligned( ptr: *const T, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_store_unaligned(
ptr: *mut T,
mask: Self::Mask,
val: Self::Vector,
)
unsafe fn masked_store_unaligned( ptr: *mut T, mask: Self::Mask, val: Self::Vector, )
Masked store: active lanes written to
ptr, inactive lanes left unchanged. Read moreSource§unsafe fn masked_add(
a: Self::Vector,
b: Self::Vector,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_add( a: Self::Vector, b: Self::Vector, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_mul(
a: Self::Vector,
b: Self::Vector,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_mul( a: Self::Vector, b: Self::Vector, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_fmadd(
a: Self::Vector,
b: Self::Vector,
c: Self::Vector,
mask: Self::Mask,
) -> Self::Vector
unsafe fn masked_fmadd( a: Self::Vector, b: Self::Vector, c: Self::Vector, mask: Self::Mask, ) -> Self::Vector
Source§unsafe fn masked_sum_reduce(v: Self::Vector, mask: Self::Mask) -> T
unsafe fn masked_sum_reduce(v: Self::Vector, mask: Self::Mask) -> T
Masked horizontal sum: only lanes where
mask[i]=1 contribute. Read moreSource§unsafe fn mask_from_bitmask(bm: u64) -> Self::Mask
unsafe fn mask_from_bitmask(bm: u64) -> Self::Mask
Convert a raw
u64 bitmask to the architecture-native mask type. Read moreSource§unsafe fn scan_vector<Op, SMode>(v: Self::Vector, carry: T) -> (Self::Vector, T)
unsafe fn scan_vector<Op, SMode>(v: Self::Vector, carry: T) -> (Self::Vector, T)
Perform an intra-vector prefix scan (inclusive or exclusive) of the vector,
using the specified
ScanOp strategy and starting carry value.
Returns the scanned vector and the final carry value. Read moreSource§unsafe fn div(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn div(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise division:
a / b. Read moreSource§unsafe fn bitand(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitand(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise AND:
a & b. Read moreSource§unsafe fn bitor(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitor(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise OR:
a | b. Read moreSource§unsafe fn bitxor(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitxor(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise XOR:
a ^ b. Read moreSource§unsafe fn recip_sqrt(a: Self::Vector) -> Self::Vector
unsafe fn recip_sqrt(a: Self::Vector) -> Self::Vector
Source§unsafe fn cmp_eq(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_eq(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise equal:
a == b. Read moreSource§unsafe fn cmp_ne(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_ne(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise not equal:
a != b. Read moreSource§unsafe fn cmp_lt(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_lt(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise less than:
a < b. Read moreSource§unsafe fn cmp_le(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_le(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise less than or equal:
a <= b. Read moreSource§unsafe fn cmp_gt(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_gt(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise greater than:
a > b. Read moreSource§unsafe fn cmp_ge(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_ge(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise greater than or equal:
a >= b. Read moreSource§unsafe fn blend(
mask: Self::Vector,
true_val: Self::Vector,
false_val: Self::Vector,
) -> Self::Vector
unsafe fn blend( mask: Self::Vector, true_val: Self::Vector, false_val: Self::Vector, ) -> Self::Vector
Elementwise blend: select lanes from
true_val where the sign bit of mask is set,
and from false_val otherwise. Read moreSource§unsafe fn min_reduce(v: Self::Vector) -> T
unsafe fn min_reduce(v: Self::Vector) -> T
Horizontal minimum across all lanes. Read more
Source§unsafe fn max_reduce(v: Self::Vector) -> T
unsafe fn max_reduce(v: Self::Vector) -> T
Horizontal maximum across all lanes. Read more
Source§unsafe fn popcount(a: Self::Vector) -> Self::Vector
unsafe fn popcount(a: Self::Vector) -> Self::Vector
Elementwise population count (number of set bits). Read more
Source§unsafe fn horizontal_bitwise_and(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_and(v: Self::Vector) -> T
Horizontal bitwise AND across all lanes. Read more
Source§unsafe fn horizontal_bitwise_or(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_or(v: Self::Vector) -> T
Horizontal bitwise OR across all lanes. Read more
Source§unsafe fn horizontal_bitwise_xor(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_xor(v: Self::Vector) -> T
Horizontal bitwise XOR across all lanes. Read more
Source§unsafe fn swap_adjacent(v: Self::Vector) -> Self::Vector
unsafe fn swap_adjacent(v: Self::Vector) -> Self::Vector
Swap each adjacent lane pair:
[a0, a1, a2, a3, ...] -> [a1, a0, a3, a2, ...]. Read moreSource§unsafe fn dup_even(v: Self::Vector) -> Self::Vector
unsafe fn dup_even(v: Self::Vector) -> Self::Vector
Duplicate even lanes into odd lanes:
[a0, a1, a2, a3, ...] -> [a0, a0, a2, a2, ...]. Read moreSource§unsafe fn dup_odd(v: Self::Vector) -> Self::Vector
unsafe fn dup_odd(v: Self::Vector) -> Self::Vector
Duplicate odd lanes into even lanes:
[a0, a1, a2, a3, ...] -> [a1, a1, a3, a3, ...]. Read moreSource§impl SimdKernel<Bf16> for Avx512
Available on x86 or x86-64 only.
impl SimdKernel<Bf16> for Avx512
Available on x86 or x86-64 only.
Source§const LANE_COUNT: usize = 32
const LANE_COUNT: usize = 32
Number of primitive elements of type
T in one Vector.Source§const UNROLL_FACTOR: usize = 4
const UNROLL_FACTOR: usize = 4
Loop unrolling register accumulation factor to break loop-carried dependency chains.
Source§type Vector = [Bf16; 32]
type Vector = [Bf16; 32]
The underlying raw register/vector type for this architecture and element type.
Source§unsafe fn load_aligned(ptr: *const Bf16) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn load_aligned(ptr: *const Bf16) -> <Avx512 as SimdKernel<Bf16>>::Vector
Load a vector from an aligned pointer. Read more
Source§unsafe fn load_unaligned(
ptr: *const Bf16,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn load_unaligned( ptr: *const Bf16, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Load a vector from an unaligned pointer. Read more
Source§unsafe fn store_aligned(
ptr: *mut Bf16,
val: <Avx512 as SimdKernel<Bf16>>::Vector,
)
unsafe fn store_aligned( ptr: *mut Bf16, val: <Avx512 as SimdKernel<Bf16>>::Vector, )
Store a vector to an aligned pointer. Read more
Source§unsafe fn store_unaligned(
ptr: *mut Bf16,
val: <Avx512 as SimdKernel<Bf16>>::Vector,
)
unsafe fn store_unaligned( ptr: *mut Bf16, val: <Avx512 as SimdKernel<Bf16>>::Vector, )
Store a vector to an unaligned pointer. Read more
Source§unsafe fn add(
a: <Avx512 as SimdKernel<Bf16>>::Vector,
b: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn add( a: <Avx512 as SimdKernel<Bf16>>::Vector, b: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Elementwise addition:
a + b. Read moreSource§unsafe fn mul(
a: <Avx512 as SimdKernel<Bf16>>::Vector,
b: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn mul( a: <Avx512 as SimdKernel<Bf16>>::Vector, b: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Elementwise multiplication:
a * b. Read moreSource§unsafe fn sub(
a: <Avx512 as SimdKernel<Bf16>>::Vector,
b: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn sub( a: <Avx512 as SimdKernel<Bf16>>::Vector, b: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Elementwise subtraction:
a - b. Read moreSource§unsafe fn neg(
a: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn neg( a: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Elementwise negate:
-a. Read moreSource§unsafe fn fmadd(
a: <Avx512 as SimdKernel<Bf16>>::Vector,
b: <Avx512 as SimdKernel<Bf16>>::Vector,
c: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn fmadd( a: <Avx512 as SimdKernel<Bf16>>::Vector, b: <Avx512 as SimdKernel<Bf16>>::Vector, c: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Fused multiply-add:
(a * b) + c. Read moreSource§unsafe fn sum_reduce(v: <Avx512 as SimdKernel<Bf16>>::Vector) -> Bf16
unsafe fn sum_reduce(v: <Avx512 as SimdKernel<Bf16>>::Vector) -> Bf16
Horizontal sum of all lanes. Read more
Source§unsafe fn compress(
src: <Avx512 as SimdKernel<Bf16>>::Vector,
mask: <Avx512 as SimdKernel<Bf16>>::Mask,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn compress( src: <Avx512 as SimdKernel<Bf16>>::Vector, mask: <Avx512 as SimdKernel<Bf16>>::Mask, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Compress: pack selected lanes (where
mask[i]=1) into the low lanes of the result. Read moreSource§unsafe fn expand(
src: <Avx512 as SimdKernel<Bf16>>::Vector,
mask: <Avx512 as SimdKernel<Bf16>>::Mask,
fill: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn expand( src: <Avx512 as SimdKernel<Bf16>>::Vector, mask: <Avx512 as SimdKernel<Bf16>>::Mask, fill: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Source§unsafe fn gather(
base: *const Bf16,
indices: <Avx512 as SimdKernel<Bf16>>::IndexVector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn gather( base: *const Bf16, indices: <Avx512 as SimdKernel<Bf16>>::IndexVector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Source§unsafe fn gather_masked(
base: *const Bf16,
indices: <Avx512 as SimdKernel<Bf16>>::IndexVector,
mask: <Avx512 as SimdKernel<Bf16>>::Mask,
src: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn gather_masked( base: *const Bf16, indices: <Avx512 as SimdKernel<Bf16>>::IndexVector, mask: <Avx512 as SimdKernel<Bf16>>::Mask, src: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Masked gather: gather active lanes; inactive lanes take value from
src. Read moreSource§unsafe fn mask_from_bools(bits: &[bool]) -> <Avx512 as SimdKernel<Bf16>>::Mask
unsafe fn mask_from_bools(bits: &[bool]) -> <Avx512 as SimdKernel<Bf16>>::Mask
Construct a mask from a slice of booleans (length must equal
LANE_COUNT). Read moreSource§unsafe fn leading_k_mask(k: usize) -> <Avx512 as SimdKernel<Bf16>>::Mask
unsafe fn leading_k_mask(k: usize) -> <Avx512 as SimdKernel<Bf16>>::Mask
Construct a mask with the first
k lanes active and the rest inactive. Read moreSource§unsafe fn splat(val: Bf16) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn splat(val: Bf16) -> <Avx512 as SimdKernel<Bf16>>::Vector
Broadcast a scalar value to all lanes. Read more
Source§unsafe fn mask_to_bitmask(mask: <Avx512 as SimdKernel<Bf16>>::Mask) -> u64
unsafe fn mask_to_bitmask(mask: <Avx512 as SimdKernel<Bf16>>::Mask) -> u64
Convert the native mask back to a raw
u64 bitmask. Read moreSource§unsafe fn mask_to_vector(
mask: <Avx512 as SimdKernel<Bf16>>::Mask,
) -> <Avx512 as SimdKernel<Bf16>>::Vector
unsafe fn mask_to_vector( mask: <Avx512 as SimdKernel<Bf16>>::Mask, ) -> <Avx512 as SimdKernel<Bf16>>::Vector
Convert the native mask back to a vector register where active lanes
are set to
T::ALL_ONES and inactive lanes to T::ZERO. Read moreSource§unsafe fn vector_to_mask(
v: <Avx512 as SimdKernel<Bf16>>::Vector,
) -> <Avx512 as SimdKernel<Bf16>>::Mask
unsafe fn vector_to_mask( v: <Avx512 as SimdKernel<Bf16>>::Vector, ) -> <Avx512 as SimdKernel<Bf16>>::Mask
Convert a comparison-result vector into the native mask, the inverse of
SimdKernel::mask_to_vector. Read moreSource§const LANE_BOUND_CHECK: () = _
const LANE_BOUND_CHECK: () = _
Compile-time guard that
LANE_COUNT fits the fixed
MAX_SIMD_LANES scalar-fallback stack buffers. Referencing this const in
the buffer-using default methods forces the assertion to be evaluated for
each concrete backend at monomorphization, turning a would-be silent
stack-buffer overflow into a compile error.Source§const SUPPORTS_NT_STORE: bool = false
const SUPPORTS_NT_STORE: bool = false
Whether this backend provides a non-temporal (cache-bypassing) store
via
store_streaming. Backends leaving this
false keep the regular store default; callers gate the streaming path
on this const so it is a compile-time branch, dead-code-eliminated where
unsupported.Source§unsafe fn store_streaming(ptr: *mut T, val: Self::Vector)
unsafe fn store_streaming(ptr: *mut T, val: Self::Vector)
Store a vector with a non-temporal (streaming) hint that bypasses the
cache, avoiding the read-for-ownership traffic a normal write-allocate
pays for write-only data larger than the last-level cache (measured 1.71×
on out-of-LLC AVX2 f32 elementwise writes; see
streaming_bench). Read moreSource§fn stream_write_barrier()
fn stream_write_barrier()
Fence ordering this backend’s non-temporal stores before subsequent
reads. No-op by default (only meaningful where
store_streaming is a weakly ordered
non-temporal store).Source§unsafe fn masked_load_unaligned(
ptr: *const T,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_load_unaligned( ptr: *const T, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_store_unaligned(
ptr: *mut T,
mask: Self::Mask,
val: Self::Vector,
)
unsafe fn masked_store_unaligned( ptr: *mut T, mask: Self::Mask, val: Self::Vector, )
Masked store: active lanes written to
ptr, inactive lanes left unchanged. Read moreSource§unsafe fn masked_add(
a: Self::Vector,
b: Self::Vector,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_add( a: Self::Vector, b: Self::Vector, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_mul(
a: Self::Vector,
b: Self::Vector,
mask: Self::Mask,
src: Self::Vector,
) -> Self::Vector
unsafe fn masked_mul( a: Self::Vector, b: Self::Vector, mask: Self::Mask, src: Self::Vector, ) -> Self::Vector
Source§unsafe fn masked_fmadd(
a: Self::Vector,
b: Self::Vector,
c: Self::Vector,
mask: Self::Mask,
) -> Self::Vector
unsafe fn masked_fmadd( a: Self::Vector, b: Self::Vector, c: Self::Vector, mask: Self::Mask, ) -> Self::Vector
Source§unsafe fn masked_sum_reduce(v: Self::Vector, mask: Self::Mask) -> T
unsafe fn masked_sum_reduce(v: Self::Vector, mask: Self::Mask) -> T
Masked horizontal sum: only lanes where
mask[i]=1 contribute. Read moreSource§unsafe fn mask_from_bitmask(bm: u64) -> Self::Mask
unsafe fn mask_from_bitmask(bm: u64) -> Self::Mask
Convert a raw
u64 bitmask to the architecture-native mask type. Read moreSource§unsafe fn scan_vector<Op, SMode>(v: Self::Vector, carry: T) -> (Self::Vector, T)
unsafe fn scan_vector<Op, SMode>(v: Self::Vector, carry: T) -> (Self::Vector, T)
Perform an intra-vector prefix scan (inclusive or exclusive) of the vector,
using the specified
ScanOp strategy and starting carry value.
Returns the scanned vector and the final carry value. Read moreSource§unsafe fn div(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn div(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise division:
a / b. Read moreSource§unsafe fn bitand(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitand(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise AND:
a & b. Read moreSource§unsafe fn bitor(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitor(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise OR:
a | b. Read moreSource§unsafe fn bitxor(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn bitxor(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise bitwise XOR:
a ^ b. Read moreSource§unsafe fn recip_sqrt(a: Self::Vector) -> Self::Vector
unsafe fn recip_sqrt(a: Self::Vector) -> Self::Vector
Source§unsafe fn cmp_eq(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_eq(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise equal:
a == b. Read moreSource§unsafe fn cmp_ne(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_ne(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise not equal:
a != b. Read moreSource§unsafe fn cmp_lt(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_lt(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise less than:
a < b. Read moreSource§unsafe fn cmp_le(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_le(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise less than or equal:
a <= b. Read moreSource§unsafe fn cmp_gt(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_gt(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise greater than:
a > b. Read moreSource§unsafe fn cmp_ge(a: Self::Vector, b: Self::Vector) -> Self::Vector
unsafe fn cmp_ge(a: Self::Vector, b: Self::Vector) -> Self::Vector
Elementwise greater than or equal:
a >= b. Read moreSource§unsafe fn blend(
mask: Self::Vector,
true_val: Self::Vector,
false_val: Self::Vector,
) -> Self::Vector
unsafe fn blend( mask: Self::Vector, true_val: Self::Vector, false_val: Self::Vector, ) -> Self::Vector
Elementwise blend: select lanes from
true_val where the sign bit of mask is set,
and from false_val otherwise. Read moreSource§unsafe fn min_reduce(v: Self::Vector) -> T
unsafe fn min_reduce(v: Self::Vector) -> T
Horizontal minimum across all lanes. Read more
Source§unsafe fn max_reduce(v: Self::Vector) -> T
unsafe fn max_reduce(v: Self::Vector) -> T
Horizontal maximum across all lanes. Read more
Source§unsafe fn popcount(a: Self::Vector) -> Self::Vector
unsafe fn popcount(a: Self::Vector) -> Self::Vector
Elementwise population count (number of set bits). Read more
Source§unsafe fn horizontal_bitwise_and(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_and(v: Self::Vector) -> T
Horizontal bitwise AND across all lanes. Read more
Source§unsafe fn horizontal_bitwise_or(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_or(v: Self::Vector) -> T
Horizontal bitwise OR across all lanes. Read more
Source§unsafe fn horizontal_bitwise_xor(v: Self::Vector) -> T
unsafe fn horizontal_bitwise_xor(v: Self::Vector) -> T
Horizontal bitwise XOR across all lanes. Read more
Source§unsafe fn swap_adjacent(v: Self::Vector) -> Self::Vector
unsafe fn swap_adjacent(v: Self::Vector) -> Self::Vector
Swap each adjacent lane pair:
[a0, a1, a2, a3, ...] -> [a1, a0, a3, a2, ...]. Read moreSource§unsafe fn dup_even(v: Self::Vector) -> Self::Vector
unsafe fn dup_even(v: Self::Vector) -> Self::Vector
Duplicate even lanes into odd lanes:
[a0, a1, a2, a3, ...] -> [a0, a0, a2, a2, ...]. Read moreSource§unsafe fn dup_odd(v: Self::Vector) -> Self::Vector
unsafe fn dup_odd(v: Self::Vector) -> Self::Vector
Duplicate odd lanes into even lanes:
[a0, a1, a2, a3, ...] -> [a1, a1, a3, a3, ...]. Read moreSource§impl SubAssign for Bf16
impl SubAssign for Bf16
Source§fn sub_assign(&mut self, rhs: Bf16)
fn sub_assign(&mut self, rhs: Bf16)
Performs the
-= operation. Read moreSource§impl<Backend, Arch, const M: usize, const N: usize, const K: usize> TileMatrixMultiply<Bf16, Bf16, F32, Backend, Arch, M, N, K> for Scalar
impl<Backend, Arch, const M: usize, const N: usize, const K: usize> TileMatrixMultiply<Bf16, Bf16, F32, Backend, Arch, M, N, K> for Scalar
Source§impl TiledGemm<Bf16, Bf16, F32> for (Bf16, Bf16, F32)
impl TiledGemm<Bf16, Bf16, F32> for (Bf16, Bf16, F32)
Source§impl UnitScalar for Bf16
impl UnitScalar for Bf16
Source§fn scale_by_f64(self, factor: f64) -> Bf16
fn scale_by_f64(self, factor: f64) -> Bf16
Scale this value by a real coefficient in the scalar’s native precision.
Auto Trait Implementations§
impl Freeze for Bf16
impl RefUnwindSafe for Bf16
impl Send for Bf16
impl Sync for Bf16
impl Unpin for Bf16
impl UnsafeUnpin for Bf16
impl UnwindSafe for Bf16
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.impl<T> NoUninit for Twhere
T: Pod,
Source§impl<T> SimdOps for Twhere
T: NumericElement + Sealed,
Scalar: SimdKernel<T>,
Avx2: SimdKernel<T>,
Avx512: SimdKernel<T>,
impl<T> SimdOps for Twhere
T: NumericElement + Sealed,
Scalar: SimdKernel<T>,
Avx2: SimdKernel<T>,
Avx512: SimdKernel<T>,
Source§fn abs_sum(data: &[T]) -> T
fn abs_sum(data: &[T]) -> T
Reduces the slice to
Σ |x| (L1-norm accumulator); T::ZERO for empty.Source§fn abs_max(data: &[T]) -> T
fn abs_max(data: &[T]) -> T
Reduces the slice to
max |x| (∞-norm accumulator); T::ZERO for empty.Source§fn argmin(data: &[T]) -> Option<(usize, T)>
fn argmin(data: &[T]) -> Option<(usize, T)>
Returns
Some((index, value)) of the minimum element, or None for empty.Source§fn argmax(data: &[T]) -> Option<(usize, T)>
fn argmax(data: &[T]) -> Option<(usize, T)>
Returns
Some((index, value)) of the maximum element, or None for empty.Source§fn axpy(alpha: T, x: &[T], out: &mut [T]) -> Result<(), SimdError>
fn axpy(alpha: T, x: &[T], out: &mut [T]) -> Result<(), SimdError>
Fused row update
out[i] += alpha * x[i] (AXPY) with no temporaries.Source§fn axpy_mul(alpha: T, a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
fn axpy_mul(alpha: T, a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
Fused ternary update
out[i] += alpha * a[i] * b[i] with no temporary.Source§fn axpy_rows(
alphas: &[T],
x: &[T],
out: &mut [T],
row_stride: usize,
rows: usize,
cols: usize,
) -> Result<(), SimdError>
fn axpy_rows( alphas: &[T], x: &[T], out: &mut [T], row_stride: usize, rows: usize, cols: usize, ) -> Result<(), SimdError>
Fused multi-row update
out[row, i] += alphas[row] * x[i].Source§fn axpy_rows_batch(
alphas: &[T],
x_panel: &[T],
out: &mut [T],
row_stride: usize,
rows: usize,
depth: usize,
cols: usize,
) -> Result<(), SimdError>
fn axpy_rows_batch( alphas: &[T], x_panel: &[T], out: &mut [T], row_stride: usize, rows: usize, depth: usize, cols: usize, ) -> Result<(), SimdError>
Fused batched multi-row update:
out[row, i] += sum_k alphas[k, row] * x_panel[k, i].Source§fn elementwise_mul(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
fn elementwise_mul(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
Computes the elementwise product and writes to
out.Source§fn elementwise_add(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
fn elementwise_add(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
Computes the elementwise sum
a[i] + b[i] and writes to out.Source§fn elementwise_sub(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
fn elementwise_sub(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
Computes the elementwise difference
a[i] - b[i] and writes to out.Source§fn elementwise_div(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
fn elementwise_div(a: &[T], b: &[T], out: &mut [T]) -> Result<(), SimdError>
Computes the elementwise quotient
a[i] / b[i] and writes to out.Source§fn masked_sum(data: &[T], mask: &[bool]) -> T
fn masked_sum(data: &[T], mask: &[bool]) -> T
Computes the sum of elements matching a boolean mask.
Source§fn masked_dot(a: &[T], b: &[T], mask: &[bool]) -> Result<T, SimdError>
fn masked_dot(a: &[T], b: &[T], mask: &[bool]) -> Result<T, SimdError>
Computes the dot product of elements matching a boolean mask.
Source§fn masked_add(
a: &[T],
b: &[T],
mask: &[bool],
out: &mut [T],
) -> Result<(), SimdError>
fn masked_add( a: &[T], b: &[T], mask: &[bool], out: &mut [T], ) -> Result<(), SimdError>
Computes the elementwise sum of elements matching a boolean mask.
Source§fn spmv_csr(
data: ValidatedData<CsrMatrix<T, &[T], &[i32]>>,
x: &[T],
y: &mut [T],
)
fn spmv_csr( data: ValidatedData<CsrMatrix<T, &[T], &[i32]>>, x: &[T], y: &mut [T], )
Computes sparse SpMV using CSR.
Source§fn spmv_bcoo<const BM: usize, const BN: usize>(
data: ValidatedData<BlockedCooMatrix<T, BM, BN, &[T], &[i32]>>,
x: &[T],
y: &mut [T],
)
fn spmv_bcoo<const BM: usize, const BN: usize>( data: ValidatedData<BlockedCooMatrix<T, BM, BN, &[T], &[i32]>>, x: &[T], y: &mut [T], )
Computes sparse SpMV using const-generic Blocked-COO tiles.
Source§fn spmv_dense_masked(
data: DenseWithMaskMatrix<T, &[T], &[bool]>,
x: &[T],
y: &mut [T],
)
fn spmv_dense_masked( data: DenseWithMaskMatrix<T, &[T], &[bool]>, x: &[T], y: &mut [T], )
Computes sparse SpMV using Dense-with-Mask.
Source§fn spmv_sellp<const C: usize>(
data: ValidatedData<SellPMatrix<T, C, &[T], &[i32]>>,
x: &[T],
y: &mut [T],
)
fn spmv_sellp<const C: usize>( data: ValidatedData<SellPMatrix<T, C, &[T], &[i32]>>, x: &[T], y: &mut [T], )
Computes sparse SpMV using const-generic Sliced ELLPACK (SELL-p).
Source§fn tiled_gemm(
a: &[T],
b: &[T],
c: &mut [T],
m: usize,
n: usize,
k: usize,
) -> Result<(), SimdError>
fn tiled_gemm( a: &[T], b: &[T], c: &mut [T], m: usize, n: usize, k: usize, ) -> Result<(), SimdError>
Computes register-blocked tiled GEMM:
c += A * B.Source§fn gemv(
a: &[T],
x: &[T],
y: &mut [T],
nrows: usize,
ncols: usize,
) -> Result<(), SimdError>
fn gemv( a: &[T], x: &[T], y: &mut [T], nrows: usize, ncols: usize, ) -> Result<(), SimdError>
Computes register-blocked GEMV:
y += A * x (A row-major nrows × ncols).Source§fn gemv_transpose(
a: &[T],
x: &[T],
y: &mut [T],
nrows: usize,
ncols: usize,
) -> Result<(), SimdError>
fn gemv_transpose( a: &[T], x: &[T], y: &mut [T], nrows: usize, ncols: usize, ) -> Result<(), SimdError>
Computes register-blocked transposed GEMV:
y += Aᵀ * x
(A row-major nrows × ncols, x length nrows, y length ncols).Source§fn gemv_strided(
a: &[T],
x: &[T],
y: &mut [T],
nrows: usize,
ncols: usize,
lda: usize,
) -> Result<(), SimdError>
fn gemv_strided( a: &[T], x: &[T], y: &mut [T], nrows: usize, ncols: usize, lda: usize, ) -> Result<(), SimdError>
Computes register-blocked sub-matrix GEMV:
y += A * x with row stride
lda ≥ ncols (lda = ncols is the packed Self::gemv).Source§fn gemv_transpose_strided(
a: &[T],
x: &[T],
y: &mut [T],
nrows: usize,
ncols: usize,
lda: usize,
) -> Result<(), SimdError>
fn gemv_transpose_strided( a: &[T], x: &[T], y: &mut [T], nrows: usize, ncols: usize, lda: usize, ) -> Result<(), SimdError>
Computes register-blocked transposed sub-matrix GEMV:
y += Aᵀ * x with
row stride lda ≥ ncols (lda = ncols is the packed Self::gemv_transpose).Source§fn interleaved_complex_mul_assign<const CONJ_B: bool>(
a: &mut [T],
b: &[T],
) -> Result<(), SimdError>where
T: Neg<Output = T>,
fn interleaved_complex_mul_assign<const CONJ_B: bool>(
a: &mut [T],
b: &[T],
) -> Result<(), SimdError>where
T: Neg<Output = T>,
Multiplies interleaved complex lanes in-place:
a[k] *= b[k]
(a[k] *= conj(b[k]) when CONJ_B).Source§fn interleaved_complex_dot<const CONJ_B: bool>(
a: &[T],
b: &[T],
) -> Result<(T, T), SimdError>where
T: Neg<Output = T>,
fn interleaved_complex_dot<const CONJ_B: bool>(
a: &[T],
b: &[T],
) -> Result<(T, T), SimdError>where
T: Neg<Output = T>,
Computes the interleaved complex dot product
(re, im) of sum(a[k] * b[k])
(sum(a[k] * conj(b[k])) when CONJ_B).Source§fn reduce_popcount(data: &[T]) -> usize
fn reduce_popcount(data: &[T]) -> usize
Computes the horizontal sum of population counts of all elements.
Source§fn reduce_popcount_and(a: &[T], b: &[T]) -> Result<usize, SimdError>
fn reduce_popcount_and(a: &[T], b: &[T]) -> Result<usize, SimdError>
Computes the horizontal sum of population counts of
a[i] & b[i].