pub struct ConcatenatePlan { /* private fields */ }Expand description
A compiled multi-input concatenate traversal.
Each input segment is lowered to a prepared strided copy into the
corresponding destination window. The per-input collections are inline up
to OPERAND_CAP slots (destination plus four
inputs), so a bounded concatenate compiles and executes without touching the
heap; above that bound they spill gracefully. segment_starts carries one
more entry than there are inputs (the input_count + 1 prefix-sum sentinel
whose last entry is the destination total), which is why its bound is the
same operand cap.
Implementations§
Source§impl ConcatenatePlan
impl ConcatenatePlan
Sourcepub fn compile(
input_dims: &[&[usize]],
input_strides: &[&[isize]],
dest_dims: &[usize],
dest_strides: &[isize],
axis: usize,
) -> Result<ConcatenatePlan, StridedError>
pub fn compile( input_dims: &[&[usize]], input_strides: &[&[isize]], dest_dims: &[usize], dest_strides: &[isize], axis: usize, ) -> Result<ConcatenatePlan, StridedError>
Compile a multi-input concatenate plan for fixed input and destination layouts.
§Errors
Returns StridedError::UnsupportedArity when no input is given, and
StridedError::RankMismatch when the dims and strides lists
disagree in length or an input’s rank differs from the first
input’s. Returns StridedError::StrideLengthMismatch when the
destination or an input stride list does not match the rank,
StridedError::InvalidAxis when axis is out of range, and
StridedError::ShapeMismatch when an input disagrees with the first
input off axis or the destination dims are not the concatenated
extents. Returns StridedError::NonInjectiveOutputLayout when two
destination elements map onto one offset or the layout span is not
representable, and
StridedError::OffsetOverflow when a segment total, a segment start
or a destination offset overflows.
Sourcepub fn execute<T>(
&self,
dest: &mut RawStridedMut<'_, T>,
inputs: &[RawStridedRef<'_, T>],
exec: Exec<'_>,
) -> Result<(), StridedError>
pub fn execute<T>( &self, dest: &mut RawStridedMut<'_, T>, inputs: &[RawStridedRef<'_, T>], exec: Exec<'_>, ) -> Result<(), StridedError>
Execute the prepared concatenate traversal.
§Errors
Returns StridedError::PlanLayoutMismatch when the destination or
an input view does not carry its compiled layout,
StridedError::RankMismatch when the number of inputs differs from
the compiled input count, and StridedError::OffsetOverflow when a
segment destination offset overflows.
Sourcepub fn execute_uninit<T>(
&self,
dest: &mut RawStridedMut<'_, MaybeUninit<T>>,
inputs: &[RawStridedRef<'_, T>],
exec: Exec<'_>,
) -> Result<(), StridedError>
pub fn execute_uninit<T>( &self, dest: &mut RawStridedMut<'_, MaybeUninit<T>>, inputs: &[RawStridedRef<'_, T>], exec: Exec<'_>, ) -> Result<(), StridedError>
Execute concatenate into storage whose reachable destination elements are uninitialized.
§Errors
Returns StridedError::PlanLayoutMismatch when the destination or
an input view does not carry its compiled layout,
StridedError::RankMismatch when the number of inputs differs from
the compiled input count, and StridedError::OffsetOverflow when a
segment destination offset overflows.
Trait Implementations§
Source§impl Clone for ConcatenatePlan
impl Clone for ConcatenatePlan
Source§fn clone(&self) -> ConcatenatePlan
fn clone(&self) -> ConcatenatePlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConcatenatePlan
impl RefUnwindSafe for ConcatenatePlan
impl Send for ConcatenatePlan
impl Sync for ConcatenatePlan
impl Unpin for ConcatenatePlan
impl UnsafeUnpin for ConcatenatePlan
impl UnwindSafe for ConcatenatePlan
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