Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix native events handling #2111

Draft
wants to merge 1 commit into
base: v0.10.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading