Skip to content

Commit f119000

Browse files
[SYCL] Retain event in old OpenCL interop constructor (#6214)
#6180 moved the retain logic for events to the make_event interop API. However, this means that the old OpenCL interop constructor for event does not retain the native event. These changes add the retain logic directly to the old OpenCL interop constructor for OpenCL. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent f6420c7 commit f119000

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sycl/source/event.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ event::event() : impl(std::make_shared<detail::event_impl>()) {}
2626

2727
event::event(cl_event ClEvent, const context &SyclContext)
2828
: impl(std::make_shared<detail::event_impl>(
29-
detail::pi::cast<RT::PiEvent>(ClEvent), SyclContext)) {}
29+
detail::pi::cast<RT::PiEvent>(ClEvent), SyclContext)) {
30+
// This is a special interop constructor for OpenCL, so the event must be
31+
// retained.
32+
impl->getPlugin().call<detail::PiApiKind::piEventRetain>(
33+
detail::pi::cast<RT::PiEvent>(ClEvent));
34+
}
3035

3136
bool event::operator==(const event &rhs) const { return rhs.impl == impl; }
3237

0 commit comments

Comments
 (0)