[Openmp-commits] [openmp] [libomptarget][nextgen-plugin] Add missing mutex lock (PR #83455)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 29 10:05:27 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Gheorghe-Teodor Bercea (doru1004)

<details>
<summary>Changes</summary>

It looks like there is a potentially missing lock in the waitOnStreamOperation.

---
Full diff: https://github.com/llvm/llvm-project/pull/83455.diff


1 Files Affected:

- (modified) openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp (+4-1) 


``````````diff
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 81634ae1edc490..92a4b66955c7a5 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -1093,7 +1093,10 @@ struct AMDGPUStreamTy {
     if (Queue == nullptr)
       return Plugin::error("Target queue was nullptr");
 
-    /// The signal that we must wait from the other stream.
+    // Guard access to the Slots data structure.
+    std::lock_guard<std::mutex> Lock(Mutex);
+
+    // The signal that we must wait from the other stream.
     AMDGPUSignalTy *OtherSignal = OtherStream.Slots[Slot].Signal;
 
     // Prevent the release of the other stream's signal.

``````````

</details>


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


More information about the Openmp-commits mailing list