[Openmp-commits] [openmp] [Libomptarget] Only initialize a plugin if a device image needs it (PR #76174)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 21 15:36:16 PST 2023


================
@@ -162,6 +145,28 @@ void PluginAdaptorTy::initDevices(PluginManager &PM) {
      NumberOfPluginDevices);
 }
 
+Error PluginAdaptorTy::initPlugin() {
+  // Remove plugin on failure to call optional init_plugin
+  int32_t Rc = init_plugin();
+  if (Rc != OFFLOAD_SUCCESS) {
+    return createStringError(inconvertibleErrorCode(),
+                             "Unable to initialize library '%s': %u!\n",
+                             Name.c_str(), Rc);
+  }
----------------
jdoerfert wrote:

if (int32_t Rc = ...)
  return ...

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


More information about the Openmp-commits mailing list