Trait cubecl_core::frontend::Atomic

source ·
pub trait Atomic: Sized + CubeType{
    type Primitive: Numeric;

Show 22 methods // Provided methods fn load(pointer: &Self) -> Self::Primitive { ... } fn store(pointer: &Self, value: Self::Primitive) { ... } fn swap(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn compare_and_swap( pointer: &Self, cmp: Self::Primitive, value: Self::Primitive, ) -> Self::Primitive { ... } fn add(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn sub(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn max(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn min(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn and(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn or(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn xor(pointer: &Self, value: Self::Primitive) -> Self::Primitive { ... } fn __expand_load( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_store( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) { ... } fn __expand_swap( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_compare_and_swap( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, cmp: <Self::Primitive as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_add( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_sub( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_max( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_min( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_and( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_or( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... } fn __expand_xor( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType { ... }
}
Expand description

An atomic type. Represents an shared value that can be operated on atomically.

Required Associated Types§

source

type Primitive: Numeric

The numeric primitive represented by the atomic wrapper.

Provided Methods§

source

fn load(pointer: &Self) -> Self::Primitive

Load the value of the atomic.

source

fn store(pointer: &Self, value: Self::Primitive)

Store the value of the atomic.

source

fn swap(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Atomically stores the value into the atomic and returns the old value.

source

fn compare_and_swap( pointer: &Self, cmp: Self::Primitive, value: Self::Primitive, ) -> Self::Primitive

Compare the value at pointer to cmp and set it to value only if they are the same. Returns the old value of the pointer before the store.

§Tip

Compare the returned value to cmp to determine whether the store was successful.

source

fn add(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Atomically add a number to the atomic variable. Returns the old value.

source

fn sub(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Atomically subtracts a number from the atomic variable. Returns the old value.

source

fn max(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Atomically sets the value of the atomic variable to max(current_value, value). Returns the old value.

source

fn min(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Atomically sets the value of the atomic variable to min(current_value, value). Returns the old value.

source

fn and(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Executes an atomic bitwise and operation on the atomic variable. Returns the old value.

source

fn or(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Executes an atomic bitwise or operation on the atomic variable. Returns the old value.

source

fn xor(pointer: &Self, value: Self::Primitive) -> Self::Primitive

Executes an atomic bitwise xor operation on the atomic variable. Returns the old value.

source

fn __expand_load( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_store( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, )

source

fn __expand_swap( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_compare_and_swap( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, cmp: <Self::Primitive as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_add( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_sub( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_max( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_min( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_and( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_or( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

source

fn __expand_xor( context: &mut CubeContext, pointer: <Self as CubeType>::ExpandType, value: <Self::Primitive as CubeType>::ExpandType, ) -> <Self::Primitive as CubeType>::ExpandType

Object Safety§

This trait is not object safe.

Implementors§