-
Notifications
You must be signed in to change notification settings - Fork 787
[NFCI][SYCL] Refactor HandlerAccess::postProcess
#19203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: sycl
Are you sure you want to change the base?
Conversation
Implements the idea from the earlier TODO comment. Instead of having a hacky `handler::MLastEvent` just `swap` original and post-processing `handler`, so that "natural" `finalize` will work on the latest task in the chain.
// Reductions implementation need access to private members of handler. Those | ||
// are limited to those below. | ||
inline void finalizeHandler(handler &CGH); | ||
template <class FunctorTy> void withAuxHandler(handler &CGH, FunctorTy Func); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withAuxHandler
declaration should have been removed earlier when postProcess
was introduced instead of it.
@@ -488,6 +488,9 @@ class __SYCL_EXPORT handler { | |||
/// \param Graph is a SYCL command_graph | |||
handler(std::shared_ptr<ext::oneapi::experimental::detail::graph_impl> Graph); | |||
#endif | |||
handler(std::unique_ptr<detail::handler_impl> &&HandlerImpl); | |||
|
|||
~handler(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::unique_ptr<T>
dtor needs a complete T
, so move the definition to the handler.cpp
.
@@ -577,11 +571,10 @@ event handler::finalize() { | |||
DiscardEvent = !KernelUsesAssert; | |||
} | |||
|
|||
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES | |||
if (!DiscardEvent) { | |||
LastEventImpl = detail::event_impl::create_completed_host_event(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why we were using create_completed_host_event
before. @slawekptak , any thoughts?
@@ -635,29 +627,32 @@ event handler::finalize() { | |||
|
|||
if (DiscardEvent) { | |||
EnqueueKernel(); | |||
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES | |||
LastEventImpl->setStateDiscarded(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 654 on the right does create_discarded_event
instead, which, IMO, is even more readable.
Implements the idea from the earlier TODO comment. Instead of having a hacky
handler::MLastEvent
justswap
original and post-processinghandler
, so that "natural"finalize
will work on the latest task in the chain.