From 0b03757f7a32b75038b82eb5e5a490f11821cc9c Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Wed, 15 Jul 2026 10:06:15 +0000 Subject: [PATCH 1/8] [SYCL] Reusable Events limitation for cross-context dependencies. Currently, cross-context dependencies are not supported for the Reusable Events APIs. Cross-context dependencies use host tasks internally, so the event wait might be queued behind the host task in the runtime, which is currently not supported by the extension APIs. --- sycl/source/detail/queue_impl.cpp | 8 +++- sycl/source/reusable_events.cpp | 26 +++++++++++ sycl/unittests/Extensions/ReusableEvents.cpp | 46 -------------------- 3 files changed, 33 insertions(+), 47 deletions(-) diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index fbfadfc8c39e8..ac84c9491653e 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -615,11 +615,17 @@ EventImplPtr queue_impl::submit_barrier_direct_impl( /*SchedulerBypass*/ true}; } - if (EventForReuse) { + if (EventForReuse || !CallerNeedsEvent) { // Current limitation: reusable events require scheduler bypass so that // the barrier can be submitted directly to the backend with the reusable // event's handle as the output event. Scheduler bypass is not possible // when dependencies include host tasks or cross-context dependencies. + // + // This limitation applies to both: enqueue_signal_event and + // enqueue_wait_event(s). + // + // The !CallerNeedsEvent condition is used to detect the + // enqueue_wait_event(s) function calls. throw sycl::exception(sycl::make_error_code(errc::invalid), "An event cannot be enqueued for signaling behind " "a command which is not enqueued in the backend."); diff --git a/sycl/source/reusable_events.cpp b/sycl/source/reusable_events.cpp index 642edd4e298d8..2cf719051cdb7 100644 --- a/sycl/source/reusable_events.cpp +++ b/sycl/source/reusable_events.cpp @@ -60,6 +60,18 @@ __SYCL_EXPORT sycl::event make_event(const sycl::context &ctxt, __SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); + detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); + + // Current limitation: + // The queue and an event need to be in the same context. The reason + // is, that cross-context dependencies use host tasks, and the wait + // command might be queued in the runtime. This flow is currently + // not supported by the Reusable Events APIs. + if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { + throw sycl::exception( + sycl::make_error_code(errc::invalid), + "A queue and an event need to be in the same context."); + } QueueImpl.submit_barrier_direct_without_event( sycl::span(&evt, 1), detail::CGType::BarrierWaitlist, @@ -70,6 +82,20 @@ __SYCL_EXPORT void enqueue_wait_events(sycl::queue q, const std::vector &evts) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); + // Current limitation: + // The queue and all the events need to be in the same context. The + // reason is, that cross-context dependencies use host tasks, and the + // wait command might be queued in the runtime. This flow is currently + // not supported by the Reusable Events APIs. + for (sycl::event evt : evts) { + detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); + if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { + throw sycl::exception( + sycl::make_error_code(errc::invalid), + "A queue and all the events need to be in the same context."); + } + } + QueueImpl.submit_barrier_direct_without_event( evts, detail::CGType::BarrierWaitlist, detail::code_location::current()); } diff --git a/sycl/unittests/Extensions/ReusableEvents.cpp b/sycl/unittests/Extensions/ReusableEvents.cpp index f572f25e8fcba..f3fbb7164956d 100644 --- a/sycl/unittests/Extensions/ReusableEvents.cpp +++ b/sycl/unittests/Extensions/ReusableEvents.cpp @@ -443,52 +443,6 @@ TEST_F(ReusableEventsTest, EventInDependsOn) { Queue.wait(); } -// Cross-context events with wait -TEST_F(ReusableEventsTest, CrossContextEventWait) { - mock::getCallbacks().set_replace_callback("urDeviceGet", - &redefinedUrDeviceGet); - mock::getCallbacks().set_replace_callback("urDeviceRelease", - &redefinedUrDeviceRelease); - - sycl::platform Plt = sycl::platform(); - auto Devices = Plt.get_devices(); - - if (Devices.size() < 2) { - GTEST_SKIP() << "Need at least 2 devices for this test"; - } - - const sycl::device Dev1 = Devices[0]; - const sycl::device Dev2 = Devices[1]; - sycl::context Ctx1{Dev1}; - sycl::context Ctx2{Dev2}; - - sycl::queue Queue1{Ctx1, Dev1}; - sycl::queue Queue2{Ctx2, Dev2}; - - auto event = syclex::make_event(Ctx1); - - mock::getCallbacks().set_replace_callback( - "urEnqueueEventsWaitWithBarrierExt", - &redefinedUrEnqueueEventsWaitWithBarrierExt_signal); - - syclex::enqueue_signal_event(Queue1, event); - - EXPECT_EQ(RedefinedUrEnqueueEventsWaitWithBarrierExt_signal_counter, 1); - - ExpectedNumEventsInWaitList = 1; - mock::getCallbacks().set_replace_callback( - "urEnqueueEventsWaitWithBarrierExt", - &redefinedUrEnqueueEventsWaitWithBarrierExt_wait); - - // Event from different context should still work with enqueue_wait_event - EXPECT_NO_THROW({ syclex::enqueue_wait_event(Queue2, event); }); - - EXPECT_EQ(RedefinedUrEnqueueEventsWaitWithBarrierExt_wait_counter, 1); - - Queue1.wait(); - Queue2.wait(); -} - // Cross-context make_event and signal event - not allowed TEST_F(ReusableEventsTest, CrossContextMakeEventSignalEvent) { mock::getCallbacks().set_replace_callback("urDeviceGet", From 9b600ddec41cc1355412645d29d9349d64a4e5ee Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Fri, 17 Jul 2026 09:47:30 +0000 Subject: [PATCH 2/8] Update the unit tests to check for the exception, change the exception messages. --- sycl/source/reusable_events.cpp | 5 +- sycl/unittests/Extensions/ReusableEvents.cpp | 93 ++++++++++++++++++++ 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/sycl/source/reusable_events.cpp b/sycl/source/reusable_events.cpp index 2cf719051cdb7..c103ba0637312 100644 --- a/sycl/source/reusable_events.cpp +++ b/sycl/source/reusable_events.cpp @@ -70,7 +70,7 @@ __SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { throw sycl::exception( sycl::make_error_code(errc::invalid), - "A queue and an event need to be in the same context."); + "Not implemented yet. Event context must match the queue context."); } QueueImpl.submit_barrier_direct_without_event( @@ -92,7 +92,8 @@ __SYCL_EXPORT void enqueue_wait_events(sycl::queue q, if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { throw sycl::exception( sycl::make_error_code(errc::invalid), - "A queue and all the events need to be in the same context."); + "Not implemented yet. Context of all events must match the " + "queue context."); } } diff --git a/sycl/unittests/Extensions/ReusableEvents.cpp b/sycl/unittests/Extensions/ReusableEvents.cpp index f3fbb7164956d..828176517660d 100644 --- a/sycl/unittests/Extensions/ReusableEvents.cpp +++ b/sycl/unittests/Extensions/ReusableEvents.cpp @@ -443,6 +443,99 @@ TEST_F(ReusableEventsTest, EventInDependsOn) { Queue.wait(); } +// Cross-context event with wait. +// Current limitation is that the cross-context wait +// is not supported. +TEST_F(ReusableEventsTest, CrossContextEventWait) { + mock::getCallbacks().set_replace_callback("urDeviceGet", + &redefinedUrDeviceGet); + mock::getCallbacks().set_replace_callback("urDeviceRelease", + &redefinedUrDeviceRelease); + + sycl::platform Plt = sycl::platform(); + auto Devices = Plt.get_devices(); + + if (Devices.size() < 2) { + GTEST_SKIP() << "Need at least 2 devices for this test"; + } + + const sycl::device Dev1 = Devices[0]; + const sycl::device Dev2 = Devices[1]; + sycl::context Ctx1{Dev1}; + sycl::context Ctx2{Dev2}; + + sycl::queue Queue1{Ctx1, Dev1}; + sycl::queue Queue2{Ctx2, Dev2}; + + auto event = syclex::make_event(Ctx1); + + bool exception = false; + + // Current limiation is that an event from different context + // cannot be used with enqueue_wait_event + try { + syclex::enqueue_wait_event(Queue2, event); + } catch (sycl::exception const &e) { + exception = true; + EXPECT_EQ(e.code(), sycl::errc::invalid); + EXPECT_STREQ(e.what(), "Not implemented yet. Event context must " + "match the queue context."); + } + + EXPECT_TRUE(exception); + + Queue1.wait(); + Queue2.wait(); +} + +// Cross-context events with wait (multiple events). +// Current limitation is that the cross-context wait +// is not supported. +TEST_F(ReusableEventsTest, CrossContextEventsWait) { + mock::getCallbacks().set_replace_callback("urDeviceGet", + &redefinedUrDeviceGet); + mock::getCallbacks().set_replace_callback("urDeviceRelease", + &redefinedUrDeviceRelease); + + sycl::platform Plt = sycl::platform(); + auto Devices = Plt.get_devices(); + + if (Devices.size() < 2) { + GTEST_SKIP() << "Need at least 2 devices for this test"; + } + + const sycl::device Dev1 = Devices[0]; + const sycl::device Dev2 = Devices[1]; + sycl::context Ctx1{Dev1}; + sycl::context Ctx2{Dev2}; + + sycl::queue Queue1{Ctx1, Dev1}; + sycl::queue Queue2{Ctx2, Dev2}; + + auto event1 = syclex::make_event(Ctx1); + auto event2 = syclex::make_event(Ctx1); + + std::vector events{event1, event2}; + + bool exception = false; + + // Current limiation is that an event from different context + // cannot be used with enqueue_wait_event + try { + syclex::enqueue_wait_events(Queue2, events); + } catch (sycl::exception const &e) { + exception = true; + EXPECT_EQ(e.code(), sycl::errc::invalid); + EXPECT_STREQ(e.what(), "Not implemented yet. Context of all events must " + "match the queue context."); + } + + EXPECT_TRUE(exception); + + Queue1.wait(); + Queue2.wait(); +} + // Cross-context make_event and signal event - not allowed TEST_F(ReusableEventsTest, CrossContextMakeEventSignalEvent) { mock::getCallbacks().set_replace_callback("urDeviceGet", From 43248d49f79d75a67f2529c5eb39cc5b0ad75542 Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Fri, 17 Jul 2026 10:56:36 +0000 Subject: [PATCH 3/8] Extend the exception message. --- sycl/source/detail/queue_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index ac84c9491653e..f5ac91d69626f 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -627,8 +627,8 @@ EventImplPtr queue_impl::submit_barrier_direct_impl( // The !CallerNeedsEvent condition is used to detect the // enqueue_wait_event(s) function calls. throw sycl::exception(sycl::make_error_code(errc::invalid), - "An event cannot be enqueued for signaling behind " - "a command which is not enqueued in the backend."); + "An event cannot be enqueued for signaling or waiting " + "behind a command which is not enqueued in the backend."); } std::unique_ptr CommandGroup; From 2a7b444af6ea635e3decb21769582f530d6f3c39 Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Mon, 20 Jul 2026 14:57:32 +0000 Subject: [PATCH 4/8] Check for host event, const reference in a loop. --- sycl/source/reusable_events.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sycl/source/reusable_events.cpp b/sycl/source/reusable_events.cpp index c103ba0637312..a0711fe28805d 100644 --- a/sycl/source/reusable_events.cpp +++ b/sycl/source/reusable_events.cpp @@ -62,6 +62,11 @@ __SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); + if (EventImpl.isHost()) { + throw sycl::exception(sycl::make_error_code(errc::invalid), + "Host events cannot be enqueued for waiting."); + } + // Current limitation: // The queue and an event need to be in the same context. The reason // is, that cross-context dependencies use host tasks, and the wait @@ -82,13 +87,19 @@ __SYCL_EXPORT void enqueue_wait_events(sycl::queue q, const std::vector &evts) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); - // Current limitation: - // The queue and all the events need to be in the same context. The - // reason is, that cross-context dependencies use host tasks, and the - // wait command might be queued in the runtime. This flow is currently - // not supported by the Reusable Events APIs. - for (sycl::event evt : evts) { + for (const sycl::event &evt : evts) { detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); + + if (EventImpl.isHost()) { + throw sycl::exception(sycl::make_error_code(errc::invalid), + "Host events cannot be enqueued for waiting."); + } + + // Current limitation: + // The queue and all the events need to be in the same context. The + // reason is, that cross-context dependencies use host tasks, and the + // wait command might be queued in the runtime. This flow is currently + // not supported by the Reusable Events APIs. if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { throw sycl::exception( sycl::make_error_code(errc::invalid), @@ -105,6 +116,11 @@ __SYCL_EXPORT void enqueue_signal_event(sycl::queue q, event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); + if (EventImpl.isHost()) { + throw sycl::exception(sycl::make_error_code(errc::invalid), + "Host events cannot be enqueued for signaling."); + } + if (EventImpl.isInterop()) { throw sycl::exception( sycl::make_error_code(errc::runtime), From fbfbce38f4da75afb04ddb1332bcb79fd4ae9a9d Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Mon, 20 Jul 2026 17:10:01 +0000 Subject: [PATCH 5/8] Review comments. --- sycl/source/detail/queue_impl.cpp | 7 ++++--- sycl/unittests/Extensions/ReusableEvents.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sycl/source/detail/queue_impl.cpp b/sycl/source/detail/queue_impl.cpp index f5ac91d69626f..939a60b90fda0 100644 --- a/sycl/source/detail/queue_impl.cpp +++ b/sycl/source/detail/queue_impl.cpp @@ -626,9 +626,10 @@ EventImplPtr queue_impl::submit_barrier_direct_impl( // // The !CallerNeedsEvent condition is used to detect the // enqueue_wait_event(s) function calls. - throw sycl::exception(sycl::make_error_code(errc::invalid), - "An event cannot be enqueued for signaling or waiting " - "behind a command which is not enqueued in the backend."); + throw sycl::exception( + sycl::make_error_code(errc::invalid), + "An event cannot be enqueued for signaling or waiting " + "behind a command which is not enqueued in the backend."); } std::unique_ptr CommandGroup; diff --git a/sycl/unittests/Extensions/ReusableEvents.cpp b/sycl/unittests/Extensions/ReusableEvents.cpp index 828176517660d..07afb4b0240ac 100644 --- a/sycl/unittests/Extensions/ReusableEvents.cpp +++ b/sycl/unittests/Extensions/ReusableEvents.cpp @@ -471,7 +471,7 @@ TEST_F(ReusableEventsTest, CrossContextEventWait) { bool exception = false; - // Current limiation is that an event from different context + // Current limitation is that an event from different context // cannot be used with enqueue_wait_event try { syclex::enqueue_wait_event(Queue2, event); @@ -519,7 +519,7 @@ TEST_F(ReusableEventsTest, CrossContextEventsWait) { bool exception = false; - // Current limiation is that an event from different context + // Current limitation is that an event from different context // cannot be used with enqueue_wait_event try { syclex::enqueue_wait_events(Queue2, events); From 4409e6736ec11c96b5143608e4662a20bd56c83c Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Tue, 21 Jul 2026 10:56:17 +0000 Subject: [PATCH 6/8] Address review comments. --- sycl/source/reusable_events.cpp | 59 ++++++-------------- sycl/unittests/Extensions/ReusableEvents.cpp | 18 +++--- 2 files changed, 25 insertions(+), 52 deletions(-) diff --git a/sycl/source/reusable_events.cpp b/sycl/source/reusable_events.cpp index a0711fe28805d..f70c07c8ed07b 100644 --- a/sycl/source/reusable_events.cpp +++ b/sycl/source/reusable_events.cpp @@ -56,12 +56,8 @@ __SYCL_EXPORT sycl::event make_event(const sycl::context &ctxt, return RetEvent; } -} // namespace detail - -__SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { - detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); - detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); - +void check_event_and_throw(detail::event_impl &EventImpl, + detail::context_impl &ContextImpl) { if (EventImpl.isHost()) { throw sycl::exception(sycl::make_error_code(errc::invalid), "Host events cannot be enqueued for waiting."); @@ -72,11 +68,19 @@ __SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { // is, that cross-context dependencies use host tasks, and the wait // command might be queued in the runtime. This flow is currently // not supported by the Reusable Events APIs. - if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { - throw sycl::exception( - sycl::make_error_code(errc::invalid), - "Not implemented yet. Event context must match the queue context."); + if (&EventImpl.getContextImpl() != &ContextImpl) { + throw sycl::exception(sycl::make_error_code(errc::invalid), + "Event context must match the queue context."); } +} + +} // namespace detail + +__SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { + detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); + detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); + + detail::check_event_and_throw(EventImpl, QueueImpl.getContextImpl()); QueueImpl.submit_barrier_direct_without_event( sycl::span(&evt, 1), detail::CGType::BarrierWaitlist, @@ -88,24 +92,8 @@ __SYCL_EXPORT void enqueue_wait_events(sycl::queue q, detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); for (const sycl::event &evt : evts) { - detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); - - if (EventImpl.isHost()) { - throw sycl::exception(sycl::make_error_code(errc::invalid), - "Host events cannot be enqueued for waiting."); - } - - // Current limitation: - // The queue and all the events need to be in the same context. The - // reason is, that cross-context dependencies use host tasks, and the - // wait command might be queued in the runtime. This flow is currently - // not supported by the Reusable Events APIs. - if (&QueueImpl.getContextImpl() != &EventImpl.getContextImpl()) { - throw sycl::exception( - sycl::make_error_code(errc::invalid), - "Not implemented yet. Context of all events must match the " - "queue context."); - } + detail::check_event_and_throw(*sycl::detail::getSyclObjImpl(evt), + QueueImpl.getContextImpl()); } QueueImpl.submit_barrier_direct_without_event( @@ -116,10 +104,7 @@ __SYCL_EXPORT void enqueue_signal_event(sycl::queue q, event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); - if (EventImpl.isHost()) { - throw sycl::exception(sycl::make_error_code(errc::invalid), - "Host events cannot be enqueued for signaling."); - } + detail::check_event_and_throw(EventImpl, QueueImpl.getContextImpl()); if (EventImpl.isInterop()) { throw sycl::exception( @@ -133,16 +118,6 @@ __SYCL_EXPORT void enqueue_signal_event(sycl::queue q, event &evt) { "on a queue which is recording a graph."); } - detail::context_impl &QueueContextImpl = - *sycl::detail::getSyclObjImpl(q.get_context()); - - detail::context_impl &EventContextImpl = EventImpl.getContextImpl(); - - if (&QueueContextImpl != &EventContextImpl) { - throw sycl::exception(sycl::make_error_code(errc::invalid), - "Event context must match the queue context."); - } - // An IPC event cannot be signaled on a profiling-enabled queue. if (EventImpl.isIPCEnabled() && QueueImpl.MIsProfilingEnabled) { throw sycl::exception( diff --git a/sycl/unittests/Extensions/ReusableEvents.cpp b/sycl/unittests/Extensions/ReusableEvents.cpp index 07afb4b0240ac..4080a14ec752f 100644 --- a/sycl/unittests/Extensions/ReusableEvents.cpp +++ b/sycl/unittests/Extensions/ReusableEvents.cpp @@ -478,8 +478,7 @@ TEST_F(ReusableEventsTest, CrossContextEventWait) { } catch (sycl::exception const &e) { exception = true; EXPECT_EQ(e.code(), sycl::errc::invalid); - EXPECT_STREQ(e.what(), "Not implemented yet. Event context must " - "match the queue context."); + EXPECT_STREQ(e.what(), "Event context must match the queue context."); } EXPECT_TRUE(exception); @@ -509,11 +508,12 @@ TEST_F(ReusableEventsTest, CrossContextEventsWait) { sycl::context Ctx1{Dev1}; sycl::context Ctx2{Dev2}; - sycl::queue Queue1{Ctx1, Dev1}; - sycl::queue Queue2{Ctx2, Dev2}; + sycl::queue Queue{Ctx1, Dev1}; + // Check if the exception is thrown if one of the events + // has different context than the queue. auto event1 = syclex::make_event(Ctx1); - auto event2 = syclex::make_event(Ctx1); + auto event2 = syclex::make_event(Ctx2); std::vector events{event1, event2}; @@ -522,18 +522,16 @@ TEST_F(ReusableEventsTest, CrossContextEventsWait) { // Current limitation is that an event from different context // cannot be used with enqueue_wait_event try { - syclex::enqueue_wait_events(Queue2, events); + syclex::enqueue_wait_events(Queue, events); } catch (sycl::exception const &e) { exception = true; EXPECT_EQ(e.code(), sycl::errc::invalid); - EXPECT_STREQ(e.what(), "Not implemented yet. Context of all events must " - "match the queue context."); + EXPECT_STREQ(e.what(), "Event context must match the queue context."); } EXPECT_TRUE(exception); - Queue1.wait(); - Queue2.wait(); + Queue.wait(); } // Cross-context make_event and signal event - not allowed From dca001e92362986a1e6bb44c16f6febaf84cef69 Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Tue, 21 Jul 2026 11:45:06 +0000 Subject: [PATCH 7/8] Address review comments. --- sycl/source/reusable_events.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sycl/source/reusable_events.cpp b/sycl/source/reusable_events.cpp index f70c07c8ed07b..88f5d77732ccd 100644 --- a/sycl/source/reusable_events.cpp +++ b/sycl/source/reusable_events.cpp @@ -56,8 +56,8 @@ __SYCL_EXPORT sycl::event make_event(const sycl::context &ctxt, return RetEvent; } -void check_event_and_throw(detail::event_impl &EventImpl, - detail::context_impl &ContextImpl) { +static void CheckEventAndThrow(detail::event_impl &EventImpl, + detail::context_impl &ContextImpl) { if (EventImpl.isHost()) { throw sycl::exception(sycl::make_error_code(errc::invalid), "Host events cannot be enqueued for waiting."); @@ -80,7 +80,7 @@ __SYCL_EXPORT void enqueue_wait_event(sycl::queue q, const event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); - detail::check_event_and_throw(EventImpl, QueueImpl.getContextImpl()); + detail::CheckEventAndThrow(EventImpl, QueueImpl.getContextImpl()); QueueImpl.submit_barrier_direct_without_event( sycl::span(&evt, 1), detail::CGType::BarrierWaitlist, @@ -92,8 +92,8 @@ __SYCL_EXPORT void enqueue_wait_events(sycl::queue q, detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); for (const sycl::event &evt : evts) { - detail::check_event_and_throw(*sycl::detail::getSyclObjImpl(evt), - QueueImpl.getContextImpl()); + detail::CheckEventAndThrow(*sycl::detail::getSyclObjImpl(evt), + QueueImpl.getContextImpl()); } QueueImpl.submit_barrier_direct_without_event( @@ -104,7 +104,7 @@ __SYCL_EXPORT void enqueue_signal_event(sycl::queue q, event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); - detail::check_event_and_throw(EventImpl, QueueImpl.getContextImpl()); + detail::CheckEventAndThrow(EventImpl, QueueImpl.getContextImpl()); if (EventImpl.isInterop()) { throw sycl::exception( From 3544bc19a87ac1a6e1ca01597ede84b48a77c609 Mon Sep 17 00:00:00 2001 From: "Ptak, Slawomir" Date: Tue, 21 Jul 2026 14:46:17 +0000 Subject: [PATCH 8/8] Address review comments. --- sycl/source/reusable_events.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/source/reusable_events.cpp b/sycl/source/reusable_events.cpp index 88f5d77732ccd..b2e41c0e7bd11 100644 --- a/sycl/source/reusable_events.cpp +++ b/sycl/source/reusable_events.cpp @@ -104,8 +104,6 @@ __SYCL_EXPORT void enqueue_signal_event(sycl::queue q, event &evt) { detail::queue_impl &QueueImpl = *sycl::detail::getSyclObjImpl(q); detail::event_impl &EventImpl = *sycl::detail::getSyclObjImpl(evt); - detail::CheckEventAndThrow(EventImpl, QueueImpl.getContextImpl()); - if (EventImpl.isInterop()) { throw sycl::exception( sycl::make_error_code(errc::runtime), @@ -118,6 +116,8 @@ __SYCL_EXPORT void enqueue_signal_event(sycl::queue q, event &evt) { "on a queue which is recording a graph."); } + detail::CheckEventAndThrow(EventImpl, QueueImpl.getContextImpl()); + // An IPC event cannot be signaled on a profiling-enabled queue. if (EventImpl.isIPCEnabled() && QueueImpl.MIsProfilingEnabled) { throw sycl::exception(