Skip to content

Commit dfcb8cb

Browse files
authored
[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
1 parent 04364fb commit dfcb8cb

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
@@ -59,7 +59,11 @@ V add(Ty *Address, V Val, atomic::OrderingTy Ordering,
5959
template <typename Ty, typename V = utils::remove_addrspace_t<Ty>>
6060
V load(Ty *Address, atomic::OrderingTy Ordering,
6161
MemScopeTy MemScope = MemScopeTy::device) {
62+
#ifdef __NVPTX__
63+
return __scoped_atomic_fetch_add(Address, V(0), Ordering, MemScope);
64+
#else
6265
return __scoped_atomic_load_n(Address, Ordering, MemScope);
66+
#endif
6367
}
6468

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

0 commit comments

Comments
 (0)