Kernel

Trait Kernel 

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

A pipeline kernel is a stateful object that performs steps of a pipeline.

Each step of the kernel processes zero or more input vectors, and writes output to a pre-allocated mutable output vector.

Input vectors will either have length N, indicating that all elements from the step are present. Or they will have length equal to the BitView::true_count of the selection mask, in which case only the selected elements are present.

Output vectors will always be passed with length zero.

Kernels may choose to output either all N elements in their original positions, or output only the selected elements to the first true_count positions of the output vector. When emitting N elements in-place, the kernel may omit expensive computations over the unselected elements, provided that the output elements in those positions are still valid (i.e. typically zeroed, rather than undefined).

The pipeline driver will verify these conditions before and after each step.

Required Methods§

Source

fn step( &mut self, ctx: &KernelCtx, selection: &BitView<'_>, out: &mut VectorMut, ) -> VortexResult<()>

Perform a single step of the kernel.

Implementors§