Skip to main content

ErasedTensor

Struct ErasedTensor 

Source
pub struct ErasedTensor<E: Numeric, IO = ReadOnly> { /* private fields */ }
Expand description

A tensor that has forgotten its line width. See the module docs.

Implementations§

Source§

impl<E: Numeric, IO: ErasedIoRead> ErasedTensor<E, IO>

Source

pub fn read<N: Size>(&self, index: usize) -> Vector<E, N>

Read one N-wide line at index, counted in lines.

§Panics

At expansion, when N is not the width the tensor was built for.

Source

pub fn __expand_read<N: Size>( scope: &Scope, this: &<Self as CubeType>::ExpandType, index: <usize as CubeType>::ExpandType, ) -> <Vector<E, N> as CubeType>::ExpandType

Read one N-wide line at index, counted in lines.

§Panics

At expansion, when N is not the width the tensor was built for.

Source§

impl<E: Numeric, IO: ErasedIoWrite> ErasedTensor<E, IO>

Source

pub fn write<N: Size>(&mut self, index: usize, value: Vector<E, N>)

Write one N-wide line at index, counted in lines.

§Panics

At expansion, when N is not the width the tensor was built for.

Source

pub fn __expand_write<N: Size>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, index: <usize as CubeType>::ExpandType, value: <Vector<E, N> as CubeType>::ExpandType, )

Write one N-wide line at index, counted in lines.

§Panics

At expansion, when N is not the width the tensor was built for.

Source§

impl<E: Numeric, IO: ErasedIo> ErasedTensor<E, IO>

Source

pub fn len(&self) -> usize

How many lines the tensor holds.

Source

pub fn __expand_len( scope: &Scope, this: &<Self as CubeType>::ExpandType, ) -> <usize as CubeType>::ExpandType

How many lines the tensor holds.

Source§

impl<E: Numeric, IO: ErasedIo> ErasedTensor<E, IO>

Source

pub fn of_view<V: CubeType, N: Size>(_view: V) -> Self

The erased tensor over view, whose lines are N wide.

The width is named at this call and nowhere after it, which is the whole point of the type: a caller that knows N hands it over here so the engine holding the tensor never has to.

Source

pub fn __expand_of_view<V: CubeType, N: Size>( _scope: &Scope, view: V::ExpandType, ) -> ErasedTensorExpand<E, IO>

Expand function for of_view.

Source

pub fn of_view_mut<V: CubeType, N: Size>(_view: V) -> Self

The erased tensor over the mutable view, whose lines are N wide.

Source

pub fn __expand_of_view_mut<V: CubeType, N: Size>( _scope: &Scope, view: V::ExpandType, ) -> ErasedTensorExpand<E, IO>

Expand function for of_view_mut.

Source

pub fn of_tensor<N: Size>(_tensor: &Tensor<Vector<E, N>>) -> Self

The erased tensor over tensor — memory, through the indirection.

Source

pub fn __expand_of_tensor<N: Size>( _scope: &Scope, tensor: &TensorExpand<Vector<E, N>>, ) -> ErasedTensorExpand<E, IO>
where TensorExpand<Vector<E, N>>: ErasedBacking<E, IO>,

Expand function for of_tensor.

Source

pub fn of_tensor_mut<N: Size>(_tensor: &mut Tensor<Vector<E, N>>) -> Self

The erased tensor over the mutable tensor.

Separate from of_tensor for the same reason of_view_mut is separate from of_view: a &mut operand expands to a &mut expand, and the shared entry point cannot take one.

Source

pub fn __expand_of_tensor_mut<N: Size>( _scope: &Scope, tensor: &mut TensorExpand<Vector<E, N>>, ) -> ErasedTensorExpand<E, IO>
where TensorExpand<Vector<E, N>>: ErasedBacking<E, IO>,

Expand function for of_tensor_mut.

Source

pub fn of_virtual<N: Size, IO2: Clone>( _tensor: VirtualTensor<E, N, IO2>, ) -> Self

The erased tensor over tensor.

Source

pub fn __expand_of_virtual<N: Size, IO2: Clone + 'static>( _scope: &Scope, tensor: VirtualTensorExpand<E, N, IO2>, ) -> ErasedTensorExpand<E, IO>
where VirtualTensorExpand<E, N, IO2>: ErasedBacking<E, IO>,

Expand function for of_virtual.

Trait Implementations§

