pub struct RunSumPlan { /* private fields */ }Expand description
dest[r, ..] (=|+=) Σ_{j in ptr[r]..ptr[r+1]} src[perm[j], ..].
Compiled once for a source layout, a destination layout and a
RunIndex’s row count; replayed with execute_into
or execute_acc.
Implementations§
Source§impl RunSumPlan
impl RunSumPlan
Sourcepub fn compile(
src_dims: &[usize],
src_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
runs: &RunIndex,
) -> Result<Self>
pub fn compile( src_dims: &[usize], src_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], runs: &RunIndex, ) -> Result<Self>
Compile a replay for one source layout, one destination layout and the run count the index describes.
The layout facts a plan can prove without the buffers are proved here;
buffer bounds, alignment and the absence of dest/src overlap are the
caller’s RawStridedRef / RawStridedMut obligations. Allocates the
fused payload traversal; never called from the execute path.
§Errors
Returns StridedError::StrideLengthMismatch when a stride list does not
match its dimension list, StridedError::RankMismatch when the ranks
differ or there is no row axis, StridedError::ShapeMismatch when the
trailing extents differ or the row counts disagree with runs,
StridedError::OffsetOverflow when an element count does not fit
usize, and StridedError::NonInjectiveOutputLayout when the
destination layout cannot be proven injective.
Sourcepub fn execute_into<T>(
&self,
dest: &mut RawStridedMut<'_, T>,
src: &RawStridedRef<'_, T>,
runs: &RunIndex,
exec: Exec<'_>,
) -> Result<()>
pub fn execute_into<T>( &self, dest: &mut RawStridedMut<'_, T>, src: &RawStridedRef<'_, T>, runs: &RunIndex, exec: Exec<'_>, ) -> Result<()>
Execute the overwriting form: dest[r, ..] = Σ over the run, zeros for a
run with no rows. Never reads the previous destination value.
§Errors
Returns StridedError::PlanLayoutMismatch when a view does not carry
its compiled extents and strides, and StridedError::ShapeMismatch
when runs describes a different row or run count than compile was
given.
Sourcepub fn execute_acc<T>(
&self,
dest: &mut RawStridedMut<'_, T>,
src: &RawStridedRef<'_, T>,
runs: &RunIndex,
exec: Exec<'_>,
) -> Result<()>
pub fn execute_acc<T>( &self, dest: &mut RawStridedMut<'_, T>, src: &RawStridedRef<'_, T>, runs: &RunIndex, exec: Exec<'_>, ) -> Result<()>
Execute the accumulating form: dest[r, ..] += Σ over the run, nothing
for a run with no rows.
§Errors
As execute_into.