[Openmp-commits] [openmp] [OpenMP][libomptarget] Fix potential atomics ordering bug (PR #70503)

Matt Arsenault via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 8 00:50:24 PST 2023


================
@@ -1035,14 +1035,14 @@ struct AMDGPUStreamTy {
   /// should be executed. Notice we use the post action mechanism to codify the
   /// asynchronous operation.
   static bool asyncActionCallback(hsa_signal_value_t Value, void *Args) {
-    StreamSlotTy *Slot = reinterpret_cast<StreamSlotTy *>(Args);
-    assert(Slot && "Invalid slot");
-    assert(Slot->Signal && "Invalid signal");
-
     // This thread is outside the stream mutex. Make sure the thread sees the
     // changes on the slot.
     std::atomic_thread_fence(std::memory_order_acquire);
 
+    StreamSlotTy *Slot = reinterpret_cast<StreamSlotTy *>(Args);
+    assert(Slot && "Invalid slot");
+    assert(Slot->Signal && "Invalid signal");
----------------
arsenm wrote:

I'm assuming the Signal field is some kind of atomic type?

https://github.com/llvm/llvm-project/pull/70503


More information about the Openmp-commits mailing list