pub struct SlicePlan { /* private fields */ }Expand description
A compiled static-slice traversal.
compile validates the fixed starts/limits/slice_strides contract and
lowers replay to a strided copy from the corresponding source view.
Implementations§
Source§impl SlicePlan
impl SlicePlan
Sourcepub fn compile(
operand_dims: &[usize],
operand_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
starts: &[usize],
limits: &[usize],
slice_strides: &[usize],
) -> Result<Self>
pub fn compile( operand_dims: &[usize], operand_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], starts: &[usize], limits: &[usize], slice_strides: &[usize], ) -> Result<Self>
Compile a static slice plan for one operand layout and destination layout.
§Errors
Returns StridedError::StrideLengthMismatch when the operand or
destination layout lengths differ from the operand rank, and
StridedError::RankMismatch when starts, limits or
slice_strides differ from it. Returns
StridedError::InvalidAxis for a window with start > limit, a
limit beyond the extent, or a zero slice stride, and
StridedError::ShapeMismatch when the destination dims are not the
sliced extents. Returns StridedError::NonInjectiveOutputLayout
when two destination elements map onto one offset or the layout span is
not representable, and
StridedError::OffsetOverflow when an element count, a scaled
source stride, or the source offset delta overflows.
Sourcepub fn execute<T>(
&self,
dest: &mut RawStridedMut<'_, T>,
operand: &RawStridedRef<'_, T>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute<T>( &self, dest: &mut RawStridedMut<'_, T>, operand: &RawStridedRef<'_, T>, exec: Exec<'_>, ) -> Result<()>
Execute the prepared static slice traversal.
§Errors
Returns StridedError::PlanLayoutMismatch when the views do not
carry the compiled operand and destination layouts, and
StridedError::OffsetOverflow when the operand offset plus the
compiled source offset delta overflows.
Sourcepub fn execute_uninit<T>(
&self,
dest: &mut RawStridedMut<'_, MaybeUninit<T>>,
operand: &RawStridedRef<'_, T>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute_uninit<T>( &self, dest: &mut RawStridedMut<'_, MaybeUninit<T>>, operand: &RawStridedRef<'_, T>, exec: Exec<'_>, ) -> Result<()>
Execute into storage whose reachable destination elements are uninitialized.
§Errors
Returns StridedError::PlanLayoutMismatch when the views do not
carry the compiled operand and destination layouts, and
StridedError::OffsetOverflow when the operand offset plus the
compiled source offset delta overflows.