SharedMemory

Struct SharedMemory 

Source
pub struct SharedMemory<T: CubeType> { /* private fields */ }

Implementations§

Source§

impl<E: CubePrimitive> SharedMemory<E>

Source

pub unsafe fn index_unchecked(&self, i: u32) -> &E

Perform an unchecked index into the array

§Safety

Out of bounds indexing causes undefined behaviour and may segfault. Ensure index is always in bounds

Source

pub unsafe fn index_assign_unchecked(&mut self, i: u32, value: E)

Perform an unchecked index assignment into the array

§Safety

Out of bounds indexing causes undefined behaviour and may segfault. Ensure index is always in bounds

Source

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

Source

pub fn __expand_index_assign_unchecked( scope: &mut Scope, this: <Self as CubeType>::ExpandType, i: <u32 as CubeType>::ExpandType, value: <E as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source§

impl<T: CubePrimitive + Clone> SharedMemory<T>

Source

pub fn new<S: Index>(_size: S) -> Self

Source

pub fn new_lined<S: Index>( _size: S, _vectorization_factor: u32, ) -> SharedMemory<Line<T>>

Source

pub fn len(&self) -> u32

Source

pub fn buffer_len(&self) -> u32

Source

pub fn __expand_new_lined( scope: &mut Scope, size: ExpandElementTyped<u32>, line_size: u32, ) -> <SharedMemory<Line<T>> as CubeType>::ExpandType

Source

pub fn vectorized<S: Index>(_size: S, _vectorization_factor: u32) -> Self

Source

pub fn __expand_vectorized( scope: &mut Scope, size: ExpandElementTyped<u32>, line_size: u32, ) -> <Self as CubeType>::ExpandType

Source

pub fn __expand_new( scope: &mut Scope, size: ExpandElementTyped<u32>, ) -> <Self as CubeType>::ExpandType

Source

pub fn __expand_len( scope: &mut Scope, this: ExpandElementTyped<Self>, ) -> ExpandElementTyped<u32>

Source

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

Source§

impl<T: CubePrimitive + Clone> SharedMemory<T>

Source

pub fn new_aligned( size: u32, line_size: u32, alignment: u32, ) -> SharedMemory<Line<T>>

Source

pub unsafe fn free(self)

Frees the shared memory for reuse, if possible on the target runtime.

§Safety

Must be used in uniform control flow Must not have any dangling references to this shared memory

Source

pub fn __expand_new_aligned( scope: &mut Scope, size: u32, line_size: u32, alignment: u32, ) -> <SharedMemory<Line<T>> as CubeType>::ExpandType

Source

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

Trait Implementations§

Source§

impl<T: Clone + CubeType> Clone for SharedMemory<T>

Source§

fn clone(&self) -> SharedMemory<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<E: CubePrimitive> CubeIndex for SharedMemory<E>

Source§

type Output = E

Source§

type Idx = u32

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<E: CubePrimitive> CubeIndexMut for SharedMemory<E>

Source§

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

Source§

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

Source§

impl<T: CubePrimitive> CubeType for SharedMemory<T>

Source§

type ExpandType = ExpandElementTyped<SharedMemory<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: CubePrimitive> Lined for SharedMemory<T>

Source§

fn line_size(&self) -> u32

Source§

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

Source§

impl<T: CubePrimitive> List<T> for SharedMemory<T>

Source§

fn __expand_read( scope: &mut Scope, this: ExpandElementTyped<SharedMemory<T>>, idx: ExpandElementTyped<u32>, ) -> ExpandElementTyped<T>

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 as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, ) -> <T as CubeType>::ExpandType

Source§

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

Source§

impl<T: CubePrimitive> ListMut<T> for SharedMemory<T>

Source§

fn __expand_write( scope: &mut Scope, this: ExpandElementTyped<SharedMemory<T>>, idx: ExpandElementTyped<u32>, value: ExpandElementTyped<T>, )

Source§

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

Source§

impl<E: CubePrimitive> SliceMutOperator<E> for SharedMemory<E>

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 as CubeType>::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 as CubeType>::ExpandType, ) -> <Slice<E, ReadWrite> as CubeType>::ExpandType

Source§

impl<E: CubePrimitive> SliceOperator<E> for SharedMemory<E>

Source§

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

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

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

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

Source§

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

Source§

impl<T: Copy + CubeType> Copy for SharedMemory<T>

Auto Trait Implementations§

§

impl<T> Freeze for SharedMemory<T>

§

impl<T> RefUnwindSafe for SharedMemory<T>
where T: RefUnwindSafe,

§

impl<T> Send for SharedMemory<T>
where T: Send,

§

impl<T> Sync for SharedMemory<T>
where T: Sync,

§

impl<T> Unpin for SharedMemory<T>
where T: Unpin,

§

impl<T> UnwindSafe for SharedMemory<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<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