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

Gheorghe-Teodor Bercea via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 29 10:04:57 PST 2024


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

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

>From 10652bce03ff15d9022c6d80e9ff581ef304341e Mon Sep 17 00:00:00 2001
From: Doru Bercea <doru.bercea at amd.com>
Date: Thu, 29 Feb 2024 11:37:07 -0500
Subject: [PATCH] Add missing Mutex.

---
 openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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.



More information about the Openmp-commits mailing list