Skip to main content

Module atomics

Module atomics 

Source
Expand description

Atomic operation reference implementations. Atomic operation semantics enforced by the parity engine.

GPU atomic instructions vary in memory ordering and return-value behavior across backends. This module exists to define one sequentially consistent, return-old-value semantics that every backend must match byte-for-byte.

Functions§

apply
Apply one sequentially consistent atomic operation.
atomic_add
Return the old value and the value after atomic add.
atomic_and
Return the old value and the value after atomic bitwise AND.
atomic_compare_exchange
Return the old value and the value after atomic compare-exchange.
atomic_exchange
Return the old value and the replacement value for atomic exchange.
atomic_lru_update
LRU-update semantics: replace the slot with value only when value is strictly greater than old (the “more recent timestamp” wins). Identical tie-breaker behavior to atomic_max, kept as a distinct op so backends can lower it to a dedicated LRU-tracking instruction on hardware that has one. CPU reference is the correctness oracle.
atomic_max
Return the old value and the value after atomic unsigned maximum.
atomic_min
Return the old value and the value after atomic unsigned minimum.
atomic_or
Return the old value and the value after atomic bitwise OR.
atomic_xor
Return the old value and the value after atomic bitwise XOR.