DPC++ Runtime
Runtime libraries for oneAPI DPC++

Memory access functions which perform per-lane atomic update using given operation. "Per-lane" means that the atomicity guarantees of a vector atomic operation are the same as of N independent scalar atomic operations per lane (N is number of lanes). More...

Collaboration diagram for Atomic memory access.:

Functions

template<atomic_op Op, typename Tx , int N, class T = detail::__raw_t<Tx>>
__ESIMD_API std::enable_if_t< detail::check_atomic< Op, Tx, N, 0 >), simd< Tx, N > > cl::sycl::ext::intel::esimd::atomic_update (Tx *p, simd< unsigned, N > offset, simd_mask< N > mask)
 
template<atomic_op Op, typename Tx , int N, class T = detail::__raw_t<Tx>>
__ESIMD_API std::enable_if_t< detail::check_atomic< Op, Tx, N, 1 >), simd< Tx, N > > cl::sycl::ext::intel::esimd::atomic_update (Tx *p, simd< unsigned, N > offset, simd< Tx, N > src0, simd_mask< N > mask)
 
template<atomic_op Op, typename Tx , int N, class T = detail::__raw_t<Tx>>
__ESIMD_API std::enable_if_t< detail::check_atomic< Op, Tx, N, 2 >), simd< Tx, N > > cl::sycl::ext::intel::esimd::atomic_update (Tx *p, simd< unsigned, N > offset, simd< Tx, N > src0, simd< Tx, N > src1, simd_mask< N > mask)
 

Detailed Description

Memory access functions which perform per-lane atomic update using given operation. "Per-lane" means that the atomicity guarantees of a vector atomic operation are the same as of N independent scalar atomic operations per lane (N is number of lanes).

Function Documentation

◆ atomic_update() [1/3]

template<atomic_op Op, typename Tx , int N, class T = detail::__raw_t<Tx>>
__ESIMD_API std::enable_if_t<detail::check_atomic<Op, Tx, N, 2>), simd<Tx, N> > cl::sycl::ext::intel::esimd::atomic_update ( Tx *  p,
simd< unsigned, N >  offset,
simd< Tx, N >  src0,
simd< Tx, N >  src1,
simd_mask< N >  mask 
)

Atomically updates N memory locations represented by a USM pointer and a vector of offsets relative to the pointer, and returns a vector of old values found at the memory locations before update. The update operation has 2 additional arguments.

Template Parameters
OpThe atomic operation - can be one of the following: atomic_op::cmpxchg, atomic_op::fcmpwr.
TxThe vector element type.
NThe number of memory locations to update.
Parameters
pThe USM pointer.
offsetThe vector of 32-bit offsets in bytes.
src0The first additional argument (expected value).
src1The second additional argument (new value).
maskOperation mask, only locations with non-zero in the corresponding mask element are updated.
Returns
A vector of the old values at the memory locations before the update.

Definition at line 866 of file memory.hpp.

◆ atomic_update() [2/3]

template<atomic_op Op, typename Tx , int N, class T = detail::__raw_t<Tx>>
__ESIMD_API std::enable_if_t<detail::check_atomic<Op, Tx, N, 1>), simd<Tx, N> > cl::sycl::ext::intel::esimd::atomic_update ( Tx *  p,
simd< unsigned, N >  offset,
simd< Tx, N >  src0,
simd_mask< N >  mask 
)

Atomically updates N memory locations represented by a USM pointer and a vector of offsets relative to the pointer, and returns a vector of old values found at the memory locations before update. The update operation has 1 additional argument.

Template Parameters
OpThe atomic operation - can be one of the following: atomic_op::add, atomic_op::sub, atomic_op::min, atomic_op::max, atomic_op::xchg, atomic_op::bit_and, atomic_op::bit_or, atomic_op::bit_xor, atomic_op::minsint, atomic_op::maxsint, atomic_op::fmax, atomic_op::fmin.
TxThe vector element type.
NThe number of memory locations to update.
Parameters
pThe USM pointer.
offsetThe vector of 32-bit offsets in bytes.
src0The additional argument.
maskOperation mask, only locations with non-zero in the corresponding mask element are updated.
Returns
A vector of the old values at the memory locations before the update.

Definition at line 837 of file memory.hpp.

◆ atomic_update() [3/3]

template<atomic_op Op, typename Tx , int N, class T = detail::__raw_t<Tx>>
__ESIMD_API std::enable_if_t<detail::check_atomic<Op, Tx, N, 0>), simd<Tx, N> > cl::sycl::ext::intel::esimd::atomic_update ( Tx *  p,
simd< unsigned, N >  offset,
simd_mask< N >  mask 
)

Atomically updates N memory locations represented by a USM pointer and a vector of offsets relative to the pointer, and returns a vector of old values found at the memory locations before update. The update operation has no arguments in addition to the value at the memory location.

Template Parameters
OpThe atomic operation - can be atomic_op::inc or atomic_op::dec.
TxThe vector element type.
NThe number of memory locations to update.
Parameters
pThe USM pointer.
offsetThe vector of 32-bit offsets in bytes.
maskOperation mask, only locations with non-zero in the corresponding mask element are updated.
Returns
A vector of the old values at the memory locations before the update.

Definition at line 807 of file memory.hpp.