pub struct ErasedCopyPlan { /* private fields */ }Expand description
Dtype-erased wrapper around CopyPlan.
Implementations§
Source§impl ErasedCopyPlan
impl ErasedCopyPlan
Sourcepub fn compile(
dtype: KernelDType,
dims: &[usize],
dst_strides: &[isize],
src_strides: &[isize],
) -> Result<Self>
pub fn compile( dtype: KernelDType, dims: &[usize], dst_strides: &[isize], src_strides: &[isize], ) -> Result<Self>
Compile a copy plan for one dtype and layout pair.
§Errors
Returns StridedError::StrideLengthMismatch when dims,
dst_strides, and src_strides do not all have the same length,
StridedError::OffsetOverflow when the element count does not fit
usize, and StridedError::NonInjectiveOutputLayout when the
destination layout cannot be proven injective (aliasing elements, or a
span the check cannot represent). The dtype
is only stored here; execute checks it.
pub fn dtype(&self) -> KernelDType
Sourcepub fn execute(
&self,
dest: &mut ErasedRawStridedMut<'_>,
src: &ErasedRawStridedRef<'_>,
exec: Exec<'_>,
) -> Result<()>
pub fn execute( &self, dest: &mut ErasedRawStridedMut<'_>, src: &ErasedRawStridedRef<'_>, exec: Exec<'_>, ) -> Result<()>
dest = src through a non-generic dtype-erased replay boundary.
§Errors
Returns StridedError::DTypeMismatch when dest or src carries a
different dtype than the plan, and
StridedError::PlanLayoutMismatch when a view does not carry the
compiled extents and strides. Nothing is written unless every check
succeeds.