Skip to content

Commit 07bac53

Browse files
author
Jaime Arteaga
committed
[UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier
When event list is null, a barrier is still needed for all previous commands if profiling is enabled, so fix it. Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
1 parent 192e940 commit 07bac53

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

source/adapters/level_zero/event.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
168168
// TODO: this and other special handling of in-order queues to be
169169
// updated when/if Level Zero adds native support for in-order queues.
170170
//
171-
if (Queue->isInOrderQueue() && InOrderBarrierBySignal) {
171+
if (Queue->isInOrderQueue() && InOrderBarrierBySignal &&
172+
!Queue->isProfilingEnabled()) {
172173
if (EventWaitList.Length) {
173174
ZE2UR_CALL(zeCommandListAppendWaitOnEvents,
174175
(CmdList->first, EventWaitList.Length,
@@ -181,6 +182,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
181182
(CmdList->first, Event->ZeEvent, EventWaitList.Length,
182183
EventWaitList.ZeEventList));
183184
}
185+
184186
return UR_RESULT_SUCCESS;
185187
};
186188

@@ -964,8 +966,7 @@ ur_result_t CleanupCompletedEvent(ur_event_handle_t Event, bool QueueLocked,
964966
ur_result_t EventCreate(ur_context_handle_t Context, ur_queue_handle_t Queue,
965967
bool HostVisible, ur_event_handle_t *RetEvent) {
966968

967-
bool ProfilingEnabled =
968-
!Queue || (Queue->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE) != 0;
969+
bool ProfilingEnabled = !Queue || Queue->isProfilingEnabled();
969970

970971
if (auto CachedEvent =
971972
Context->getEventFromContextCache(HostVisible, ProfilingEnabled)) {

source/adapters/level_zero/queue.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,11 @@ struct ur_queue_handle_t_ : _ur_object {
515515
// lists in the queue.
516516
ur_result_t
517517
insertStartBarrierIfDiscardEventsMode(ur_command_list_ptr_t &CmdList);
518+
519+
// returns true if queue has profiling enabled
520+
bool isProfilingEnabled() {
521+
return ((this->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE) != 0);
522+
}
518523
};
519524

520525
// This helper function creates a ur_event_handle_t and associate a

0 commit comments

Comments
 (0)