[Openmp-commits] [PATCH] D130030: [OpenMP][DeviceRTL] Use `__atomic_exchange_n` to implement atomicStore

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jul 18 11:28:11 PDT 2022


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, jhuber6.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

This patch simply uses `__atomic_exchange_n` to implement `atomicStore`
because `__atomic_store_n` is not supported by NVPTX backend.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130030

Files:
  openmp/libomptarget/DeviceRTL/src/Synchronization.cpp


Index: openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
+++ openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
@@ -36,7 +36,7 @@
 }
 
 void atomicStore(uint32_t *Address, uint32_t Val, int Ordering) {
-  __atomic_store_n(Address, Val, Ordering);
+  (void)__atomic_exchange_n(Address, Val, Ordering);
 }
 
 uint32_t atomicAdd(uint32_t *Address, uint32_t Val, int Ordering) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130030.445573.patch
Type: text/x-patch
Size: 508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220718/190329cf/attachment.bin>


More information about the Openmp-commits mailing list