Skip to content

Commit 74bf30a

Browse files
[SYCL] Fix kernel_compiler leak. (#12120)
CreateProgram and CreateKernel APIs implicitly retain program and kernels. Extra call to retain is incorrect.
1 parent 7528ef0 commit 74bf30a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sycl/source/detail/kernel_bundle_impl.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ class kernel_bundle_impl {
369369
const PluginPtr &Plugin = ContextImpl->getPlugin();
370370
Plugin->call<PiApiKind::piProgramCreate>(
371371
ContextImpl->getHandleRef(), spirv.data(), spirv.size(), &PiProgram);
372-
373-
Plugin->call<PiApiKind::piProgramRetain>(PiProgram);
372+
// program created by piProgramCreate is implicitly retained.
374373

375374
std::vector<pi::PiDevice> DeviceVec;
376375
DeviceVec.reserve(Devices.size());
@@ -437,8 +436,7 @@ class kernel_bundle_impl {
437436
const PluginPtr &Plugin = ContextImpl->getPlugin();
438437
sycl::detail::pi::PiKernel PiKernel = nullptr;
439438
Plugin->call<PiApiKind::piKernelCreate>(PiProgram, Name.c_str(), &PiKernel);
440-
441-
Plugin->call<PiApiKind::piKernelRetain>(PiKernel);
439+
// Kernel created by piKernelCreate is implicitly retained.
442440

443441
std::shared_ptr<kernel_impl> KernelImpl = std::make_shared<kernel_impl>(
444442
PiKernel, detail::getSyclObjImpl(MContext), Self);

0 commit comments

Comments
 (0)