Skip to content

Commit 9c13694

Browse files
[SYCL] Fix acquiring a mutex in _pi_context::finalize (#3001)
I observed crashes in ESIMD tests at the exit of _pi_context::finalize function. Unlocking not owned mutex is Undefined Behavior. Crashes occurred only on Debug builds on Windows platforms when using LevelZero. I saw the following error: "unlock of unowned mutex".
1 parent 9848d9f commit 9c13694

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ pi_result _pi_context::finalize() {
508508
// There could be some memory that may have not been deallocated.
509509
// For example, zeEventPool could be still alive.
510510
std::lock_guard<std::mutex> NumEventsLiveInEventPoolGuard(
511-
NumEventsLiveInEventPoolMutex, std::adopt_lock);
511+
NumEventsLiveInEventPoolMutex);
512512
if (ZeEventPool && NumEventsLiveInEventPool[ZeEventPool])
513513
zeEventPoolDestroy(ZeEventPool);
514514

0 commit comments

Comments
 (0)