summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-05-28 10:50:28 -0500
committerJoseph Huber <huberjn@outlook.com>2024-05-28 10:51:53 -0500
commitf284af4863640e6b68918aa23b14498c1b8e2245 (patch)
treeef54868f314d1e9878a7d88c56a71166e196b6d9
parentd490ce22e93db2e9d57985bc50915e383327911f (diff)
[Offload][Fix] Fix lazy initialization with multiple imagesusers/daltenty/test
Summary: There was a bug here where we would initialize the plugin multiple times when there were multiple images. Fix it by putting the `is_initliaized` check later.
-rw-r--r--offload/src/PluginManager.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/offload/src/PluginManager.cpp b/offload/src/PluginManager.cpp
index f72007849e36..13f08b142b87 100644
--- a/offload/src/PluginManager.cpp
+++ b/offload/src/PluginManager.cpp
@@ -155,11 +155,11 @@ void PluginManager::registerLib(__tgt_bin_desc *Desc) {
// Initialize all the plugins that have associated images.
for (auto &Plugin : Plugins) {
- if (Plugin->is_initialized())
- continue;
-
// Extract the exectuable image and extra information if availible.
for (int32_t i = 0; i < Desc->NumDeviceImages; ++i) {
+ if (Plugin->is_initialized())
+ continue;
+
if (!Plugin->is_valid_binary(&Desc->DeviceImages[i],
/*Initialized=*/false))
continue;