Sequence

Struct Sequence 

Source
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 + Clone,

Source

pub fn rev(&self) -> Sequence<T>

Source§

impl<T> Sequence<T>
where T: CubeType,

Source

pub fn new() -> Sequence<T>

Create a new empty sequence.

Source

pub fn push(&mut self, value: T)

Push a new value into the sequence.

Source

pub fn len(&self) -> usize

Obtain the sequence length.

Source

pub fn index(&self, index: usize) -> &T

Get the variable at the given position in the sequence.

Source

pub fn index_mut(&mut self, index: usize) -> &mut T

Get the variable at the given position in the sequence.

Source

pub fn __expand_new(_scope: &mut Scope) -> SequenceExpand<T>

Expand function of new.

Source

pub fn insert(&mut self, index: usize, value: T)

Insert an item at the given index.

Source

pub fn __expand_push( scope: &mut Scope, expand: &mut SequenceExpand<T>, value: <T as CubeType>::ExpandType, )

Expand function of push.

Source

pub fn __expand_index( scope: &mut Scope, expand: SequenceExpand<T>, index: usize, ) -> <T as CubeType>::ExpandType

Expand function of index.

Source

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> Clone for Sequence<T>
where T: Clone + CubeType,

Source§

fn clone(&self) -> Sequence<T>

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<T> Coordinates for Sequence<T>
where T: Coordinates + Copy,

Source§

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>

Subtract two coordinates from each other and return the result.
Source§

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>

Apply an elementwise maximum to the coordinates and return the result.
Source§

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>

Create a new coordinates object where all values are value. this may be used as a reference coordinate for dynamically sized layouts.
Source§

fn __expand_add( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType

Source§

fn __expand_sub( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType

Source§

fn __expand_min( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType

Source§

fn __expand_max( scope: &mut Scope, this: <Sequence<T> as CubeType>::ExpandType, other: <Sequence<T> as CubeType>::ExpandType, ) -> <Sequence<T> as CubeType>::ExpandType

Source§

fn __expand_is_in_bounds( scope: &mut Scope, pos: <Sequence<T> as CubeType>::ExpandType, bounds: <Sequence<T> as CubeType>::ExpandType, ) -> <bool as CubeType>::ExpandType

Source§

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,

Source§

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,

Source§

type Output = T

Source§

type Idx = usize

Source§

fn cube_idx(&self, _i: Self::Idx) -> &Self::Output

Source§

fn expand_index( scope: &mut Scope, array: Self::ExpandType, index: <Self::Idx as CubeType>::ExpandType, ) -> <Self::Output as CubeType>::ExpandType

Source§

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,

Source§

type ExpandType = SequenceExpand<T>

Source§

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

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

impl<T> Debug for Sequence<T>
where T: Debug + CubeType,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Default for Sequence<T>
where T: CubeType,

Source§

fn default() -> Sequence<T>

Returns the “default value” for a type. Read more
Source§

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>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Hash for Sequence<T>
where T: Hash + CubeType,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoDyn for Sequence<i32>

Source§

impl IntoDyn for Sequence<u32>

Source§

impl<T> IntoIterator for Sequence<T>
where T: CubeType,

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = <Vec<T> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Sequence<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoMut for Sequence<T>
where T: CubeType,

Source§

fn into_mut(self, _scope: &mut Scope) -> Sequence<T>

Source§

impl<C> LaunchArg for Sequence<C>
where C: LaunchArg,

Source§

type RuntimeArg<'a, R: Runtime> = SequenceArg<'a, R, C>

The runtime argument for the kernel.
Source§

type CompilationArg = SequenceCompilationArg<C>

Compilation argument.
Source§

fn compilation_arg<R>( runtime_arg: &<Sequence<C> as LaunchArg>::RuntimeArg<'_, R>, ) -> <Sequence<C> as LaunchArg>::CompilationArg
where R: Runtime,

Source§

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>

Register an output variable during compilation that fill the KernelBuilder.
Source§

impl<T> Ord for Sequence<T>
where T: Ord + CubeType,

Source§

fn cmp(&self, other: &Sequence<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq for Sequence<T>
where T: PartialEq + CubeType,

Source§

fn eq(&self, other: &Sequence<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialOrd for Sequence<T>
where T: PartialOrd + CubeType,

Source§

fn partial_cmp(&self, other: &Sequence<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> Serialize for Sequence<T>
where T: CubeType + Serialize,

Source§

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>

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>

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, )

.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::ExpandType, pos: <C as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn __expand_read_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_read_checked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_read_masked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _mask_value: <T as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_read_unchecked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> <T as CubeType>::ExpandType

Source§

fn __expand_to_linear_slice_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _end: SequenceExpand<N>, ) -> SliceExpand<T, ReadOnly>

Source§

fn __expand_shape_method(&self, _scope: &mut Scope) -> SequenceExpand<N>

Source§

fn __expand_is_in_bounds_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, ) -> ExpandElementTyped<bool>

Source§

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>

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::ExpandType, pos: <C as CubeType>::ExpandType, value: <T as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source§

fn __expand_write_checked( scope: &mut Scope, this: Self::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::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::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>>

Source§

fn __expand_write_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _value: <T as CubeType>::ExpandType, )

Source§

fn __expand_write_checked_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _value: <T as CubeType>::ExpandType, )

Source§

fn __expand_to_linear_slice_mut_method( &self, _scope: &mut Scope, _pos: SequenceExpand<N>, _end: SequenceExpand<N>, ) -> SliceExpand<T, ReadWrite>

Source§

fn __expand_tensor_map_store_method( &self, scope: &mut Scope, shared_memory: SliceExpand<T, ReadOnly>, pos: SequenceExpand<N>, )

Source§

impl<T> Eq for Sequence<T>
where T: Eq + CubeType,

Source§

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> 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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

Source§

impl<T> CacheKey for T

Source§

impl<T> CacheValue for T

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,