Skip to content

Commit c3c2a26

Browse files
sergey-semenovAlexeySachkov
authored andcommitted
[SYCL] Fix a stale handler_impl reference with reductions (intel#19906)
1 parent bca82b6 commit c3c2a26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sycl/source/detail/queue_impl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF,
313313
#else
314314
handler Handler(shared_from_this(), SecondaryQueue, CallerNeedsEvent);
315315
#endif
316-
detail::handler_impl &HandlerImpl = *detail::getSyclObjImpl(Handler);
317316

318317
#ifdef XPTI_ENABLE_INSTRUMENTATION
319318
if (xptiTraceEnabled()) {
@@ -326,6 +325,10 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF,
326325
CGF(Handler);
327326
}
328327

328+
// We might swap handlers as part of the CGH(Handler) call in the reduction
329+
// case, so need to retrieve the handler_impl reference after that.
330+
detail::handler_impl &HandlerImpl = *detail::getSyclObjImpl(Handler);
331+
329332
// Scheduler will later omit events, that are not required to execute tasks.
330333
// Host and interop tasks, however, are not submitted to low-level runtimes
331334
// and require separate dependency management.

0 commit comments

Comments
 (0)