pub struct ErasedScatterPlan { /* private fields */ }Expand description
Dtype-erased additive scatter wrapper.
Implementations§
Source§impl ErasedScatterPlan
impl ErasedScatterPlan
Sourcepub fn compile(
dtype: KernelDType,
index_dtype: KernelDType,
operand_dims: &[usize],
operand_strides: &[isize],
index_dims: &[usize],
index_strides: &[isize],
update_dims: &[usize],
update_strides: &[isize],
dest_dims: &[usize],
dest_strides: &[isize],
spec: ScatterSpec,
) -> Result<Self>
pub fn compile( dtype: KernelDType, index_dtype: KernelDType, operand_dims: &[usize], operand_strides: &[isize], index_dims: &[usize], index_strides: &[isize], update_dims: &[usize], update_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], spec: ScatterSpec, ) -> Result<Self>
Validate and store an additive scatter plan for one value dtype, index dtype, and layout set.
§Errors
Returns StridedError::UnsupportedDType when index_dtype is not
i32/i64, or dtype is bool,
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::ShapeMismatch when dest_dims differs from
operand_dims or an update batch extent differs from the index batch
shape, StridedError::NonInjectiveOutputLayout when the destination
layout cannot be proven injective, StridedError::InvalidAxis for a
listed axis outside its rank, a repeating axis, an index_vector_dim
beyond the index rank, or an update window extent exceeding its
operand extent, and StridedError::RankMismatch for an index vector
that does not match spec.scatter_dims_to_operand_dims, a
wrong-length spec.update_window_dims, or an update batch rank that
disagrees with the index batch shape.
pub fn dtype(&self) -> KernelDType
pub fn index_dtype(&self) -> KernelDType
pub fn plan(&self) -> &ScatterPlan
Sourcepub fn execute(
&self,
dest: &mut ErasedRawStridedMut<'_>,
operand: &ErasedRawStridedRef<'_>,
scatter_indices: &ErasedRawStridedRef<'_>,
updates: &ErasedRawStridedRef<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute( &self, dest: &mut ErasedRawStridedMut<'_>, operand: &ErasedRawStridedRef<'_>, scatter_indices: &ErasedRawStridedRef<'_>, updates: &ErasedRawStridedRef<'_>, exec: Exec<'_>, ) -> Result<()>
Execute additive scatter into an erased output descriptor.
§Errors
Returns StridedError::DTypeMismatch when dest, operand,
scatter_indices, or updates does not carry its compiled dtype,
StridedError::PlanLayoutMismatch when a view does not carry its
compiled extents and strides. Scatter indices are clamped into the
operand window, so an out-of-range index is not an error, and the
operand copy rejects everything above before it runs.
Sourcepub fn execute_uninit(
&self,
dest: &mut ErasedRawStridedUninitMut<'_>,
operand: &ErasedRawStridedPtr<'_>,
scatter_indices: &ErasedRawStridedPtr<'_>,
updates: &ErasedRawStridedPtr<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute_uninit( &self, dest: &mut ErasedRawStridedUninitMut<'_>, operand: &ErasedRawStridedPtr<'_>, scatter_indices: &ErasedRawStridedPtr<'_>, updates: &ErasedRawStridedPtr<'_>, exec: Exec<'_>, ) -> Result<()>
On success, the copy phase initializes every reachable destination slot before the read-modify-write phase. Unreachable holes are neither read nor initialized. Validation errors before the copy leave the destination untouched; an error or panic after the copy may leave a mixture of old and new reachable values, all initialized and safely droppable.
§Errors
Returns StridedError::DTypeMismatch when dest, operand,
scatter_indices, or updates does not carry its compiled dtype,
StridedError::OverlappingInputOutput when an input allocation
overlaps the destination, and StridedError::PlanLayoutMismatch
when a view does not carry its compiled extents and strides. Every
rejection above is returned before the operand copy runs.
Trait Implementations§
Source§impl Clone for ErasedScatterPlan
impl Clone for ErasedScatterPlan
Auto Trait Implementations§
impl Freeze for ErasedScatterPlan
impl RefUnwindSafe for ErasedScatterPlan
impl Send for ErasedScatterPlan
impl Sync for ErasedScatterPlan
impl Unpin for ErasedScatterPlan
impl UnsafeUnpin for ErasedScatterPlan
impl UnwindSafe for ErasedScatterPlan
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