Skip to content

[SYCL] Don't synchronize last event if it is discarded #8993

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 2 commits into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5921,7 +5921,9 @@ pi_result _pi_queue::synchronize() {
return PI_SUCCESS;

// For in-order queue just wait for the last command.
if (isInOrderQueue()) {
// If event is discarded then it can be in reset state or underlying level
// zero handle can have device scope, so we can't synchronize the last event.
if (isInOrderQueue() && !LastCommandEvent->IsDiscarded) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? Isn't ZeEvent still there and can be synced?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I guess this is because it may not be host-scope right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is one of the reasons. And the main reason is that this event may be in reset state. Basically we can't explicitly synchronize discarded pi_event objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, but please add some comment about it.

ZE_CALL(zeHostSynchronize, (LastCommandEvent->ZeEvent));
} else {
// Otherwise sync all L0 queues/immediate command-lists.
Expand Down