Skip to content

Commit

Permalink
[SYCL] Fix retaining of kernels in old kernel interop (#7034)
Browse files Browse the repository at this point in the history
#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 <steffen.larsen@intel.com>
  • Loading branch information
steffenlarsen committed Oct 12, 2022
1 parent c2a0db0 commit a32021b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sycl/source/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ __SYCL_INLINE_VER_NAMESPACE(_V1) {
kernel::kernel(cl_kernel ClKernel, const context &SyclContext)
: impl(std::make_shared<detail::kernel_impl>(
detail::pi::cast<detail::RT::PiKernel>(ClKernel),
detail::getSyclObjImpl(SyclContext), nullptr)) {}
detail::getSyclObjImpl(SyclContext), nullptr)) {
// This is a special interop constructor for OpenCL, so the kernel must be
// retained.
impl->getPlugin().call<detail::PiApiKind::piKernelRetain>(
detail::pi::cast<detail::RT::PiKernel>(ClKernel));
}

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

Expand Down

0 comments on commit a32021b

Please sign in to comment.