Skip to content

Commit

Permalink
[OpenMP] Remove hack around missing atomic load (llvm#122781)
Browse files Browse the repository at this point in the history
Summary:
We used to do a fetch add of zero to approximate a load. This is because
the NVPTX backend didn't handle this properly. It's not an issue anymore
so simply use the proper atomic builtin.
  • Loading branch information
jhuber6 authored Jan 16, 2025
1 parent d49a2d2 commit 1c00d0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion offload/DeviceRTL/include/Synchronization.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ V add(Ty *Address, V Val, atomic::OrderingTy Ordering) {

template <typename Ty, typename V = utils::remove_addrspace_t<Ty>>
V load(Ty *Address, atomic::OrderingTy Ordering) {
return add(Address, Ty(0), Ordering);
return __scoped_atomic_load_n(Address, Ordering, __MEMORY_SCOPE_DEVICE);
}

template <typename Ty, typename V = utils::remove_addrspace_t<Ty>>
Expand Down

0 comments on commit 1c00d0d

Please sign in to comment.