[llvm] [offload] Add early exit on plugin deinit when offloading is disabled (PR #134090)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 2 07:28:00 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-offload

Author: Michael Halkenhäuser (mhalk)

<details>
<summary>Changes</summary>

Add early exit during plugin de-init
 - when OffloadPolicy::isOffloadDisabled
 - e.g.: `OMP_TARGET_OFFLOAD=DISABLED`

See also: https://github.com/llvm/llvm-project/pull/133470

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


1 Files Affected:

- (modified) offload/libomptarget/PluginManager.cpp (+5) 


``````````diff
diff --git a/offload/libomptarget/PluginManager.cpp b/offload/libomptarget/PluginManager.cpp
index d6d529a207587..d9c068b313251 100644
--- a/offload/libomptarget/PluginManager.cpp
+++ b/offload/libomptarget/PluginManager.cpp
@@ -51,6 +51,11 @@ void PluginManager::init() {
 
 void PluginManager::deinit() {
   TIMESCOPE();
+  if (OffloadPolicy::isOffloadDisabled()) {
+    DP("Offload is disabled. Skipping plugin deinitialization\n");
+    return;
+  }
+
   DP("Unloading RTLs...\n");
 
   for (auto &Plugin : Plugins) {

``````````

</details>


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


More information about the llvm-commits mailing list