From 936d7d88812c1a71810c1b039c0a9b552565886c Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 9 Nov 2023 15:41:32 +0000 Subject: [PATCH] Revert "Merge pull request #1028 from jandres742/listhostsync" This reverts commit 62e6d2f918eaae4174d6a34707404f747eb93157, reversing changes made to ba2785568a87905e51d9143e7e0f8f48fd1ec86c. --- source/adapters/level_zero/queue.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/adapters/level_zero/queue.cpp b/source/adapters/level_zero/queue.cpp index 0388b8fdbb..2dcdcfd51e 100755 --- a/source/adapters/level_zero/queue.cpp +++ b/source/adapters/level_zero/queue.cpp @@ -1406,8 +1406,18 @@ ur_result_t ur_queue_handle_t_::synchronize() { if (ImmCmdList == Queue->CommandListMap.end()) return UR_RESULT_SUCCESS; - // wait for all commands previously submitted to this immediate command list - ZE2UR_CALL(zeCommandListHostSynchronize, (ImmCmdList->first, UINT64_MAX)); + ur_event_handle_t Event{}; + ur_result_t Res = createEventAndAssociateQueue( + reinterpret_cast(Queue), &Event, + UR_EXT_COMMAND_TYPE_USER, ImmCmdList, /* IsInternal */ false); + if (Res != UR_RESULT_SUCCESS) + return Res; + auto zeEvent = Event->ZeEvent; + ZE2UR_CALL(zeCommandListAppendBarrier, + (ImmCmdList->first, zeEvent, 0, nullptr)); + ZE2UR_CALL(zeHostSynchronize, (zeEvent)); + Event->Completed = true; + UR_CALL(urEventRelease(Event)); // Cleanup all events from the synced command list. CleanupEventListFromResetCmdList(ImmCmdList->second.EventList, true);