pub struct ErasedGatherPlan { /* private fields */ }Expand description
Dtype-erased gather wrapper.
This is the erased replay boundary for indexed reads. Value buffers use the
configured value dtype, while the index descriptor must use i32 or i64.
Implementations§
Source§impl ErasedGatherPlan
impl ErasedGatherPlan
Sourcepub fn compile(
dtype: KernelDType,
index_dtype: KernelDType,
operand_dims: &[usize],
operand_strides: &[isize],
index_dims: &[usize],
index_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
spec: GatherSpec,
) -> Result<Self>
pub fn compile( dtype: KernelDType, index_dtype: KernelDType, operand_dims: &[usize], operand_strides: &[isize], index_dims: &[usize], index_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], spec: GatherSpec, ) -> Result<Self>
Validate and store a gather plan for one value dtype, index dtype, and layout set.
§Errors
Returns StridedError::UnsupportedDType when index_dtype is not
i32/i64, StridedError::StrideLengthMismatch when a stride list
does not match its dimension list, StridedError::OffsetOverflow
when an element count or a layout span does not fit usize/isize,
StridedError::NonInjectiveOutputLayout when the destination layout
cannot be proven injective, StridedError::RankMismatch when
spec.slice_sizes or spec.offset_dims has the wrong length or an
index vector does not match spec.start_index_map,
StridedError::InvalidAxis for a listed axis outside its rank, a
repeating axis, an index_vector_dim beyond the index rank, a slice
size beyond its operand extent, or a collapsed axis whose slice size
is not one, and StridedError::ShapeMismatch when dest_dims is
not the gathered window/batch shape.
pub fn dtype(&self) -> KernelDType
pub fn index_dtype(&self) -> KernelDType
pub fn plan(&self) -> &GatherPlan
Sourcepub fn execute(
&self,
dest: &mut ErasedRawStridedMut<'_>,
operand: &ErasedRawStridedRef<'_>,
start_indices: &ErasedRawStridedRef<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute( &self, dest: &mut ErasedRawStridedMut<'_>, operand: &ErasedRawStridedRef<'_>, start_indices: &ErasedRawStridedRef<'_>, exec: Exec<'_>, ) -> Result<()>
Execute an indexed read into an erased output descriptor.
§Errors
Returns StridedError::DTypeMismatch when dest, operand, or
start_indices does not carry its compiled dtype,
StridedError::PlanLayoutMismatch when a view does not carry its
compiled extents and strides, and StridedError::OffsetOverflow
when a replayed chunk’s offset arithmetic cannot be represented. Start
indices are clamped into the operand window, so an out-of-range index
is not an error. The dtype and layout checks precede every write, but
the offset arithmetic runs per worker, so a destination split across
workers may be partially written when that error surfaces.
Sourcepub fn execute_uninit(
&self,
dest: &mut ErasedRawStridedUninitMut<'_>,
operand: &ErasedRawStridedPtr<'_>,
start_indices: &ErasedRawStridedPtr<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute_uninit( &self, dest: &mut ErasedRawStridedUninitMut<'_>, operand: &ErasedRawStridedPtr<'_>, start_indices: &ErasedRawStridedPtr<'_>, exec: Exec<'_>, ) -> Result<()>
Execute gather into a destination whose reachable slots may be
uninitialized. On success, every reachable destination slot is fully
overwritten; unreachable holes are neither read nor initialized. The
dtype, overlap and layout checks 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, operand, or
start_indices does not carry its compiled dtype,
StridedError::OverlappingInputOutput when an input allocation
overlaps the destination, StridedError::InvalidBoolByte when a
bool operand holds a byte other than 0 or 1,
StridedError::PlanLayoutMismatch when a view does not carry its
compiled extents and strides, and StridedError::OffsetOverflow
when a replayed chunk’s offset arithmetic cannot be represented. Every
rejection except the last is returned before any destination write;
the offset arithmetic runs per worker, so a destination split across
workers may be partially initialized when that error surfaces.
Trait Implementations§
Source§impl Clone for ErasedGatherPlan
impl Clone for ErasedGatherPlan
Auto Trait Implementations§
impl Freeze for ErasedGatherPlan
impl RefUnwindSafe for ErasedGatherPlan
impl Send for ErasedGatherPlan
impl Sync for ErasedGatherPlan
impl Unpin for ErasedGatherPlan
impl UnsafeUnpin for ErasedGatherPlan
impl UnwindSafe for ErasedGatherPlan
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