[Openmp-commits] [openmp] 2b2e711 - [OpenMP][NFC] Remove no-op __tgt_rtl_deinit_plugin
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Mon Nov 27 11:08:17 PST 2023
Author: Johannes Doerfert
Date: 2023-11-27T11:07:57-08:00
New Revision: 2b2e711afcc3b627284538c965351add6608cc64
URL: https://github.com/llvm/llvm-project/commit/2b2e711afcc3b627284538c965351add6608cc64
DIFF: https://github.com/llvm/llvm-project/commit/2b2e711afcc3b627284538c965351add6608cc64.diff
LOG: [OpenMP][NFC] Remove no-op __tgt_rtl_deinit_plugin
The order in which we deinit things, especially when shared libraries
are involved, is complicated. To simplify our lives the nextgen plugin
deinitializes the GenericPluginTy and subclasses automatically. The old
__tgt_rtl_deinit_plugin is not needed anymore.
Added:
Modified:
openmp/libomptarget/include/omptargetplugin.h
openmp/libomptarget/include/rtl.h
openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
openmp/libomptarget/src/rtl.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/include/omptargetplugin.h b/openmp/libomptarget/include/omptargetplugin.h
index 2580731112da2ca..40e58665b099583 100644
--- a/openmp/libomptarget/include/omptargetplugin.h
+++ b/openmp/libomptarget/include/omptargetplugin.h
@@ -23,9 +23,6 @@ extern "C" {
// First method called on the plugin
int32_t __tgt_rtl_init_plugin();
-// Last method called on the plugin
-int32_t __tgt_rtl_deinit_plugin();
-
// Return the number of available devices of the type supported by the
// target RTL.
int32_t __tgt_rtl_number_of_devices(void);
diff --git a/openmp/libomptarget/include/rtl.h b/openmp/libomptarget/include/rtl.h
index b305b8f9c398fc6..d5ac097302194f5 100644
--- a/openmp/libomptarget/include/rtl.h
+++ b/openmp/libomptarget/include/rtl.h
@@ -32,7 +32,6 @@ struct __tgt_bin_desc;
struct RTLInfoTy {
typedef int32_t(init_plugin_ty)();
- typedef int32_t(deinit_plugin_ty)();
typedef int32_t(is_valid_binary_ty)(void *);
typedef int32_t(is_valid_binary_info_ty)(void *, void *);
typedef int32_t(is_data_exchangable_ty)(int32_t, int32_t);
@@ -90,7 +89,6 @@ struct RTLInfoTy {
// Functions implemented in the RTL.
init_plugin_ty *init_plugin = nullptr;
- deinit_plugin_ty *deinit_plugin = nullptr;
is_valid_binary_ty *is_valid_binary = nullptr;
is_valid_binary_info_ty *is_valid_binary_info = nullptr;
is_data_exchangable_ty *is_data_exchangable = nullptr;
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
index fb4db4adf0a367e..f517c8371b334d7 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
@@ -1632,17 +1632,6 @@ int32_t __tgt_rtl_init_plugin() {
return OFFLOAD_SUCCESS;
}
-int32_t __tgt_rtl_deinit_plugin() {
- auto Err = Plugin::deinitIfNeeded();
- if (Err) {
- REPORT("Failure to deinitialize plugin " GETNAME(TARGET_NAME) ": %s\n",
- toString(std::move(Err)).data());
- return OFFLOAD_FAIL;
- }
-
- return OFFLOAD_SUCCESS;
-}
-
int32_t __tgt_rtl_is_valid_binary(__tgt_device_image *TgtImage) {
if (!Plugin::isActive())
return false;
diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
index 9174ecaab08ca00..fdbe23eeb2c0412 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
@@ -1167,13 +1167,6 @@ class Plugin {
return Error::success();
}
- // Deinitialize the plugin if needed. The plugin could have been deinitialized
- // because the plugin library was exiting.
- static Error deinitIfNeeded() {
- // Do nothing. The plugin is deinitialized automatically.
- return Plugin::success();
- }
-
/// Get a reference (or create if it was not created) to the plugin instance.
static GenericPluginTy &get() {
// This static variable will initialize the underlying plugin instance in
diff --git a/openmp/libomptarget/src/rtl.cpp b/openmp/libomptarget/src/rtl.cpp
index b48a3fccd86fccb..4688f3ed53af88d 100644
--- a/openmp/libomptarget/src/rtl.cpp
+++ b/openmp/libomptarget/src/rtl.cpp
@@ -193,8 +193,6 @@ bool RTLsTy::attemptLoadRTL(const std::string &RTLName, RTLInfoTy &RTL) {
DP("Registering RTL %s supporting %d devices!\n", Name, RTL.NumberOfDevices);
// Optional functions
- *((void **)&RTL.deinit_plugin) =
- DynLibrary->getAddressOfSymbol("__tgt_rtl_deinit_plugin");
*((void **)&RTL.is_valid_binary_info) =
DynLibrary->getAddressOfSymbol("__tgt_rtl_is_valid_binary_info");
*((void **)&RTL.deinit_device) =
@@ -598,14 +596,5 @@ void RTLsTy::unregisterLib(__tgt_bin_desc *Desc) {
PM->TblMapMtx.unlock();
- // TODO: Write some RTL->unload_image(...) function?
- for (auto *R : UsedRTLs) {
- if (R->deinit_plugin) {
- if (R->deinit_plugin() != OFFLOAD_SUCCESS) {
- DP("Failure deinitializing RTL %s!\n", R->RTLName.c_str());
- }
- }
- }
-
DP("Done unregistering library!\n");
}
More information about the Openmp-commits
mailing list