[Openmp-commits] [PATCH] D135036: [OpenMP] Introduce more atomic operations into the runtime

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Oct 3 14:14:04 PDT 2022


tianshilei1992 added a comment.

I think it's worth to create a new file `Atomic.cpp`.



================
Comment at: openmp/libomptarget/DeviceRTL/src/Synchronization.cpp:54
+  }                                                                            \
+  TY atomicLoad(TY *Address, atomic::OrderingTy Ordering) {                    \
+    return atomicAdd(Address, TY(0), Ordering);                                \
----------------
the indent is off here


================
Comment at: openmp/libomptarget/DeviceRTL/src/Synchronization.cpp:67
+    if (Val >= 0)                                                              \
+      return atomicMin((SINT_TY *)Address, utils::convertViaPun<SINT_TY>(Val), \
+                       Ordering);                                              \
----------------
This doesn't look right. The integer value after type punning doesn't conform with the same arithmetic as the original floating-point value. Actually we already have `atomicrmw fmax/fmin` in LLVM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135036/new/

https://reviews.llvm.org/D135036



More information about the Openmp-commits mailing list