Skip to content

Commit

Permalink
Fix native events handling
Browse files Browse the repository at this point in the history
  • Loading branch information
blazej-smorawski committed Sep 20, 2024
1 parent 672ac18 commit 427e62b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/adapters/level_zero/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ ur_queue_handle_legacy_t_::enqueueEventsWaitWithBarrier( ///< [in] handle of the
!Queue->isProfilingEnabled()) {
// If we are using driver in order lists, then append wait on events
// is unnecessary and we can signal the event created.
if (EventWaitList.Length && !CmdList->second.IsInOrderList) {

if (EventWaitList.Length && (!CmdList->second.IsInOrderList || EventWaitList.hasNativeEvents)) {
ZE2UR_CALL(zeCommandListAppendWaitOnEvents,
(CmdList->first, EventWaitList.Length,
EventWaitList.ZeEventList));
Expand Down Expand Up @@ -1325,6 +1326,7 @@ ur_result_t _ur_ze_event_list_t::createAndRetainUrZeEventList(
this->Length = 0;
this->ZeEventList = nullptr;
this->UrEventList = nullptr;
this->hasNativeEvents = false;

if (CurQueue->isInOrderQueue() && CurQueue->LastCommandEvent != nullptr) {
if (CurQueue->UsingImmCmdLists) {
Expand Down Expand Up @@ -1567,6 +1569,9 @@ ur_result_t _ur_ze_event_list_t::createAndRetainUrZeEventList(
QueueLock.reset();
CurQueue->Mutex.lock();
}
if (this->UrEventList[TmpListLength]->ZeEventPool == nullptr) {
this->hasNativeEvents = true;
}
TmpListLength += 1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions source/adapters/level_zero/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ struct _ur_ze_event_list_t {
// of elements in the above arrays that are valid.
uint32_t Length = {0};

bool hasNativeEvents = false;

// Initialize this using the array of events in EventList, and retain
// all the ur_event_handle_t in the created data structure.
// CurQueue is the ur_queue_handle_t that the command with this event wait
Expand Down

0 comments on commit 427e62b

Please sign in to comment.