[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
================
@@ -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()) {
----------------
jdoerfert wrote:
Technically we'd only need to iterate over the new ones, doubtful it will ever matter.
https://github.com/llvm/llvm-project/pull/76174
More information about the Openmp-commits
mailing list