Skip to content

Commit a461778

Browse files
committed
[L0] Verify the LastCommandEvent is unchanged after sync before nullptr
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent 6db9291 commit a461778

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/adapters/level_zero/queue.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ ur_result_t ur_queue_handle_t_::synchronize() {
16961696
// If event is discarded then it can be in reset state or underlying level
16971697
// zero handle can have device scope, so we can't synchronize the last
16981698
// event.
1699+
auto savedLastCommandEvent = LastCommandEvent;
16991700
if (isInOrderQueue() && !LastCommandEvent->IsDiscarded) {
17001701
ZE2UR_CALL(zeHostSynchronize, (LastCommandEvent->ZeEvent));
17011702

@@ -1737,7 +1738,12 @@ ur_result_t ur_queue_handle_t_::synchronize() {
17371738
}
17381739
}
17391740
}
1740-
LastCommandEvent = nullptr;
1741+
// If the current version of the LastCommandEvent == savedLastCommandEvent,
1742+
// then LastCommandEvent = nullptr; Otherwise, if LastCommandEvent !=
1743+
// savedLastCommandEvent, then LastCommandEvent is unchanged.
1744+
if (LastCommandEvent == savedLastCommandEvent) {
1745+
LastCommandEvent = nullptr;
1746+
}
17411747
}
17421748

17431749
// Since all timestamp recordings should have finished with the

0 commit comments

Comments
 (0)