pub trait SimdElem<T>: 'static {
type Simd: Copy;
const L: usize;
const MAX: T;
// Required methods
fn splat(v: T) -> Self::Simd;
unsafe fn simd_from_slice(slice: &[T]) -> Self::Simd;
fn simd_lt_bitmask(a: Self::Simd, b: Self::Simd) -> u64;
fn lane_indices() -> Self::Simd;
fn from_usize(n: usize) -> T;
fn wrapping_add_one(t: T) -> T;
unsafe fn partition_fast(
vals: Self::Simd,
threshold: Self::Simd,
v: &mut [T],
v_idx: &mut usize,
w: &mut [T],
w_idx: &mut usize,
);
unsafe fn partition_slow(
vals: Self::Simd,
len: Self::Simd,
threshold: Self::Simd,
v: &mut [T],
v_idx: &mut usize,
w: &mut [T],
w_idx: &mut usize,
);
}Expand description
The SIMD tag (Avx2 or Avx512) must implement SimdElem<T>.
For now, this means you can only use u32, i32, u64, and i64.
A SIMD backend strategy for element type T.
Implemented by Avx2 (8 lanes for 32-bit, 4 lanes for 64-bit) and,
when the avx512 feature is enabled, by Avx512
(16 lanes for 32-bit, 8 lanes for 64-bit).
Required Associated Constants§
Required Associated Types§
Required Methods§
fn splat(v: T) -> Self::Simd
Sourceunsafe fn simd_from_slice(slice: &[T]) -> Self::Simd
unsafe fn simd_from_slice(slice: &[T]) -> Self::Simd
§Safety
slice must have at least L elements accessible (may read past slice.len()).
Sourcefn simd_lt_bitmask(a: Self::Simd, b: Self::Simd) -> u64
fn simd_lt_bitmask(a: Self::Simd, b: Self::Simd) -> u64
Returns bitmask where bit i = a[i] <= b[i].
Sourcefn lane_indices() -> Self::Simd
fn lane_indices() -> Self::Simd
Returns a SIMD register [0, 1, 2, ..., L-1].
fn from_usize(n: usize) -> T
fn wrapping_add_one(t: T) -> T
Sourceunsafe fn partition_fast(
vals: Self::Simd,
threshold: Self::Simd,
v: &mut [T],
v_idx: &mut usize,
w: &mut [T],
w_idx: &mut usize,
)
unsafe fn partition_fast( vals: Self::Simd, threshold: Self::Simd, v: &mut [T], v_idx: &mut usize, w: &mut [T], w_idx: &mut usize, )
Partition all L lanes of vals against threshold.
Lanes >= threshold go to v, lanes < threshold go to w.
§Safety
v and w must have at least L elements of capacity beyond their current write index.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.