Skip to content

[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

Merged
merged 5 commits into from
Jun 30, 2025

Conversation

aelovikov-intel
Copy link
Contributor

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.

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);
Copy link
Contributor Author

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();
Copy link
Contributor Author

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();
Copy link
Contributor Author

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();
Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree and it's also going away, so no real concerns either way.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner solution. Good job! ⭐

@@ -635,29 +627,32 @@ event handler::finalize() {

if (DiscardEvent) {
EnqueueKernel();
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
LastEventImpl->setStateDiscarded();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree and it's also going away, so no real concerns either way.

@aelovikov-intel
Copy link
Contributor Author

Failed Tests (3):
SYCL :: Adapters/level_zero/ext_intel_cslice.cpp
SYCL :: Adapters/level_zero/ext_intel_queue_index.cpp
SYCL :: Adapters/sycl-ls-uuid-subdevs.cpp

Unexpectedly Passed Tests (5):
SYCL :: bindless_images/array/fetch_handle_carray2d.cpp
SYCL :: bindless_images/read_1D_O0.cpp
SYCL :: bindless_images/sampled_fetch/fetch_1D_O0.cpp
SYCL :: bindless_images/sampled_fetch/fetch_2D_O0.cpp
SYCL :: bindless_images/sampling_1D_O0.cpp

are failing in other PRs too. XFAILs seem to be handled in #19215. FAILs look similar to earlier reported #18576 (Linux), I suspect we just update our Win drivers to the same state.

@aelovikov-intel aelovikov-intel merged commit 0a27e3f into intel:sycl Jun 30, 2025
24 of 25 checks passed
@aelovikov-intel aelovikov-intel deleted the refactor-post-process branch June 30, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants