Skip to content

Commit f8c4fac

Browse files
committed
[L0] Store LastCommandEvent before unlock during queue sync
- Address possible race in accessing the LastCommandEvent by storing the event in local variable for use while in unlock. Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 6d08e9f commit f8c4fac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

source/adapters/level_zero/queue.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,9 @@ ur_result_t ur_queue_handle_t_::synchronize() {
14241424
// event.
14251425
if (isInOrderQueue() && !LastCommandEvent->IsDiscarded) {
14261426
if (UrL0QueueSyncNonBlocking) {
1427+
auto SyncZeEvent = LastCommandEvent->ZeEvent;
14271428
this->Mutex.unlock();
1428-
ZE2UR_CALL(zeHostSynchronize, (LastCommandEvent->ZeEvent));
1429+
ZE2UR_CALL(zeHostSynchronize, (SyncZeEvent));
14291430
this->Mutex.lock();
14301431
} else {
14311432
ZE2UR_CALL(zeHostSynchronize, (LastCommandEvent->ZeEvent));

0 commit comments

Comments
 (0)