16template <
typename T, device_address_space address>
21template <
typename T, device_address_space address>
24 : m_ptr(parent.m_ptr) {}
26template <
typename T, device_address_space address>
39#ifndef __VECMEM_THREADFENCE
41#define __VECMEM_THREADFENCE __threadfence()
43#define __VECMEM_THREADFENCE
47template <
typename T, device_address_space address>
56template <
typename T, device_address_space address>
67#undef __VECMEM_THREADFENCE
69template <
typename T, device_address_space address>
76template <
typename T, device_address_space address>
77VECMEM_HOST_AND_DEVICE
bool
81 if (
order == memory_order::acq_rel) {
83 memory_order::acquire);
84 }
else if (
order == memory_order::release) {
86 memory_order::relaxed);
92template <
typename T, device_address_space address>
93VECMEM_HOST_AND_DEVICE
bool
100 failure != memory_order::acq_rel);
113template <
typename T, device_address_space address>
120template <
typename T, device_address_space address>
127template <
typename T, device_address_space address>
134template <
typename T, device_address_space address>
141template <
typename T, device_address_space address>
Custom implementation for atomic operations in CUDA device code.
Definition cuda_device_atomic_ref.hpp:34
T value_type
Type managed by the object.
Definition cuda_device_atomic_ref.hpp:41
value_type & reference
Reference to a value given by the user.
Definition cuda_device_atomic_ref.hpp:47
value_type * pointer
Pointer to the value in global memory.
Definition cuda_device_atomic_ref.hpp:45
VECMEM_HOST_AND_DEVICE value_type fetch_sub(value_type data, memory_order order=memory_order::seq_cst) const
Substitute a chosen value from the stored variable.
Definition dummy_device_atomic_ref.ipp:107
VECMEM_HOST_AND_DEVICE value_type exchange(value_type data, memory_order order=memory_order::seq_cst) const
Exchange the current value of the variable with a different one.
Definition dummy_device_atomic_ref.ipp:55
VECMEM_HOST_AND_DEVICE void store(value_type data, memory_order order=memory_order::seq_cst) const
Set the variable to the desired value.
Definition dummy_device_atomic_ref.ipp:39
VECMEM_HOST_AND_DEVICE value_type fetch_add(value_type data, memory_order order=memory_order::seq_cst) const
Add a chosen value to the stored variable.
Definition dummy_device_atomic_ref.ipp:97
dummy_device_atomic_ref & operator=(const dummy_device_atomic_ref &)=delete
Disable the assignment operator.
VECMEM_HOST_AND_DEVICE value_type load(memory_order order=memory_order::seq_cst) const
Get the value of the variable.
Definition dummy_device_atomic_ref.ipp:46
VECMEM_HOST_AND_DEVICE value_type fetch_and(value_type data, memory_order order=memory_order::seq_cst) const
Replace the current value with the specified value AND-ed to it.
Definition dummy_device_atomic_ref.ipp:117
VECMEM_HOST_AND_DEVICE value_type fetch_or(value_type data, memory_order order=memory_order::seq_cst) const
Replace the current value with the specified value OR-d to it.
Definition dummy_device_atomic_ref.ipp:127
VECMEM_HOST_AND_DEVICE bool compare_exchange_strong(reference expected, value_type desired, memory_order success, memory_order failure) const
Compare against the current value, and exchange only if different.
Definition dummy_device_atomic_ref.ipp:82
VECMEM_HOST_AND_DEVICE value_type fetch_xor(value_type data, memory_order order=memory_order::seq_cst) const
Replace the current value with the specified value XOR-d to it.
Definition dummy_device_atomic_ref.ipp:137
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35
memory_order
Custom (dummy) definition for the memory order.
Definition memory_order.hpp:31