Skip to content

Commit a32021b

Browse files
[SYCL] Fix retaining of kernels in old kernel interop (#7034)
#6980 caused some unexpected regressions on OpenCL for SYCL 1.2.1 kernel interop constructors. This commit reintroduces the call to retaining the OpenCL kernel only for the old constructor. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent c2a0db0 commit a32021b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sycl/source/kernel.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ __SYCL_INLINE_VER_NAMESPACE(_V1) {
1919
kernel::kernel(cl_kernel ClKernel, const context &SyclContext)
2020
: impl(std::make_shared<detail::kernel_impl>(
2121
detail::pi::cast<detail::RT::PiKernel>(ClKernel),
22-
detail::getSyclObjImpl(SyclContext), nullptr)) {}
22+
detail::getSyclObjImpl(SyclContext), nullptr)) {
23+
// This is a special interop constructor for OpenCL, so the kernel must be
24+
// retained.
25+
impl->getPlugin().call<detail::PiApiKind::piKernelRetain>(
26+
detail::pi::cast<detail::RT::PiKernel>(ClKernel));
27+
}
2328

2429
cl_kernel kernel::get() const { return impl->get(); }
2530

0 commit comments

Comments
 (0)