[llvm] [offload] check olInit error in unittests initialisation (PR #206764)

Alex Duran via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 09:55:17 PDT 2026


================
@@ -19,7 +20,14 @@ using namespace llvm;
 // test, while having sensible lifetime for the platform environment
 #ifndef DISABLE_WRAPPER
 struct OffloadInitWrapper {
-  OffloadInitWrapper() { olInit(nullptr); }
+  OffloadInitWrapper() {
+    if (ol_result_t Res = olInit(nullptr)) {
+      errs() << "olInit failed: "
+             << (Res->Details ? Res->Details : "(no details)") << " (code "
+             << Res->Code << ")\n";
+      std::abort();
+    }
+  }
   ~OffloadInitWrapper() { olShutDown(); }
----------------
adurang wrote:

Should we also check at shutdown just in case?

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


More information about the llvm-commits mailing list