Skip to content

Commit f284af4

Browse files
committed
[Offload][Fix] Fix lazy initialization with multiple images
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.
1 parent d490ce2 commit f284af4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

offload/src/PluginManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ void PluginManager::registerLib(__tgt_bin_desc *Desc) {
155155

156156
// Initialize all the plugins that have associated images.
157157
for (auto &Plugin : Plugins) {
158-
if (Plugin->is_initialized())
159-
continue;
160-
161158
// Extract the exectuable image and extra information if availible.
162159
for (int32_t i = 0; i < Desc->NumDeviceImages; ++i) {
160+
if (Plugin->is_initialized())
161+
continue;
162+
163163
if (!Plugin->is_valid_binary(&Desc->DeviceImages[i],
164164
/*Initialized=*/false))
165165
continue;

0 commit comments

Comments
 (0)