[Openmp-commits] [openmp] 2ada7bb - [OpenMP][NFCI] Remove effectively unused mutex

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 11 17:31:02 PST 2023


Author: Johannes Doerfert
Date: 2023-12-11T17:30:35-08:00
New Revision: 2ada7bb68bef36cd228d1c236e96932efb18daaa

URL: https://github.com/llvm/llvm-project/commit/2ada7bb68bef36cd228d1c236e96932efb18daaa
DIFF: https://github.com/llvm/llvm-project/commit/2ada7bb68bef36cd228d1c236e96932efb18daaa.diff

LOG: [OpenMP][NFCI] Remove effectively unused mutex

The only use was already guarded by a different lock in the caller of
loadBinary.

Added: 
    

Modified: 
    openmp/libomptarget/include/PluginManager.h
    openmp/libomptarget/src/device.cpp
    openmp/libomptarget/src/interface.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/include/PluginManager.h b/openmp/libomptarget/include/PluginManager.h
index 0b0974709b5256..a0499c37504c0d 100644
--- a/openmp/libomptarget/include/PluginManager.h
+++ b/openmp/libomptarget/include/PluginManager.h
@@ -82,11 +82,6 @@ struct PluginAdaptorTy {
 
   llvm::DenseSet<const __tgt_device_image *> UsedImages;
 
-  // Mutex for thread-safety when calling RTL interface functions.
-  // It is easier to enforce thread-safety at the libomptarget level,
-  // so that developers of new RTLs do not have to worry about it.
-  std::mutex Mtx;
-
 private:
   /// Number of devices the underling plugins sees.
   int32_t NumberOfPluginDevices = -1;

diff  --git a/openmp/libomptarget/src/device.cpp b/openmp/libomptarget/src/device.cpp
index 1302c4e3d91781..01fc3232887612 100644
--- a/openmp/libomptarget/src/device.cpp
+++ b/openmp/libomptarget/src/device.cpp
@@ -561,7 +561,6 @@ llvm::Error DeviceTy::init() {
 
 // Load binary to device.
 __tgt_target_table *DeviceTy::loadBinary(__tgt_device_image *Img) {
-  std::lock_guard<decltype(RTL->Mtx)> LG(RTL->Mtx);
   return RTL->load_binary(RTLDeviceID, Img);
 }
 

diff  --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp
index d92f40ce1d14e9..d9e87640161f26 100644
--- a/openmp/libomptarget/src/interface.cpp
+++ b/openmp/libomptarget/src/interface.cpp
@@ -14,10 +14,7 @@
 #include "OpenMP/OMPT/Interface.h"
 #include "OpenMP/OMPT/Callback.h"
 #include "PluginManager.h"
-#include "device.h"
-#include "omptarget.h"
 #include "private.h"
-#include "rtl.h"
 
 #include "Shared/EnvironmentVar.h"
 #include "Shared/Profile.h"
@@ -28,8 +25,6 @@
 #include <cstdint>
 #include <cstdio>
 #include <cstdlib>
-#include <mutex>
-#include <type_traits>
 
 #ifdef OMPT_SUPPORT
 using namespace llvm::omp::target::ompt;


        


More information about the Openmp-commits mailing list