From ae4b06537ffb2d5619684227fc4d109d1a9f5f04 Mon Sep 17 00:00:00 2001 From: Piotr Balcer Date: Wed, 25 Sep 2024 18:56:20 +0200 Subject: [PATCH] fix zeCommandListAppendWaitOnEvents failing in rare scenarios This will make it so that we don't pass any events to zeCommandListAppendWaitOnEvents in case of driver-in order lists, except for interop events created through a native handle. --- source/adapters/level_zero/event.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index 30840f5385..ad3c6ec5fe 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -200,10 +200,10 @@ ur_result_t urEnqueueEventsWaitWithBarrier( // is unnecessary IF the cmdlists match. if (EventWaitList.Length) { if (CmdList->second.IsInOrderList) { - for (unsigned i = EventWaitList.Length; i-- < 0;) { + for (unsigned i = EventWaitList.Length; i-- > 0;) { // if the events is from the same cmdlist, we can remove it // from the waitlist. - if (EventWaitList.UrEventList[i]->CommandList == CmdList) { + if (EventWaitList.UrEventList[i]->CommandList != std::nullopt) { EventWaitList.Length--; if (EventWaitList.Length != i) { std::swap(EventWaitList.UrEventList[i],