Kernel

Trait Kernel 

Source
pub trait Kernel: Send {
    // Required method
    fn step(
        &self,
        ctx: &KernelContext,
        chunk_idx: usize,
        selection: &BitView<'_>,
        out: &mut ViewMut<'_>,
    ) -> VortexResult<()>;
}
Expand description

A operator provides a push-based way to emit a stream of canonical data.

By passing multiple vector computations through the same operator, we can amortize the setup costs (such as DType validation, stats short-circuiting, etc.), and to make better use of CPU caches by performing all operations while the data is hot.

Required Methods§

Source

fn step( &self, ctx: &KernelContext, chunk_idx: usize, selection: &BitView<'_>, out: &mut ViewMut<'_>, ) -> VortexResult<()>

Attempts to perform a single step of the operator, writing data to the output vector.

The kernel step should be stateless and is passed the chunk index as well as the selection mask for this chunk.

Input and output vectors have a Selection enum indicating which elements of the vector are valid for processing. This is one of:

  • Full - all N elements are valid.
  • Prefix - the first n elements are valid, where n is the true count of the selection mask.
  • Mask - only the elements indicated by the selection mask are valid.

Kernel should inspect the selection enum of the input and iterate the values accordingly. They may choose to write the output vector in any selection mode, but should choose the most efficient mode possible - not forgetting to update the output vector’s selection enum.

Implementors§

Source§

impl<T: Element + NativePType, Op: CompareOp<T> + Send> Kernel for ComparePrimitiveKernel<T, Op>