Skip to content

[SYCL] Fix acquiring a mutex in _pi_context::finalize #3001

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 1 commit into from
Jan 16, 2021
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
2 changes: 1 addition & 1 deletion sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ pi_result _pi_context::finalize() {
// There could be some memory that may have not been deallocated.
// For example, zeEventPool could be still alive.
std::lock_guard<std::mutex> NumEventsLiveInEventPoolGuard(
NumEventsLiveInEventPoolMutex, std::adopt_lock);
NumEventsLiveInEventPoolMutex);
Copy link
Contributor

Choose a reason for hiding this comment

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

This indeed looks like copy-paste error to me, and the fix looks good.
Still, I wonder how this worked before. Basically, all the tests, including non-ESIMD should have been failing the same way, as it does not seem any thread can come here holding the NumEventsLiveInEventPoolMutex. Leaving to @smaslov-intel to review/approve.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it wasn't noticed earlier because it only appears on debug builds on Windows.

if (ZeEventPool && NumEventsLiveInEventPool[ZeEventPool])
zeEventPoolDestroy(ZeEventPool);

Expand Down