pub trait Kernel: Send {
// Required method
fn step(
&mut self,
ctx: &KernelContext,
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§
Sourcefn step(
&mut self,
ctx: &KernelContext,
out: &mut ViewMut<'_>,
) -> VortexResult<()>
fn step( &mut self, ctx: &KernelContext, out: &mut ViewMut<'_>, ) -> VortexResult<()>
Attempts to perform a single step of the operator, writing data to the output vector.
The output vector is guaranteed to have space for at least N
elements. The kernel
may write up to N
elements to the output vector, and must update the length of the
output vector to reflect the number of elements written.
TODO(ngates): alternatively, we allow the kernel to write sparse output vectors using a Selection enum of Prefix(n), Masked(Mask), or All. This would allow parent kernels to decide when to flatten the vector. The problem is it becomes ambiguous who is responsible for compacting very sparse vectors.