VirtualTensor

Struct VirtualTensor 

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

Tensor representation that is decoupled from how the tensor is stored.

Implementations§

Source§

impl<E: Numeric, IO: Clone> VirtualTensor<E, IO>

Source

pub fn as_tensor_map(&self) -> CubeOption<TensorMap<E>>

Source

pub fn as_slice(&self, start: u32, end: u32) -> Slice<Line<E>>

Source

pub fn shape(&self, axis: u32) -> u32

Get the shape of the tensor at the given axis.

Source

pub fn stride(&self, axis: u32) -> u32

Get the stride of the tensor at the given axis.

Source

pub fn rank(&self) -> u32

Get the rank of the tensor.

Source

pub fn buffer_len(&self) -> u32

Source

pub fn __expand_as_tensor_map( context: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <CubeOption<TensorMap<E>> as CubeType>::ExpandType

Source

pub fn __expand_as_slice( context: &mut Scope, this: <Self as CubeType>::ExpandType, start: <u32 as CubeType>::ExpandType, end: <u32 as CubeType>::ExpandType, ) -> <Slice<Line<E>> as CubeType>::ExpandType

Source

pub fn __expand_shape( scope: &mut Scope, this: <Self as CubeType>::ExpandType, axis: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_stride( scope: &mut Scope, this: <Self as CubeType>::ExpandType, axis: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_rank( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_buffer_len( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source§

impl<E: Numeric, IO: Clone + 'static> VirtualTensor<E, IO>

Source

pub fn view<C: Coordinates + 'static>( &self, layout: impl Into<VirtualLayout<C, Coords1d>>, ) -> View<Line<E>, C, ReadOnly>

Create a conceptual view over this tensor, allowing for multi-dimensional indexing with custom layouts

Source§

impl<E: Numeric, IO: Clone + 'static> VirtualTensor<E, IO>

Source

pub fn as_view(&self) -> View<Line<E>, u32, ReadOnly>

Create a conceptual view over this tensor, with a simple linear layout

Source

pub fn __expand_as_view( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <View<Line<E>, u32, ReadOnly> as CubeType>::ExpandType

Source§

impl<E: Numeric> VirtualTensor<E, ReadWrite>

Source

pub fn view_mut<C: Coordinates + 'static>( &self, layout: impl Layout<Coordinates = C, SourceCoordinates = Coords1d> + 'static, ) -> View<Line<E>, C, ReadWrite>

Create a mutable conceptual view over this tensor, allowing for multi-dimensional indexing with custom layouts

Source

pub fn __expand_view_mut<C: Coordinates + 'static>( scope: &mut Scope, this: VirtualTensorExpand<E, ReadWrite>, layout: VirtualLayoutExpand<C, Coords1d>, ) -> ViewExpand<Line<E>, C, ReadWrite>

Source§

impl<E: Numeric> VirtualTensor<E, ReadWrite>

Source

pub fn as_view_mut(&mut self) -> View<Line<E>, u32, ReadWrite>

Create a conceptual mutable view over this tensor, with a simple linear layout

Source

pub fn __expand_as_view_mut( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <View<Line<E>, u32, ReadWrite> as CubeType>::ExpandType

Source§

impl<E: Numeric, IO: Clone + 'static> VirtualTensor<E, IO>

Source

pub fn coordinate(&self, index: u32, dim: u32) -> u32

Source

pub fn __expand_coordinate( scope: &mut Scope, this: <Self as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, dim: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source§

impl<E: Numeric> VirtualTensor<E, ReadOnly>

Source

pub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &V) -> Self

Create a new read only virtual tensor.

Source

pub fn __expand_new<V: VirtualTensorOperations<E> + 'static>( _scope: &mut Scope, v: V::ExpandType, ) -> VirtualTensorExpand<E, ReadOnly>

Expand function of Self::new.

Source§

impl<E: Numeric> VirtualTensor<E, ReadWrite>

Source

pub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &mut V) -> Self

Create a new read write virtual tensor.

Source

pub fn __expand_new<V: VirtualTensorOperations<E> + 'static>( _scope: &mut Scope, v: V::ExpandType, ) -> VirtualTensorExpand<E, ReadWrite>

Expand function of Self::new.

Trait Implementations§

Source§

impl<E: Clone + Numeric, IO: Clone> Clone for VirtualTensor<E, IO>

Source§

fn clone(&self) -> VirtualTensor<E, IO>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<E: Numeric, IO: Clone> CubeType for VirtualTensor<E, IO>

Source§

type ExpandType = VirtualTensorExpand<E, IO>

Source§

fn into_mut(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType

Wrapper around the init method, necessary to type inference.
Source§

impl<E: Numeric, IO: Clone> Lined for VirtualTensor<E, IO>

Source§

fn line_size(&self) -> u32

Source§

fn __expand_line_size(_scope: &mut Scope, this: Self::ExpandType) -> u32

Source§

impl<E: Numeric, IO: Clone> List<Line<E>> for VirtualTensor<E, IO>

Source§

fn __expand_read( scope: &mut Scope, this: VirtualTensorExpand<E, IO>, index: <u32 as CubeType>::ExpandType, ) -> <Line<E> as CubeType>::ExpandType

Source§

fn read(&self, index: u32) -> T

Source§

fn read_unchecked(&self, index: u32) -> T

Source§

fn len(&self) -> u32

Source§

fn __expand_read_unchecked( scope: &mut Scope, this: Self::ExpandType, index: <u32 as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

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

Source§

impl<E: Numeric> ListMut<Line<E>> for VirtualTensor<E, ReadWrite>

Source§

fn __expand_write( scope: &mut Scope, this: VirtualTensorExpand<E, ReadWrite>, index: <u32 as CubeType>::ExpandType, value: <Line<E> as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source§

fn write(&self, index: u32, value: T)

Source§

impl<E: Numeric> SliceMutOperator<Line<E>> for VirtualTensor<E, ReadWrite>

Source§

fn slice_mut(&mut self, start: u32, end: u32) -> Slice<E, ReadWrite>

Return a read-write view of all elements comprise between the start and end indices. In checked mode, if the end index is out-of-bound, it is replaced by the length of self.
Source§

fn to_slice_mut(&mut self) -> Slice<E, ReadWrite>

Reinterprete the current type as a read-write slice.
Source§

fn __expand_slice_mut( scope: &mut Scope, this: Self::ExpandType, start: <u32 as CubeType>::ExpandType, end: <u32 as CubeType>::ExpandType, ) -> <Slice<E, ReadWrite> as CubeType>::ExpandType

Source§

fn __expand_to_slice_mut( scope: &mut Scope, this: Self::ExpandType, ) -> <Slice<E, ReadWrite> as CubeType>::ExpandType

Source§

impl<E: Numeric, IO: Clone> SliceOperator<Line<E>> for VirtualTensor<E, IO>

Source§

fn slice(&self, start: u32, end: u32) -> Slice<E>

Return a read-only view of all elements comprise between the start and end indices. In checked mode, if the end index is out-of-bound, it is replaced by the length of self.
Source§

fn to_slice(&self) -> Slice<E>

Reinterprete the current type as a read-only slice.
Source§

fn __expand_slice( scope: &mut Scope, this: Self::ExpandType, start: <u32 as CubeType>::ExpandType, end: <u32 as CubeType>::ExpandType, ) -> <Slice<E> as CubeType>::ExpandType

Source§

fn __expand_to_slice( scope: &mut Scope, this: Self::ExpandType, ) -> <Slice<E> as CubeType>::ExpandType

Source§

impl<T: Numeric, IO: Clone> ViewOperations<Line<T>, u32> for VirtualTensor<T, IO>

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 to_linear_slice(&self, pos: C, size: C) -> Slice<T, ReadOnly>

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

fn as_tensor_map(&self) -> CubeOption<TensorMap<T>>

Source§

fn tensor_map_load( &self, barrier: &Barrier, shared_memory: &mut Slice<T, ReadWrite>, 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: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

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

Source§

fn __expand_read_masked( scope: &mut 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: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_to_linear_slice( scope: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, size: <C as CubeType>::ExpandType, ) -> <Slice<T, ReadOnly> as CubeType>::ExpandType

Source§

fn __expand_as_tensor_map( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <CubeOption<TensorMap<T>> as CubeType>::ExpandType

Source§

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

Source§

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

Source§

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

Source§

impl<T: Numeric> ViewOperationsMut<Line<T>, u32> for VirtualTensor<T, ReadWrite>

Source§

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

Source§

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

Source§

fn to_linear_slice_mut(&self, pos: C, size: C) -> Slice<T, ReadWrite>

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

fn tensor_map_store(&self, shared_memory: &Slice<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: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source§

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

Source§

fn __expand_to_linear_slice_mut( scope: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, size: <C as CubeType>::ExpandType, ) -> <Slice<T, ReadWrite> as CubeType>::ExpandType

Source§

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

Source§

impl<E: Numeric, IO: Clone> Copy for VirtualTensor<E, IO>

Auto Trait Implementations§

§

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

§

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

§

impl<E, IO> Send for VirtualTensor<E, IO>
where IO: Send,

§

impl<E, IO> Sync for VirtualTensor<E, IO>
where IO: Sync,

§

impl<E, IO> Unpin for VirtualTensor<E, IO>
where E: Unpin, IO: Unpin,

§

impl<E, IO> UnwindSafe for VirtualTensor<E, IO>
where E: UnwindSafe, IO: UnwindSafe,

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<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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V