Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sycl/source/detail/kernel_program_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ KernelProgramCache::~KernelProgramCache() {
Plugin.call<PiApiKind::piKernelRelease>(Kern);
}
}
MKernelsPerProgramCache.erase(KernIt);
}

const detail::plugin &Plugin = MParentContext->getPlugin();
Expand Down
7 changes: 5 additions & 2 deletions sycl/source/detail/program_manager/program_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,11 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
// Cache supports key with once device only, but here we have multiple
// devices a program is built for, so add the program to the cache for all
// other devices.
auto CacheOtherDevices = [ResProgram]() { return ResProgram; };
const detail::plugin &Plugin = ContextImpl->getPlugin();
auto CacheOtherDevices = [ResProgram, &Plugin]() {
Plugin.call<PiApiKind::piProgramRetain>(ResProgram);
return ResProgram;
};

// The program for device "0" is already added to the cache during the first
// call to getOrBuild, so starting with "1"
Expand All @@ -1817,7 +1821,6 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
// devive_image_impl shares ownership of PIProgram with, at least, program
// cache. The ref counter will be descremented in the destructor of
// device_image_impl
const detail::plugin &Plugin = ContextImpl->getPlugin();
Plugin.call<PiApiKind::piProgramRetain>(ResProgram);

DeviceImageImplPtr ExecImpl = std::make_shared<detail::device_image_impl>(
Expand Down