Skip to main content

Barrier

Struct Barrier 

Source
pub struct Barrier;
Expand description

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

Implementations§

Source§

impl Barrier

Source

pub fn tma_load_1d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Tiled>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Tiled>>, destination: SliceExpand<C2, ReadWrite>, x: NativeExpand<i32>, )

Source§

impl Barrier

Source

pub fn tma_load_2d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Tiled>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Tiled>>, destination: SliceExpand<C2, ReadWrite>, y: NativeExpand<i32>, x: NativeExpand<i32>, )

Source§

impl Barrier

Source

pub fn tma_load_3d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Tiled>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Tiled>>, destination: SliceExpand<C2, ReadWrite>, z: NativeExpand<i32>, y: NativeExpand<i32>, x: NativeExpand<i32>, )

Source§

impl Barrier

Source

pub fn tma_load_4d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Tiled>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Tiled>>, destination: SliceExpand<C2, ReadWrite>, w: NativeExpand<i32>, z: NativeExpand<i32>, y: NativeExpand<i32>, x: NativeExpand<i32>, )

Source§

impl Barrier

Source

pub fn tma_load_5d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Tiled>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Tiled>>, destination: SliceExpand<C2, ReadWrite>, v: NativeExpand<i32>, w: NativeExpand<i32>, z: NativeExpand<i32>, y: NativeExpand<i32>, x: NativeExpand<i32>, )

Source§

impl Barrier

Source

pub fn tma_load_im2col_3d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Im2col>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Im2col>>, destination: SliceExpand<C2, ReadWrite>, n: NativeExpand<i32>, w: NativeExpand<i32>, c: NativeExpand<i32>, w_offset: NativeExpand<u16>, )

Source§

impl Barrier

Source

pub fn tma_load_im2col_4d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Im2col>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Im2col>>, destination: SliceExpand<C2, ReadWrite>, n: NativeExpand<i32>, h: NativeExpand<i32>, w: NativeExpand<i32>, c: NativeExpand<i32>, h_offset: NativeExpand<u16>, w_offset: NativeExpand<u16>, )

Source§

impl Barrier

Source

pub fn tma_load_im2col_5d<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( &self, source: &TensorMap<C1, Im2col>, destination: &mut SliceMut<C2>, 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<C1: RudaPrimitive, C2: RudaPrimitive<Scalar = C1::Scalar>>( scope: &mut Scope, expand: BarrierExpand, source: NativeExpand<TensorMap<C1, Im2col>>, destination: SliceExpand<C2, ReadWrite>, n: NativeExpand<i32>, d: NativeExpand<i32>, h: NativeExpand<i32>, w: NativeExpand<i32>, c: NativeExpand<i32>, d_offset: NativeExpand<u16>, h_offset: NativeExpand<u16>, w_offset: NativeExpand<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 ruda. 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 ruda arrive on the barrier, use RUDA_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 ruda. 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 ruda arrive on the barrier, use RUDA_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 ruda 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 RudaType>::ExpandType

Source

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

Source

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

Source

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

Source§

impl Barrier

Source

pub fn memcpy_async<C: RudaPrimitive>( &self, source: &Slice<C>, destination: &mut SliceMut<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: RudaPrimitive>( &self, source: &Slice<C>, destination: &mut SliceMut<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: RudaPrimitive>( &self, source: &Slice<C>, destination: &mut SliceMut<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: RudaPrimitive>( scope: &mut Scope, this: &<Self as RudaType>::ExpandType, source: <Slice<C> as RudaType>::ExpandType, destination: <SliceMut<C> as RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType

Source

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

Source

pub fn __expand_memcpy_async_tx<C: RudaPrimitive>( scope: &mut Scope, this: &<Self as RudaType>::ExpandType, source: <Slice<C> as RudaType>::ExpandType, destination: <SliceMut<C> as RudaType>::ExpandType, ) -> <() as RudaType>::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 RudaType>::ExpandType, ) -> <BarrierToken as RudaType>::ExpandType

Source

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

Source

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

Source

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

Source

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

Source

pub fn __expand_wait_parity( scope: &mut Scope, this: &<Self as RudaType>::ExpandType, phase: <u32 as RudaType>::ExpandType, ) -> <() as RudaType>::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 RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType

Trait Implementations§

Source§

impl Clone for Barrier

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Barrier

Source§

impl Eq for Barrier

Source§

impl NativeAssign for Barrier

Source§

impl PartialEq for Barrier

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl RudaPrimitive for Barrier

Source§

type Scalar = u32

Source§

type Size = Const<1>

Source§

type WithScalar<S: Scalar> = S

Source§

fn from_const_value(_value: ConstantValue) -> Self

Source§

fn as_type(_scope: &Scope) -> Type

Return the element type to use on GPU.
Source§

fn as_type_native() -> Option<Type>

Native or static element type.
Source§

fn as_type_native_unchecked() -> Type

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: ManagedVariable) -> Self::ExpandType

Source§

fn into_lit_unchecked(self) -> Self

Source§

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

Source§

fn type_size() -> usize

Source§

fn type_size_bits() -> usize

Source§

fn packing_factor() -> usize

Source§

fn vector_size() -> usize

Source§

fn __expand_type_size(scope: &Scope) -> usize

Source§

fn __expand_type_size_bits(scope: &Scope) -> usize

Source§

fn __expand_packing_factor(scope: &Scope) -> usize

Source§

fn __expand_vector_size(scope: &Scope) -> usize

Source§

impl RudaType 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> Assign for T
where T: RudaPrimitive,

Source§

fn expand_assign(&mut self, _scope: &mut Scope, value: T)

Assign value to self in scope.
Source§

fn init_mut(&self, _scope: &mut Scope) -> T

Create a new mutable variable of this type in scope.
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: RudaPrimitive,

Source§

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

Source§

fn __expand_cast_from<From: RudaPrimitive>( scope: &mut Scope, value: NativeExpand<From>, ) -> <Self as RudaType>::ExpandType

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<C> CloneExpand for C
where C: Clone,

Source§

fn __expand_clone_method(&self, _scope: &mut Scope) -> C

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P> Reinterpret for P
where P: RudaPrimitive,

Source§

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

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

fn reinterpret_vectorization<From: RudaPrimitive>() -> usize

Calculates the expected vectorization for the reinterpret target
Source§

fn __expand_reinterpret<From: RudaPrimitive>( scope: &mut Scope, value: NativeExpand<From>, ) -> <Self as RudaType>::ExpandType

Source§

fn __expand_reinterpret_vectorization<From: RudaPrimitive>( scope: &mut Scope, ) -> usize

Source§

impl<P> RudaDebug for P
where P: RudaPrimitive,

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.