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>
 
impl<E: Numeric, IO: Clone> VirtualTensor<E, IO>
pub fn as_tensor_map(&self) -> CubeOption<TensorMap<E>>
pub fn as_slice(&self, start: u32, end: u32) -> Slice<Line<E>>
pub fn buffer_len(&self) -> u32
pub fn __expand_as_tensor_map( context: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <CubeOption<TensorMap<E>> as CubeType>::ExpandType
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
pub fn __expand_shape( scope: &mut Scope, this: <Self as CubeType>::ExpandType, axis: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType
pub fn __expand_stride( scope: &mut Scope, this: <Self as CubeType>::ExpandType, axis: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType
pub fn __expand_rank( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType
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>
 
impl<E: Numeric, IO: Clone + 'static> VirtualTensor<E, IO>
Sourcepub fn view<C: Coordinates + 'static>(
    &self,
    layout: impl Into<VirtualLayout<C, Coords1d>>,
) -> View<Line<E>, C, ReadOnly>
 
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>
 
impl<E: Numeric, IO: Clone + 'static> VirtualTensor<E, IO>
Source§impl<E: Numeric> VirtualTensor<E, ReadWrite>
 
impl<E: Numeric> VirtualTensor<E, ReadWrite>
Sourcepub fn view_mut<C: Coordinates + 'static>(
    &self,
    layout: impl Layout<Coordinates = C, SourceCoordinates = Coords1d> + 'static,
) -> View<Line<E>, C, ReadWrite>
 
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
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>
 
impl<E: Numeric> VirtualTensor<E, ReadWrite>
Sourcepub fn as_view_mut(&mut self) -> View<Line<E>, u32, ReadWrite>
 
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
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>
 
impl<E: Numeric, IO: Clone + 'static> VirtualTensor<E, IO>
pub fn coordinate(&self, index: u32, dim: u32) -> u32
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>
 
impl<E: Numeric> VirtualTensor<E, ReadOnly>
Sourcepub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &V) -> Self
 
pub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &V) -> Self
Create a new read only virtual tensor.
Sourcepub fn __expand_new<V: VirtualTensorOperations<E> + 'static>(
    _scope: &mut Scope,
    v: V::ExpandType,
) -> VirtualTensorExpand<E, ReadOnly>
 
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>
 
impl<E: Numeric> VirtualTensor<E, ReadWrite>
Sourcepub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &mut V) -> Self
 
pub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &mut V) -> Self
Create a new read write virtual tensor.
Sourcepub fn __expand_new<V: VirtualTensorOperations<E> + 'static>(
    _scope: &mut Scope,
    v: V::ExpandType,
) -> VirtualTensorExpand<E, ReadWrite>
 
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>
 
impl<E: Clone + Numeric, IO: Clone> Clone for VirtualTensor<E, IO>
Source§fn clone(&self) -> VirtualTensor<E, IO>
 
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)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl<E: Numeric, IO: Clone> CubeType for VirtualTensor<E, IO>
 
impl<E: Numeric, IO: Clone> CubeType for VirtualTensor<E, IO>
type ExpandType = VirtualTensorExpand<E, IO>
Source§fn into_mut(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType
 
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>
 
impl<E: Numeric, IO: Clone> Lined for VirtualTensor<E, IO>
fn line_size(&self) -> u32
fn __expand_line_size(_scope: &mut Scope, this: Self::ExpandType) -> u32
Source§impl<E: Numeric, IO: Clone> List<Line<E>> for VirtualTensor<E, IO>
 
impl<E: Numeric, IO: Clone> List<Line<E>> for VirtualTensor<E, IO>
fn __expand_read( scope: &mut Scope, this: VirtualTensorExpand<E, IO>, index: <u32 as CubeType>::ExpandType, ) -> <Line<E> as CubeType>::ExpandType
fn read(&self, index: u32) -> T
fn read_unchecked(&self, index: u32) -> T
fn len(&self) -> u32
fn __expand_read_unchecked( scope: &mut Scope, this: Self::ExpandType, index: <u32 as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_len( scope: &mut Scope, this: Self::ExpandType, ) -> <u32 as CubeType>::ExpandType
Source§impl<E: Numeric> ListMut<Line<E>> for VirtualTensor<E, ReadWrite>
 
impl<E: Numeric> ListMut<Line<E>> for VirtualTensor<E, ReadWrite>
fn __expand_write( scope: &mut Scope, this: VirtualTensorExpand<E, ReadWrite>, index: <u32 as CubeType>::ExpandType, value: <Line<E> as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType
fn write(&self, index: u32, value: T)
Source§impl<E: Numeric> SliceMutOperator<Line<E>> for VirtualTensor<E, ReadWrite>
 
impl<E: Numeric> SliceMutOperator<Line<E>> for VirtualTensor<E, ReadWrite>
Source§fn slice_mut(&mut self, start: u32, end: u32) -> Slice<E, ReadWrite>
 
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>
 
fn to_slice_mut(&mut self) -> Slice<E, ReadWrite>
Reinterprete the current type as a read-write slice.
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
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>
 
impl<E: Numeric, IO: Clone> SliceOperator<Line<E>> for VirtualTensor<E, IO>
Source§fn slice(&self, start: u32, end: u32) -> Slice<E>
 
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.fn __expand_slice( scope: &mut Scope, this: Self::ExpandType, start: <u32 as CubeType>::ExpandType, end: <u32 as CubeType>::ExpandType, ) -> <Slice<E> as CubeType>::ExpandType
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>
 
impl<T: Numeric, IO: Clone> ViewOperations<Line<T>, u32> for VirtualTensor<T, IO>
fn read(&self, pos: C) -> T
fn read_checked(&self, pos: C) -> T
fn read_masked(&self, pos: C, value: T) -> T
fn read_unchecked(&self, pos: C) -> T
Source§fn to_linear_slice(&self, pos: C, size: C) -> Slice<T, ReadOnly>
 
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.fn as_tensor_map(&self) -> CubeOption<TensorMap<T>>
Source§fn tensor_map_load(
    &self,
    barrier: &Barrier,
    shared_memory: &mut Slice<T, ReadWrite>,
    pos: C,
)
 
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.
fn shape(&self) -> C
fn is_in_bounds(&self, pos: C) -> bool
fn __expand_read( scope: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_read_checked( scope: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
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
fn __expand_read_unchecked( scope: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
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
fn __expand_as_tensor_map( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <CubeOption<TensorMap<T>> as CubeType>::ExpandType
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
fn __expand_shape( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <C as CubeType>::ExpandType
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>
 
impl<T: Numeric> ViewOperationsMut<Line<T>, u32> for VirtualTensor<T, ReadWrite>
fn write(&self, pos: C, value: T)
fn write_checked(&self, pos: C, value: T)
Source§fn to_linear_slice_mut(&self, pos: C, size: C) -> Slice<T, ReadWrite>
 
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)
 
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.
fn __expand_write( scope: &mut Scope, this: <Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType
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
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
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
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>where
    E: RefUnwindSafe,
    IO: RefUnwindSafe,
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>
impl<E, IO> UnwindSafe for VirtualTensor<E, IO>where
    E: UnwindSafe,
    IO: UnwindSafe,
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
Mutably borrows from an owned value. Read more