pub struct Sequence<T>where
T: CubeType,{ /* private fields */ }Expand description
A sequence of cube types that is inlined during compilation.
In other words, it allows you to group a dynamic amount of variables at compile time.
All methods push, index and into_iter are executed during compilation and don’t add any overhead on the generated kernel.
Implementations§
Source§impl<T> Sequence<T>where
T: CubeType,
impl<T> Sequence<T>where
T: CubeType,
Sourcepub fn index(&self, index: usize) -> &T
pub fn index(&self, index: usize) -> &T
Get the variable at the given position in the sequence.
Sourcepub fn index_mut(&mut self, index: usize) -> &mut T
pub fn index_mut(&mut self, index: usize) -> &mut T
Get the variable at the given position in the sequence.
Sourcepub fn __expand_new(_scope: &mut Scope) -> SequenceExpand<T>
pub fn __expand_new(_scope: &mut Scope) -> SequenceExpand<T>
Expand function of new.
Sourcepub fn __expand_push(
scope: &mut Scope,
expand: &mut SequenceExpand<T>,
value: <T as CubeType>::ExpandType,
)
pub fn __expand_push( scope: &mut Scope, expand: &mut SequenceExpand<T>, value: <T as CubeType>::ExpandType, )
Expand function of push.
Sourcepub fn __expand_index(
scope: &mut Scope,
expand: SequenceExpand<T>,
index: usize,
) -> <T as CubeType>::ExpandType
pub fn __expand_index( scope: &mut Scope, expand: SequenceExpand<T>, index: usize, ) -> <T as CubeType>::ExpandType
Expand function of index.
Sourcepub fn __expand_index_mut(
scope: &mut Scope,
expand: SequenceExpand<T>,
index: usize,
) -> <T as CubeType>::ExpandType
pub fn __expand_index_mut( scope: &mut Scope, expand: SequenceExpand<T>, index: usize, ) -> <T as CubeType>::ExpandType
Expand function of index_mut.
Trait Implementations§
Source§impl<T> Coordinates for Sequence<T>where
T: Coordinates + Copy,
impl<T> Coordinates for Sequence<T>where
T: Coordinates + Copy,
Source§fn add(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
fn add(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
Add two coordinates together and return the result.
Source§fn sub(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
fn sub(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
Subtract two coordinates from each other and return the result.
Source§fn min(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
fn min(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
Apply an elementwise minimum to the coordinates and return the result.
Source§fn max(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
fn max(this: Sequence<T>, other: Sequence<T>) -> Sequence<T>
Apply an elementwise maximum to the coordinates and return the result.
Source§fn is_in_bounds(pos: &Sequence<T>, bounds: &Sequence<T>) -> bool
fn is_in_bounds(pos: &Sequence<T>, bounds: &Sequence<T>) -> bool
Check whether
pos is fully contained within bounds.Source§fn from_int(this: &Sequence<T>, value: i64) -> Sequence<T>
fn from_int(this: &Sequence<T>, value: i64) -> Sequence<T>
Create a new coordinates object where all values are
value.
this may be used as a reference coordinate for dynamically sized layouts.fn __expand_add( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType
fn __expand_sub( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType
fn __expand_min( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType
fn __expand_max( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType
fn __expand_is_in_bounds( scope: &mut Scope, pos: <Sequence<T> as CubeType>::ExpandType, bounds: <Sequence<T> as CubeType>::ExpandType, ) -> <bool as CubeType>::ExpandType
fn __expand_from_int( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, value: i64, ) -> <Sequence<T> as CubeType>::ExpandType
Source§impl<T> CubeDebug for Sequence<T>where
T: CubeType,
impl<T> CubeDebug for Sequence<T>where
T: CubeType,
Source§fn set_debug_name(&self, scope: &mut Scope, name: &'static str)
fn set_debug_name(&self, scope: &mut Scope, name: &'static str)
Set the debug name of this type’s expansion. Should do nothing for types that don’t appear
at runtime
Source§impl<T> CubeIndex for Sequence<T>where
T: CubeType,
impl<T> CubeIndex for Sequence<T>where
T: CubeType,
type Output = T
type Idx = usize
fn cube_idx(&self, _i: Self::Idx) -> &Self::Output
fn expand_index( scope: &mut Scope, array: Self::ExpandType, index: <Self::Idx as CubeType>::ExpandType, ) -> <Self::Output as CubeType>::ExpandType
fn expand_index_unchecked( scope: &mut Scope, array: Self::ExpandType, index: <Self::Idx as CubeType>::ExpandType, ) -> <Self::Output as CubeType>::ExpandType
Source§impl<T> CubeType for Sequence<T>where
T: CubeType,
impl<T> CubeType for Sequence<T>where
T: CubeType,
type ExpandType = SequenceExpand<T>
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<'de, T> Deserialize<'de> for Sequence<T>where
T: CubeType + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Sequence<T>where
T: CubeType + Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Sequence<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Sequence<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoDyn for Sequence<i32>
impl IntoDyn for Sequence<i32>
fn into_dyn(self) -> Sequence<i32>
fn __expand_into_dyn( scope: &mut Scope, this: Self::ExpandType, ) -> <Sequence<i32> as CubeType>::ExpandType
Source§impl IntoDyn for Sequence<u32>
impl IntoDyn for Sequence<u32>
fn into_dyn(self) -> Sequence<i32>
fn __expand_into_dyn( scope: &mut Scope, this: Self::ExpandType, ) -> <Sequence<i32> as CubeType>::ExpandType
Source§impl<T> IntoIterator for Sequence<T>where
T: CubeType,
impl<T> IntoIterator for Sequence<T>where
T: CubeType,
Source§impl<C> LaunchArg for Sequence<C>where
C: LaunchArg,
impl<C> LaunchArg for Sequence<C>where
C: LaunchArg,
Source§type RuntimeArg<'a, R: Runtime> = SequenceArg<'a, R, C>
type RuntimeArg<'a, R: Runtime> = SequenceArg<'a, R, C>
The runtime argument for the kernel.
Source§type CompilationArg = SequenceCompilationArg<C>
type CompilationArg = SequenceCompilationArg<C>
Compilation argument.
fn compilation_arg<R>(
runtime_arg: &<Sequence<C> as LaunchArg>::RuntimeArg<'_, R>,
) -> <Sequence<C> as LaunchArg>::CompilationArgwhere
R: Runtime,
Source§fn expand(
arg: &<Sequence<C> as LaunchArg>::CompilationArg,
builder: &mut KernelBuilder,
) -> SequenceExpand<C>
fn expand( arg: &<Sequence<C> as LaunchArg>::CompilationArg, builder: &mut KernelBuilder, ) -> SequenceExpand<C>
Register an input variable during compilation that fill the KernelBuilder.
Source§fn expand_output(
arg: &<Sequence<C> as LaunchArg>::CompilationArg,
builder: &mut KernelBuilder,
) -> SequenceExpand<C>
fn expand_output( arg: &<Sequence<C> as LaunchArg>::CompilationArg, builder: &mut KernelBuilder, ) -> SequenceExpand<C>
Register an output variable during compilation that fill the KernelBuilder.
Source§impl<T> Ord for Sequence<T>
impl<T> Ord for Sequence<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialOrd for Sequence<T>where
T: PartialOrd + CubeType,
impl<T> PartialOrd for Sequence<T>where
T: PartialOrd + CubeType,
Source§impl<T> Serialize for Sequence<T>
impl<T> Serialize for Sequence<T>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<T, N> ViewOperations<T, Sequence<N>> for TensorMap<T, Tiled>
impl<T, N> ViewOperations<T, Sequence<N>> for TensorMap<T, Tiled>
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> ⓘ
fn to_linear_slice(&self, pos: C, size: C) -> Slice<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 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::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_read_checked( scope: &mut Scope, this: Self::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_read_masked( scope: &mut Scope, this: Self::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_read_unchecked( scope: &mut Scope, this: Self::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_to_linear_slice( scope: &mut Scope, this: Self::ExpandType, pos: <C as CubeType>::ExpandType, size: <C as CubeType>::ExpandType, ) -> <Slice<T> as CubeType>::ExpandType ⓘ
fn __expand_tensor_map_load( scope: &mut Scope, this: Self::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::ExpandType, ) -> <C as CubeType>::ExpandType
fn __expand_is_in_bounds( scope: &mut Scope, this: Self::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <bool as CubeType>::ExpandType
Source§impl<T, N> ViewOperationsExpand<T, Sequence<N>> for ExpandElementTyped<TensorMap<T, Tiled>>
impl<T, N> ViewOperationsExpand<T, Sequence<N>> for ExpandElementTyped<TensorMap<T, Tiled>>
fn __expand_read_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> <T as CubeType>::ExpandType
fn __expand_read_checked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> <T as CubeType>::ExpandType
fn __expand_read_masked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _mask_value: <T as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType
fn __expand_read_unchecked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> <T as CubeType>::ExpandType
fn __expand_to_linear_slice_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _end: SequenceExpand<N>, ) -> SliceExpand<T, ReadOnly>
fn __expand_shape_method(&self, _scope: &mut Scope) -> SequenceExpand<N>
fn __expand_is_in_bounds_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> ExpandElementTyped<bool>
fn __expand_tensor_map_load_method( &self, scope: &mut Scope, barrier: ExpandElementTyped<Barrier>, shared_memory: SliceExpand<T, ReadWrite>, pos: SequenceExpand<N>, )
Source§impl<T, N> ViewOperationsMut<T, Sequence<N>> for TensorMap<T, Tiled>
impl<T, N> ViewOperationsMut<T, Sequence<N>> for TensorMap<T, Tiled>
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::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType
fn __expand_write_checked( scope: &mut Scope, this: Self::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::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::ExpandType, shared_memory: <Slice<T> as CubeType>::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType
Source§impl<T, N> ViewOperationsMutExpand<T, Sequence<N>> for ExpandElementTyped<TensorMap<T, Tiled>>
impl<T, N> ViewOperationsMutExpand<T, Sequence<N>> for ExpandElementTyped<TensorMap<T, Tiled>>
fn __expand_write_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _value: <T as CubeType>::ExpandType, )
fn __expand_write_checked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _value: <T as CubeType>::ExpandType, )
fn __expand_to_linear_slice_mut_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _end: SequenceExpand<N>, ) -> SliceExpand<T, ReadWrite>
fn __expand_tensor_map_store_method( &self, scope: &mut Scope, shared_memory: SliceExpand<T, ReadOnly>, pos: SequenceExpand<N>, )
impl<T> Eq for Sequence<T>
impl<T> StructuralPartialEq for Sequence<T>where
T: CubeType,
Auto Trait Implementations§
impl<T> Freeze for Sequence<T>
impl<T> RefUnwindSafe for Sequence<T>where
T: RefUnwindSafe,
impl<T> Send for Sequence<T>where
T: Send,
impl<T> Sync for Sequence<T>where
T: Sync,
impl<T> Unpin for Sequence<T>where
T: Unpin,
impl<T> UnwindSafe for Sequence<T>where
T: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.