[Openmp-commits] [openmp] [OpenMP][NFC] Remove `DelayedBinDesc` (PR #74360)
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Mon Dec 4 11:18:05 PST 2023
https://github.com/jdoerfert created https://github.com/llvm/llvm-project/pull/74360
The `DelayedBinDesc` was removed as it is not necessary. It was either
never used or racy. The only time we could have called it was after we
created `PM` in the `init()` constructor. However, we immediately went
ahead and called `registerDelayedLibraries` which disabled
`DelayedBinDesc` for the future. This was like that since
https://reviews.llvm.org/D142249 landed.
>From d6dc8b8d11292e40bb72bcde5b84868cddeabf83 Mon Sep 17 00:00:00 2001
From: Johannes Doerfert <johannes at jdoerfert.de>
Date: Mon, 4 Dec 2023 11:16:25 -0800
Subject: [PATCH] [OpenMP][NFC] Remove `DelayedBinDesc`
The `DelayedBinDesc` was removed as it is not necessary. It was either
never used or racy. The only time we could have called it was after we
created `PM` in the `init()` constructor. However, we immediately went
ahead and called `registerDelayedLibraries` which disabled
`DelayedBinDesc` for the future. This was like that since
https://reviews.llvm.org/D142249 landed.
---
openmp/libomptarget/include/PluginManager.h | 17 -----------------
openmp/libomptarget/src/interface.cpp | 3 ---
openmp/libomptarget/src/rtl.cpp | 1 -
3 files changed, 21 deletions(-)
diff --git a/openmp/libomptarget/include/PluginManager.h b/openmp/libomptarget/include/PluginManager.h
index 94ecce01ca74c..2473e39de34bc 100644
--- a/openmp/libomptarget/include/PluginManager.h
+++ b/openmp/libomptarget/include/PluginManager.h
@@ -106,23 +106,6 @@ struct PluginManager {
HostPtrToTableMapTy HostPtrToTableMap;
std::mutex TblMapMtx; ///< For HostPtrToTableMap
- // Work around for plugins that call dlopen on shared libraries that call
- // tgt_register_lib during their initialisation. Stash the pointers in a
- // vector until the plugins are all initialised and then register them.
- bool delayRegisterLib(__tgt_bin_desc *Desc) {
- if (RTLsLoaded)
- return false;
- DelayedBinDesc.push_back(Desc);
- return true;
- }
-
- void registerDelayedLibraries() {
- // Only called by libomptarget constructor
- RTLsLoaded = true;
- for (auto *Desc : DelayedBinDesc)
- __tgt_register_lib(Desc);
- DelayedBinDesc.clear();
- }
int getNumDevices() {
std::lock_guard<decltype(RTLsMtx)> Lock(RTLsMtx);
diff --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp
index 62cf2262deb62..b27410ed12eaf 100644
--- a/openmp/libomptarget/src/interface.cpp
+++ b/openmp/libomptarget/src/interface.cpp
@@ -46,9 +46,6 @@ EXTERN void __tgt_register_requires(int64_t Flags) {
/// adds a target shared library to the target execution image
EXTERN void __tgt_register_lib(__tgt_bin_desc *Desc) {
TIMESCOPE();
- if (PM->delayRegisterLib(Desc))
- return;
-
PM->registerLib(Desc);
}
diff --git a/openmp/libomptarget/src/rtl.cpp b/openmp/libomptarget/src/rtl.cpp
index 5eb1c553df491..27db7034d8956 100644
--- a/openmp/libomptarget/src/rtl.cpp
+++ b/openmp/libomptarget/src/rtl.cpp
@@ -51,7 +51,6 @@ __attribute__((constructor(101))) void init() {
PM->init();
Profiler::get();
- PM->registerDelayedLibraries();
}
__attribute__((destructor(101))) void deinit() {
More information about the Openmp-commits
mailing list