52 sycl::access::address_space::generic_space,
59 return atm.fetch_add(operand);
69 sycl::access::address_space::generic_space,
76 return atm.fetch_sub(operand);
87 sycl::access::address_space::generic_space,
94 return atm.fetch_and(operand);
105 sycl::access::address_space::generic_space,
112 return atm.fetch_or(operand);
123 sycl::access::address_space::generic_space,
130 return atm.fetch_xor(operand);
139 sycl::access::address_space::generic_space,
146 return atm.fetch_min(operand);
156 sycl::access::address_space::generic_space,
163 return atm.fetch_max(operand);
173 sycl::access::address_space::generic_space,
177 unsigned int operand) {
185 if (old == 0 || old > operand) {
186 if (atm.compare_exchange_strong(old, operand))
188 }
else if (atm.compare_exchange_strong(old, old - 1))
202 sycl::access::address_space::generic_space,
206 unsigned int operand) {
213 if (old >= operand) {
214 if (atm.compare_exchange_strong(old, 0))
216 }
else if (atm.compare_exchange_strong(old, old + 1))
228 sycl::access::address_space::generic_space,
235 return atm.exchange(operand);
249 sycl::access::address_space::generic_space,
260 atm.compare_exchange_strong(expected, desired, success, fail);
275 sycl::access::address_space::generic_space,
285 atm.compare_exchange_strong(expected, desired, success, fail);
293 (std::is_same<T, int>::value || std::is_same<T, unsigned int>::value ||
294 std::is_same<T, long>::value || std::is_same<T, unsigned long>::value ||
295 std::is_same<T, long long>::value ||
296 std::is_same<T, unsigned long long>::value ||
297 std::is_same<T, float>::value || std::is_same<T, double>::value ||
298 std::is_pointer<T>::value);
302 template <
typename T,
306 sycl::access::address_space::generic_space>
310 "Invalid atomic type. Valid types are int, unsigned int, long, "
311 "unsigned long, long long, unsigned long long, float, double "
312 "and pointer types");
340 atm.
store(operand, memoryOrder, memoryScope);
350 const_cast<T &
>(__d));
351 return atm.
load(memoryOrder, memoryScope);
365 return atm.
exchange(operand, memoryOrder, memoryScope);
397 T &expected, T desired,
436 T &expected, T desired,
455 return atm.fetch_add(operand, memoryOrder, memoryScope);
469 return atm.fetch_sub(operand, memoryOrder, memoryScope);
bool compare_exchange_strong(T &expected, T desired, memory_order success, memory_order failure, memory_scope scope=default_scope) const noexcept
T load(memory_order order=default_read_order, memory_scope scope=default_scope) const noexcept
void store(T operand, memory_order order=default_write_order, memory_scope scope=default_scope) const noexcept
bool compare_exchange_weak(T &expected, T desired, memory_order success, memory_order failure, memory_scope scope=default_scope) const noexcept
T exchange(T operand, memory_order order=default_read_modify_write_order, memory_scope scope=default_scope) const noexcept
bool compare_exchange_strong(T &expected, T desired, sycl::memory_order memoryOrder=default_read_modify_write_order, sycl::memory_scope memoryScope=default_scope) noexcept
static constexpr sycl::memory_order default_read_modify_write_order
static constexpr sycl::memory_order default_read_order
default memory synchronization order
bool compare_exchange_weak(T &expected, T desired, sycl::memory_order memoryOrder=default_read_modify_write_order, sycl::memory_scope memoryScope=default_scope) noexcept
T fetch_sub(arith_t< T > operand, sycl::memory_order memoryOrder=default_read_modify_write_order, sycl::memory_scope memoryScope=default_scope) noexcept
atomically subtracts the argument from the value stored in the atomic object and obtains the value he...
T load(sycl::memory_order memoryOrder=default_read_order, sycl::memory_scope memoryScope=default_scope) const noexcept
atomically obtains the value of the referenced object
constexpr atomic() noexcept=default
Default constructor.
T fetch_add(arith_t< T > operand, sycl::memory_order memoryOrder=default_read_modify_write_order, sycl::memory_scope memoryScope=default_scope) noexcept
atomically adds the argument to the value stored in the atomic object and obtains the value held prev...
static constexpr sycl::memory_order default_write_order
static constexpr sycl::memory_scope default_scope
void store(T operand, sycl::memory_order memoryOrder=default_write_order, sycl::memory_scope memoryScope=default_scope) noexcept
atomically replaces the value of the referenced object with a non-atomic argument
bool compare_exchange_strong(T &expected, T desired, sycl::memory_order success, sycl::memory_order failure, sycl::memory_scope memoryScope=default_scope) noexcept
atomically compares the value of the referenced object with non-atomic argument and performs atomic e...
T exchange(T operand, sycl::memory_order memoryOrder=default_read_modify_write_order, sycl::memory_scope memoryScope=default_scope) noexcept
atomically replaces the value of the referenced object and obtains the value held previously
bool compare_exchange_weak(T &expected, T desired, sycl::memory_order success, sycl::memory_order failure, sycl::memory_scope memoryScope=default_scope) noexcept
atomically compares the value of the referenced object with non-atomic argument and performs atomic e...
T atomic_fetch_and(T *addr, type_identity_t< T > operand)
Atomically perform a bitwise AND between the value operand and the value at the addr and assign the r...
T atomic_compare_exchange_strong(sycl::multi_ptr< T, sycl::access::address_space::generic_space > addr, type_identity_t< T > expected, type_identity_t< T > desired, sycl::memory_order success=sycl::memory_order::relaxed, sycl::memory_order fail=sycl::memory_order::relaxed)
Atomically compare the value at addr to the value expected and exchange with the value desired if the...
unsigned int atomic_fetch_compare_inc(unsigned int *addr, unsigned int operand)
Atomically increment the value stored in addr if old value stored in addr is less than operand,...
T atomic_fetch_sub(T *addr, arith_t< T > operand)
Atomically subtract the value operand from the value at the addr and assign the result to the value a...
typename type_identity< T >::type type_identity_t
T atomic_fetch_max(T *addr, type_identity_t< T > operand)
Atomically calculate the maximum of the value at addr and the value operand and assign the result to ...
T atomic_fetch_min(T *addr, type_identity_t< T > operand)
Atomically calculate the minimum of the value at addr and the value operand and assign the result to ...
T atomic_fetch_xor(T *addr, type_identity_t< T > operand)
Atomically xor the value at the addr with the value operand, and assign the result to the value at ad...
unsigned int atomic_fetch_compare_dec(unsigned int *addr, unsigned int operand)
Atomically set operand to the value stored in addr, if old value stored in addr is equal to zero or g...
typename arith< T >::type arith_t
T atomic_fetch_or(T *addr, type_identity_t< T > operand)
Atomically or the value at the addr with the value operand, and assign the result to the value at add...
T atomic_exchange(T *addr, type_identity_t< T > operand)
Atomically exchange the value at the address addr with the value operand.
T atomic_fetch_add(T *addr, arith_t< T > operand)
Atomically add the value operand to the value at the addr and assign the result to the value at addr.
_Abi const simd< _Tp, _Abi > & noexcept
static constexpr bool value