pub struct ErasedSlicePlan { /* private fields */ }Expand description
Dtype-erased static-slice wrapper.
Implementations§
Source§impl ErasedSlicePlan
impl ErasedSlicePlan
Sourcepub fn compile(
dtype: KernelDType,
operand_dims: &[usize],
operand_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
starts: &[usize],
limits: &[usize],
slice_strides: &[usize],
) -> Result<Self>
pub fn compile( dtype: KernelDType, operand_dims: &[usize], operand_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], starts: &[usize], limits: &[usize], slice_strides: &[usize], ) -> Result<Self>
Validate and store a static slice plan for one dtype and fixed layout set.
§Errors
Returns StridedError::StrideLengthMismatch when the operand or
destination layout lengths differ from the operand rank,
StridedError::RankMismatch when starts, limits, or
slice_strides differ from it, StridedError::InvalidAxis for a
window with start > limit, a limit beyond the operand extent, or a
zero slice stride, StridedError::ShapeMismatch when dest_dims is
not the sliced extents, StridedError::NonInjectiveOutputLayout
when the destination layout cannot be proven injective, and
StridedError::OffsetOverflow when an element count, a scaled
source stride, or the source offset delta overflows.
pub fn dtype(&self) -> KernelDType
pub fn plan(&self) -> &SlicePlan
Sourcepub fn execute(
&self,
dest: &mut ErasedRawStridedMut<'_>,
operand: &ErasedRawStridedRef<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute( &self, dest: &mut ErasedRawStridedMut<'_>, operand: &ErasedRawStridedRef<'_>, exec: Exec<'_>, ) -> Result<()>
Execute a static slice into an erased output descriptor.
§Errors
Returns StridedError::DTypeMismatch when dest or operand
carries a different dtype than the plan,
StridedError::PlanLayoutMismatch when a view does not carry the
compiled extents and strides, and StridedError::OffsetOverflow
when the operand offset plus the compiled source offset delta
overflows, which an empty operand view whose offset the descriptor
contract does not bound can reach. Nothing is written unless every
check succeeds.
Sourcepub fn execute_uninit(
&self,
dest: &mut ErasedRawStridedUninitMut<'_>,
operand: &ErasedRawStridedPtr<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute_uninit( &self, dest: &mut ErasedRawStridedUninitMut<'_>, operand: &ErasedRawStridedPtr<'_>, exec: Exec<'_>, ) -> Result<()>
Execute a static slice as a full overwrite of uninitialized output storage.
On success, every reachable destination slot is fully overwritten;
unreachable holes are neither read nor initialized. Validation errors
are returned before any destination write. A panic during execution
may leave a partially initialized MaybeUninit destination, which is
still safely droppable; no readable value is promised for unwritten
reachable slots.
§Errors
Returns StridedError::DTypeMismatch when dest or operand
carries a different dtype than the plan,
StridedError::OverlappingInputOutput when the input allocation
overlaps the destination, StridedError::InvalidBoolByte when a
bool input holds a byte other than 0 or 1,
StridedError::PlanLayoutMismatch when a view does not carry the
compiled extents and strides, and StridedError::OffsetOverflow
when the operand offset plus the compiled source offset delta
overflows. Every rejection above is returned before any destination
write.
Trait Implementations§
Source§impl Clone for ErasedSlicePlan
impl Clone for ErasedSlicePlan
Auto Trait Implementations§
impl Freeze for ErasedSlicePlan
impl RefUnwindSafe for ErasedSlicePlan
impl Send for ErasedSlicePlan
impl Sync for ErasedSlicePlan
impl Unpin for ErasedSlicePlan
impl UnsafeUnpin for ErasedSlicePlan
impl UnwindSafe for ErasedSlicePlan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more