Skip to content

Commit 49a3828

Browse files
committed
multiple devices
1 parent a571185 commit 49a3828

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

sycl/source/detail/kernel_bundle_impl.hpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,7 @@ class kernel_bundle_impl {
407407
const AdapterPtr &Adapter = ContextImpl->getAdapter();
408408

409409
std::string UserArgs = syclex::detail::userArgsAsString(BuildOptions);
410-
auto BinProg = PersistentDeviceCodeCache::getCompiledKernelFromDisc(
411-
Devices[0], UserArgs, SourceStr);
412-
if (!BinProg.empty()) {
410+
413411
std::vector<ur_device_handle_t> DeviceHandles;
414412
std::transform(Devices.begin(), Devices.end(),
415413
std::back_inserter(DeviceHandles), [](const device &Dev) {
@@ -418,11 +416,20 @@ class kernel_bundle_impl {
418416

419417
std::vector<const uint8_t *> Binaries;
420418
std::vector<size_t> Lengths;
419+
std::vector<std::vector<std::vector<char>>> PersistentBinaries;
421420
for (size_t i = 0; i < Devices.size(); i++) {
422-
auto BinProg = PersistentDeviceCodeCache::getCompiledKernelFromDisc(
423-
Devices[i], UserArgs, SourceStr);
424-
Binaries.push_back((uint8_t *)(BinProg.data()));
425-
Lengths.push_back(BinProg.size());
421+
std::vector<std::vector<char>> BinProg =
422+
PersistentDeviceCodeCache::getCompiledKernelFromDisc(
423+
Devices[i], UserArgs, SourceStr);
424+
425+
// exit if any device binary is missing
426+
if (BinProg.empty()) {
427+
return false;
428+
}
429+
PersistentBinaries.push_back(BinProg);
430+
431+
Binaries.push_back((uint8_t *)(BinProg[0].data()));
432+
Lengths.push_back(BinProg[0].size());
426433
}
427434

428435
ur_program_properties_t Properties = {};
@@ -435,8 +442,8 @@ class kernel_bundle_impl {
435442
ContextImpl->getHandleRef(), DeviceHandles.size(),
436443
DeviceHandles.data(), Lengths.data(), Binaries.data(), &Properties,
437444
&UrProgram);
438-
}
439-
return false;
445+
446+
return true;
440447
}
441448

442449
std::shared_ptr<kernel_bundle_impl>

0 commit comments

Comments
 (0)