Barrier

Struct Barrier 

Source
pub struct Barrier;
Expand description

A mechanism for awaiting on asynchronous data transfers Behaviour is defined by its BarrierLevel.

Implementations§

Source§

impl 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 __expand_tma_load_1d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, x: ExpandElementTyped<i32>, )

Source§

impl Barrier

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 __expand_tma_load_2d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, y: ExpandElementTyped<i32>, x: ExpandElementTyped<i32>, )

Source§

impl Barrier

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 __expand_tma_load_3d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, z: ExpandElementTyped<i32>, y: ExpandElementTyped<i32>, x: ExpandElementTyped<i32>, )

Source§

impl Barrier

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 __expand_tma_load_4d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, w: ExpandElementTyped<i32>, z: ExpandElementTyped<i32>, y: ExpandElementTyped<i32>, x: ExpandElementTyped<i32>, )

Source§

impl Barrier

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 __expand_tma_load_5d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, v: ExpandElementTyped<i32>, w: ExpandElementTyped<i32>, z: ExpandElementTyped<i32>, y: ExpandElementTyped<i32>, x: ExpandElementTyped<i32>, )

Source§

impl Barrier

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 __expand_tma_load_im2col_3d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, n: ExpandElementTyped<i32>, w: ExpandElementTyped<i32>, c: ExpandElementTyped<i32>, w_offset: ExpandElementTyped<u16>, )

Source§

impl Barrier

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 __expand_tma_load_im2col_4d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, n: ExpandElementTyped<i32>, h: ExpandElementTyped<i32>, w: ExpandElementTyped<i32>, c: ExpandElementTyped<i32>, h_offset: ExpandElementTyped<u16>, w_offset: ExpandElementTyped<u16>, )

Source§

impl Barrier

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 __expand_tma_load_im2col_5d<C: CubePrimitive>( scope: &mut Scope, expand: BarrierExpand, source: ExpandElementTyped<TensorMap<C>>, destination: SliceExpand<Line<C>, ReadWrite>, n: ExpandElementTyped<i32>, d: ExpandElementTyped<i32>, h: ExpandElementTyped<i32>, w: ExpandElementTyped<i32>, c: ExpandElementTyped<i32>, d_offset: ExpandElementTyped<u16>, h_offset: ExpandElementTyped<u16>, w_offset: ExpandElementTyped<u16>, )

Source§

impl Barrier

Source

pub fn local() -> Self

Create a local barrier object for the current unit. Automatically initialized with an arrival count of 1.

Source

pub fn shared(arrival_count: u32, is_elected: bool) -> Shared<Barrier>

Create a shared memory barrier that can be accesses by all units in the cube. Initialized by the is_elected unit with an arrival count of 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.

Source

pub fn shared_uninit() -> Shared<Barrier>

Create a shared memory barrier that can be accesses by all units in the cube. Only declared, but not initialized.

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 __expand_local(scope: &mut Scope) -> <Self as CubeType>::ExpandType

Source

pub fn __expand_shared( scope: &mut Scope, arrival_count: <u32 as CubeType>::ExpandType, is_elected: <bool as CubeType>::ExpandType, ) -> <Shared<Barrier> as CubeType>::ExpandType

Source

pub fn __expand_shared_uninit( scope: &mut Scope, ) -> <Shared<Barrier> as CubeType>::ExpandType

Source

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

Source§

impl Barrier

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 __expand_memcpy_async<C: CubePrimitive>( scope: &mut Scope, this: &<Self as CubeType>::ExpandType, source: <Slice<Line<C>> as CubeType>::ExpandType, destination: <SliceMut<Line<C>> as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source

pub fn __expand_memcpy_async_cooperative<C: CubePrimitive>( scope: &mut Scope, this: &<Self as CubeType>::ExpandType, source: <Slice<Line<C>> as CubeType>::ExpandType, destination: <SliceMut<Line<C>> as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source

pub fn __expand_memcpy_async_tx<C: CubePrimitive>( scope: &mut Scope, this: &<Self as CubeType>::ExpandType, source: <Slice<Line<C>> as CubeType>::ExpandType, destination: <SliceMut<Line<C>> as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source§

impl Barrier

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 __expand_arrive( scope: &mut Scope, this: &<Self as CubeType>::ExpandType, ) -> <BarrierToken as CubeType>::ExpandType

Source

pub fn __expand_arrive_and_expect_tx( scope: &mut Scope, this: &<Self as CubeType>::ExpandType, arrival_count: <u32 as CubeType>::ExpandType, transaction_count: <u32 as CubeType>::ExpandType, ) -> <BarrierToken as CubeType>::ExpandType

Source

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

Source

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

Source

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

Source

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

Source§

impl Barrier

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.

Source

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

Trait Implementations§

Source§

impl Clone for Barrier

Source§

fn clone(&self) -> Barrier

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 CubePrimitive for Barrier

Source§

fn from_const_value(_value: ConstantScalarValue) -> Self

Source§

fn as_type(_scope: &Scope) -> StorageType

Return the element type to use on GPU.
Source§

fn as_type_native() -> Option<StorageType>

Native or static element type.
Source§

fn as_type_native_unchecked() -> StorageType

Native or static element type.
Source§

fn size() -> Option<usize>

Only native element types have a size.
Source§

fn size_bits() -> Option<usize>

Only native element types have a size.
Source§

fn size_bits_unchecked() -> usize

Only native element types have a size.
Source§

fn from_expand_elem(elem: ExpandElement) -> Self::ExpandType

Source§

fn into_lit_unchecked(self) -> Self

Source§

fn supported_uses<R: Runtime>(client: &ComputeClient<R>) -> EnumSet<TypeUsage>

Source§

fn type_size() -> u32

Source§

fn type_size_bits() -> u32

Source§

fn packing_factor() -> u32

Source§

fn __expand_type_size(scope: &Scope) -> u32

Source§

fn __expand_type_size_bits(scope: &Scope) -> u32

Source§

fn __expand_packing_factor(scope: &Scope) -> u32

Source§

impl CubeType for Barrier

Source§

type ExpandType = ExpandElementTyped<Barrier>

Source§

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

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

impl ExpandElementIntoMut for Barrier

Source§

impl PartialEq for Barrier

Source§

fn eq(&self, other: &Barrier) -> 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 Copy for Barrier

Source§

impl Eq for Barrier

Source§

impl StructuralPartialEq for Barrier

Auto Trait Implementations§

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<P> Cast for P
where P: CubePrimitive,

Source§

fn cast_from<From>(_value: From) -> P
where From: CubePrimitive,

Source§

fn __expand_cast_from<From: CubePrimitive>( scope: &mut Scope, value: ExpandElementTyped<From>, ) -> <Self as CubeType>::ExpandType

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<P> CubeDebug for P
where P: CubePrimitive,

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<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<P> Reinterpret for P
where P: CubePrimitive,

Source§

fn reinterpret<From: CubePrimitive>(value: From) -> Self

Reinterpret the bits of another primitive as this primitive without conversion.
Source§

fn __expand_reinterpret<From: CubePrimitive>( scope: &mut Scope, value: ExpandElementTyped<From>, ) -> <Self as CubeType>::ExpandType

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