pub struct SimdDualTableU32U8Lookup<'a> { /* private fields */ }Expand description
Dual lookup table kernel - u32 to u8 lookup table kernel with custom SIMD function for combining the results. Second lookup table is only looked up if the first lookup table returns a non-zero value. The lookup functions are scalar and other than the SIMD combining function, no SIMD is used - and the code is very simple, so this function is a good fit for non-AVX architectures (like Apple M*) where faster SIMD instructions like VCOMPRESS are not available. OTOH, for Intel/AVX512+ architectures, the [CascadingTableU32U8Lookup] kernel is faster.
The user is responsible for generating the lookup tables - so this can be used for different use cases, including CASE..WHEN and bitmasking/filtering.
Implementations§
Source§impl<'a> SimdDualTableU32U8Lookup<'a>
impl<'a> SimdDualTableU32U8Lookup<'a>
Sourcepub fn new(lookup_table1: &'a [u8], lookup_table2: &'a [u8]) -> Self
pub fn new(lookup_table1: &'a [u8], lookup_table2: &'a [u8]) -> Self
Creates a new dual table lookup kernel with the given lookup tables.
Sourcepub fn lookup_func<F>(&self, values1: &[u32], values2: &[u32], f: &mut F)
pub fn lookup_func<F>(&self, values1: &[u32], values2: &[u32], f: &mut F)
Given two slices of equal length &u32 indices, looks up each one and calls the user given function on assembled u8x16 results.
- lookup_table1 is used for the first slice, lookup_table2 is used for the second slice.
- The user function is passed (lookedup_values1: u8x16, lookedup_values2: u8x16, num_bytes), where num_bytes is 16 other than the last/remainder chunk, where it may be less than that.
- If the slices do not divide evenly into 16-item chunks, the rest is handled by filling missing values in the u8x16 with zeroes. Thus, the lookup assumes the zero is basically a NOP.
Sourcepub fn lookup_into_vec<F>(
&self,
values1: &[u32],
values2: &[u32],
output: &mut Vec<u8>,
f: &mut F,
)
pub fn lookup_into_vec<F>( &self, values1: &[u32], values2: &[u32], output: &mut Vec<u8>, f: &mut F, )
Convenience function which does dual lookup, combines the results using a user-defined combiner function, and extends the combined results into a Vec (pushing all combined results)
The combiner function f takes two u8x16 values (looked up from table1 and table2) and returns a combined u8x16.
Unlike the single table version, this dual table version requires a combiner function.
Trait Implementations§
Source§impl<'a> Clone for SimdDualTableU32U8Lookup<'a>
impl<'a> Clone for SimdDualTableU32U8Lookup<'a>
Source§fn clone(&self) -> SimdDualTableU32U8Lookup<'a>
fn clone(&self) -> SimdDualTableU32U8Lookup<'a>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for SimdDualTableU32U8Lookup<'a>
impl<'a> RefUnwindSafe for SimdDualTableU32U8Lookup<'a>
impl<'a> Send for SimdDualTableU32U8Lookup<'a>
impl<'a> Sync for SimdDualTableU32U8Lookup<'a>
impl<'a> Unpin for SimdDualTableU32U8Lookup<'a>
impl<'a> UnwindSafe for SimdDualTableU32U8Lookup<'a>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)