Shared

Struct Shared 

Source
pub struct Shared<E: CubePrimitive> { /* private fields */ }

Implementations§

Source§

impl<T: CubePrimitive> Shared<T>

Source

pub fn new() -> Self

Source

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

Source§

impl<T: CubePrimitive> Shared<T>

Source

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

Source§

impl<T: CubePrimitive> Shared<Line<T>>

Source

pub fn new_lined(line_size: u32) -> SharedMemory<Line<T>>

Source

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

Methods from Deref<Target = Barrier>§

Source

pub fn tma_load_1d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, x: i32, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_2d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, y: i32, x: i32, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_3d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, z: i32, y: i32, x: i32, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_4d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, w: i32, z: i32, y: i32, x: i32, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_5d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, v: i32, w: i32, z: i32, y: i32, x: i32, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_im2col_3d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, n: i32, w: i32, c: i32, w_offset: u16, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_im2col_4d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, n: i32, h: i32, w: i32, c: i32, h_offset: u16, w_offset: u16, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn tma_load_im2col_5d<C: CubePrimitive>( &self, source: &TensorMap<C>, destination: &mut SliceMut<Line<C>>, n: i32, d: i32, h: i32, w: i32, c: i32, d_offset: u16, h_offset: u16, w_offset: u16, )

Copy a tile from a global memory source to a shared memory destination, with the provided offsets.

Source

pub fn init_manual(&self, arrival_count: u32)

Initializes a barrier with a given arrival_count. This is the number of times arrive or one of its variants needs to be called before the barrier advances.

If all units in the cube arrive on the barrier, use CUBE_DIM as the arrival count. For other purposes, only a subset may need to arrive.

§Note

No synchronization or election is performed, this is raw initialization. For shared barriers ensure only one unit performs the initialization, and synchronize the cube afterwards. There may also be additional synchronization requirements for bulk copy operations, like sync_async_proxy_shared().

Source

pub fn memcpy_async<C: CubePrimitive>( &self, source: &Slice<Line<C>>, destination: &mut SliceMut<Line<C>>, )

Copy the source slice to destination

§Safety

This will try to copy the whole source slice, so make sure source length <= destination length

Source

pub fn memcpy_async_cooperative<C: CubePrimitive>( &self, source: &Slice<Line<C>>, destination: &mut SliceMut<Line<C>>, )

Copy the source slice to destination

§Safety

This will try to copy the whole source slice, so make sure source length <= destination length

Source

pub fn memcpy_async_tx<C: CubePrimitive>( &self, source: &Slice<Line<C>>, destination: &mut SliceMut<Line<C>>, )

Copy the source slice to destination. Uses transaction count like TMA, so use with expect_tx or arrive_and_expect_tx.

§Safety

This will try to copy the whole source slice, so make sure source length <= destination length

Source

pub fn arrive(&self) -> BarrierToken

Arrive at the barrier, decrementing arrival count

Source

pub fn arrive_and_expect_tx( &self, arrival_count: u32, transaction_count: u32, ) -> BarrierToken

Arrive at the barrier, decrementing arrival count. Additionally increments expected count.

Source

pub fn expect_tx(&self, expected_count: u32)

Increments the expected count of the barrier.

Source

pub fn arrive_and_wait(&self)

Wait until all data is loaded

Source

pub fn wait(&self, token: BarrierToken)

Wait at the barrier until all arrivals are done

Source

pub fn wait_parity(&self, phase: u32)

Wait at the barrier until the phase is completed. Doesn’t require a token, but needs phase to be managed manually.

Source

pub fn commit_copy_async(&self)

Makes all previous copy_async operations visible on the barrier. Should be called once after all copies have been dispatched, before reading from the shared memory.

Does not count as an arrive in terms of the barrier arrival count. So arrive or arrive_and_wait should still be called afterwards.

Trait Implementations§

Source§

impl<T: CubePrimitive> AsMut<T> for Shared<T>

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: CubePrimitive> AsRef<T> for Shared<T>

Type inference won’t allow things like assign to work normally, so we need to manually call as_ref or as_mut for those. Things like barrier ops should take AsRef so the conversion is automatic.

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<E: Clone + CubePrimitive> Clone for Shared<E>

Source§

fn clone(&self) -> Shared<E>

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: CubePrimitive> CubeType for Shared<T>

Source§

type ExpandType = ExpandElementTyped<Shared<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> Default for Shared<T>

Source§

fn default() -> Self

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

impl Deref for Shared<Barrier>

Source§

type Target = Barrier

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Shared<Barrier>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<E: Copy + CubePrimitive> Copy for Shared<E>

Auto Trait Implementations§

§

impl<E> Freeze for Shared<E>

§

impl<E> RefUnwindSafe for Shared<E>
where E: RefUnwindSafe,

§

impl<E> Send for Shared<E>

§

impl<E> Sync for Shared<E>

§

impl<E> Unpin for Shared<E>
where E: Unpin,

§

impl<E> UnwindSafe for Shared<E>
where E: 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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