Skip to main content

ViewOperations

Trait ViewOperations 

Source
pub trait ViewOperations<T: CubePrimitive, C: Coordinates>: Vectorized + CubeType<ExpandType: ViewOperationsExpand<T, C>> {
Show 16 methods // Provided methods 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 { ... } fn as_linear_slice(&self, pos: C, size: C) -> &[T] { ... } fn tensor_map_load( &self, barrier: &Barrier, shared_memory: &mut [T], pos: C, ) { ... } fn shape(&self) -> C { ... } fn is_in_bounds(&self, pos: C) -> bool { ... } fn __expand_read( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType { ... } fn __expand_read_checked( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType { ... } 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 { ... } fn __expand_read_unchecked( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType { ... } 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 { ... } 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, ) { ... } fn __expand_shape( scope: &Scope, this: &<Self as CubeType>::ExpandType, ) -> <C as CubeType>::ExpandType { ... } fn __expand_is_in_bounds( scope: &Scope, this: &<Self as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <bool as CubeType>::ExpandType { ... }
}
Expand description

Type from which we can read values in cube functions. For a mutable version, see [ListMut].

Provided Methods§

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: CubePrimitive, C: Coordinates, V: ViewOperations<T, C> + ?Sized> ViewOperations<T, C> for &V

Source§

impl<T: CubePrimitive, C: Coordinates, V: ViewOperations<T, C> + ?Sized> ViewOperations<T, C> for &mut V

Source§

impl<T: CubePrimitive, N: CubePrimitive + Coordinates> ViewOperations<T, Sequence<N>> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive, P: CubePrimitive + Coordinates, O: CubePrimitive + Coordinates> ViewOperations<T, (Sequence<P>, Sequence<O>)> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, ((i32, i32, i32), usize)> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, ((i32, i32, i32, i32), (u32, u32))> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, ((i32, i32, i32, i32, i32), (u32, u32, u32))> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, ((u32, u32, u32), usize)> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, ((u32, u32, u32, u32), (u32, u32))> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, ((u32, u32, u32, u32, u32), (u32, u32, u32))> for TensorMap<T, Im2col>

Source§

impl<T: CubePrimitive> ViewOperations<T, (i32, i32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (i32, i32, i32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (i32, i32, i32, i32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (i32, i32, i32, i32, i32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (u32, u32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (u32, u32, u32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (u32, u32, u32, u32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, (u32, u32, u32, u32, u32)> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, i32> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, usize> for Box<[T]>

Source§

impl<T: CubePrimitive> ViewOperations<T, usize> for TensorMap<T, Tiled>

Source§

impl<T: CubePrimitive> ViewOperations<T, usize> for [T]

Implementors§

Source§

impl<'a, Q: Scalar, NQ: Size, S: Scalar, F: Numeric, NF: Size, C: Coordinates + 'static> ViewOperations<Vector<F, NF>, C> for QuantizedView<'a, Q, NQ, S, F, NF, C>

Source§

impl<'a, T: CubePrimitive, C: Coordinates + 'a> ViewOperations<T, C> for View<'a, T, C>

Source§

impl<'a, T: CubePrimitive, C: Coordinates + 'a> ViewOperations<T, C> for ViewMut<'a, T, C>

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§

impl<T: CubePrimitive, C: Coordinates, S: Coordinates, V> ViewOperations<T, C> for VirtualView<T, C, S, V>
where V: ViewOperations<T, S>,

Source§

impl<T: CubePrimitive, C: Coordinates, S: Coordinates, V> ViewOperations<T, C> for VirtualViewMut<T, C, S, V>
where V: ViewOperationsMut<T, S>,

Source§

impl<T: Numeric, N: Size, IO: Clone> ViewOperations<Vector<T, N>, usize> for VirtualTensor<T, N, IO>