Skip to content

Commit 961ce35

Browse files
jhuber6tstellar
authored andcommitted
[OpenMP] Add pre sm_70 load hack back in (llvm#138589)
Summary: Different ordering modes aren't supported for an atomic load, so we just do an add of zero as the same thing. It's less efficient, but it works. Fixes llvm#138560 (cherry picked from commit dfcb8cb)
1 parent 009f3c1 commit 961ce35

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

offload/DeviceRTL/include/Synchronization.h

+4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ V add(Ty *Address, V Val, atomic::OrderingTy Ordering,
6161
template <typename Ty, typename V = utils::remove_addrspace_t<Ty>>
6262
V load(Ty *Address, atomic::OrderingTy Ordering,
6363
MemScopeTy MemScope = MemScopeTy::device) {
64+
#ifdef __NVPTX__
65+
return __scoped_atomic_fetch_add(Address, V(0), Ordering, MemScope);
66+
#else
6467
return __scoped_atomic_load_n(Address, Ordering, MemScope);
68+
#endif
6569
}
6670

6771
template <typename Ty, typename V = utils::remove_addrspace_t<Ty>>

0 commit comments

Comments
 (0)