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

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 21 15:38:21 PST 2023


================
@@ -203,6 +208,24 @@ void PluginManager::registerLib(__tgt_bin_desc *Desc) {
   for (int32_t i = 0; i < Desc->NumDeviceImages; ++i)
     PM->addDeviceImage(*Desc, Desc->DeviceImages[i]);
 
+  // Initialize any needed plugins using the image metadata if needed.
+  for (auto &R : PM->pluginAdaptors()) {
+    if (R.is_plugin_active())
+      continue;
+
+    // We can skip initializing this image if there are no images for it.
+    for (DeviceImageTy &DI : PM->deviceImages()) {
----------------
jhuber6 wrote:

True, can just get them from the image passed in.

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


More information about the Openmp-commits mailing list