[llvm] [offload][nfc] Decouple OpenMP offload policy from PluginManager (PR #220761)

Ivan R. Ivanov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 05:57:52 PDT 2026


https://github.com/ivanradanov updated https://github.com/llvm/llvm-project/pull/220761

>From 5826d51b69ffb3c00b8f985f1df714e8ed4ce8c2 Mon Sep 17 00:00:00 2001
From: Ivan Radanov Ivanov <iivanov at nvidia.com>
Date: Tue, 1 Sep 2026 15:31:30 -0700
Subject: [PATCH] decouple openmp

---
 offload/libompaccsupport/PluginManager.cpp | 5 -----
 offload/libomptarget/OffloadRTL.cpp        | 6 +++++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/offload/libompaccsupport/PluginManager.cpp b/offload/libompaccsupport/PluginManager.cpp
index 5f67a204f4203..1d1eff75c9f57 100644
--- a/offload/libompaccsupport/PluginManager.cpp
+++ b/offload/libompaccsupport/PluginManager.cpp
@@ -11,7 +11,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "PluginManager.h"
-#include "OffloadPolicy.h"
 #include "OpenMP/OMPT/Interface.h"
 #include "Shared/Debug.h"
 #include "Shared/Profile.h"
@@ -37,10 +36,6 @@ PluginManager *PM = nullptr;
 
 void PluginManager::init() {
   TIMESCOPE();
-  if (OffloadPolicy::isOffloadDisabled()) {
-    ODBG(ODT_Init) << "Offload is disabled. Skipping plugin initialization";
-    return;
-  }
 
   ODBG(ODT_Init) << "Loading RTLs";
 
diff --git a/offload/libomptarget/OffloadRTL.cpp b/offload/libomptarget/OffloadRTL.cpp
index 96e4027dfc99f..c93221dce2e5e 100644
--- a/offload/libomptarget/OffloadRTL.cpp
+++ b/offload/libomptarget/OffloadRTL.cpp
@@ -10,6 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "OffloadPolicy.h"
 #include "OpenMP/OMPT/Callback.h"
 #include "PluginManager.h"
 
@@ -50,7 +51,10 @@ void initRuntime() {
     llvm::omp::target::ompt::connectLibrary();
 #endif
 
-    PM->init();
+    if (!OffloadPolicy::isOffloadDisabled())
+      PM->init();
+    else
+      ODBG(ODT_Init) << "Offload is disabled. Skipping plugin initialization";
     PM->registerDelayedLibraries();
 
     // RTL initialization is complete



More information about the llvm-commits mailing list