Source§

impl<E: Numeric, IO> Clone for ErasedTensor<E, IO>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Numeric, IO> Copy for ErasedTensor<E, IO>

Source§

impl<E: Numeric, IO: ErasedIo> CubeType for ErasedTensor<E, IO>

Source§

impl<E: Numeric, IO: ErasedIo> Vectorized for ErasedTensor<E, IO>

Source§

impl<E: Numeric, N: Size, IO: ErasedIo> ViewOperations<Vector<E, N>, usize> for ErasedTensor<E, IO>

The erased tensor as the backing of a View or a ViewMut, which is how a kernel that addresses its operand through a layout reaches one.

N is constrained by the trait rather than by the type, which is the whole trick: the tensor stays width-free, and the width arrives with the view the caller builds over it. Every access checks the two agree.

This is implemented for every visibility, including WriteOnly, because ViewOperationsMut has ViewOperations as a supertrait — a write-only destination backing a ViewMut still has to name the read half. Its reads reach the backing’s default and panic.

Source§

fn read(&self, pos: C) -> T

Source§

fn read_checked(&self, pos: C) -> T

Source§

fn read_masked(&self, pos: C, value: T) -> T

Source§

fn read_unchecked(&self, pos: C) -> T

Source§

fn as_linear_slice(&self, pos: C, size: C) -> &[T]

Create a slice starting from pos, with size. The layout handles translation into concrete indices.
Source§

fn tensor_map_load(&self, barrier: &Barrier, shared_memory: &mut [T], pos: C)

Execute a TMA load into shared memory, if the underlying storage supports it. Panics if it’s unsupported.
Source§

fn shape(&self) -> C

Source§

fn is_in_bounds(&self, pos: C) -> bool

Source§

fn __expand_read( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_read_checked( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_read_masked( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_read_unchecked( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_as_linear_slice<'infer, 'scope>( scope: &'scope Scope, this: &'infer <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, size: <C as CubeType>::ExpandType, ) -> &'infer <[T] as CubeType>::ExpandType ⓘ

Source§

fn __expand_tensor_map_load( scope: &Scope, this: &<Self as CubeType>::ExpandType, barrier: &<Barrier as CubeType>::ExpandType, shared_memory: &mut <[T] as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, )

Source§

fn __expand_shape( scope: &Scope, this: &<Self as CubeType>::ExpandType, ) -> <C as CubeType>::ExpandType

Source§

fn __expand_is_in_bounds( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <bool as CubeType>::ExpandType

Source§

impl<E: Numeric, N: Size, IO: ErasedIoWrite> ViewOperationsMut<Vector<E, N>, usize> for ErasedTensor<E, IO>

Source§

fn write(&self, pos: C, value: T)

Source§

fn write_checked(&self, pos: C, value: T)

Source§

fn as_linear_slice_mut(&self, pos: C, size: C) -> &mut [T]

Create a mutable slice starting from pos, with size. The layout handles translation into concrete indices.
Source§

fn tensor_map_store(&self, shared_memory: &[T], pos: C)

Execute a TMA store into global memory, if the underlying storage supports it. Panics if it’s unsupported.
Source§

fn __expand_write( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, )

Source§

fn __expand_write_checked( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, )

Source§

fn __expand_as_linear_slice_mut<'infer, 'scope>( scope: &'scope Scope, this: &'infer <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, size: <C as CubeType>::ExpandType, ) -> &'infer mut <[T] as CubeType>::ExpandType ⓘ

Source§

fn __expand_tensor_map_store( scope: &Scope, this: &<Self as CubeType>::ExpandType, shared_memory: &<[T] as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, )

Auto Trait Implementations§

§

impl<E, IO> Freeze for ErasedTensor<E, IO>

§

impl<E, IO> RefUnwindSafe for ErasedTensor<E, IO>

§

impl<E, IO> Send for ErasedTensor<E, IO>
where PhantomData<E>: Send, PhantomData<IO>: Send,

§

impl<E, IO> Sync for ErasedTensor<E, IO>
where PhantomData<E>: Sync, PhantomData<IO>: Sync,

§

impl<E, IO> Unpin for ErasedTensor<E, IO>

§

impl<E, IO> UnsafeUnpin for ErasedTensor<E, IO>

§

impl<E, IO> UnwindSafe for ErasedTensor<E, IO>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneExpand for T
where T: Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.