[llvm] [OFFLOAD] Stricter enforcement of user offload disable (PR #133470)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 13:13:10 PDT 2025


================
@@ -31,6 +32,12 @@ void initRuntime() {
   if (PM == nullptr)
     PM = new PluginManager();
 
+  if (OffloadPolicy::isOffloadDisabled()) {
----------------
adurang wrote:

Well, because it gets never positive values it will never be deallocated so I think it shouldn't really crash. But yes, in any case, I fully agree that we shouldn't rely on such a weird behavior. But rather than just skipping init I don't think we should initialize OMPT either. What about chaging:

`if (RefCount == 1) `

to

`if (RefCount == 1 && !OffloadPolicy::isOffloadDisabled())`

?


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


More information about the llvm-commits mailing list