@@ -165,10 +165,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
165165 // event signal because it is already guaranteed that previous commands
166166 // in this queue are completed when the signal is started.
167167 //
168+ // Only consideration here is that when profiling is used, signalEvent
169+ // cannot be used if EventWaitList.Lenght == 0. In those cases, we need
170+ // to fallback directly to barrier to have correct timestamps. See here:
171+ // https://spec.oneapi.io/level-zero/latest/core/api.html?highlight=appendsignalevent#_CPPv430zeCommandListAppendSignalEvent24ze_command_list_handle_t17ze_event_handle_t
172+ //
168173 // TODO: this and other special handling of in-order queues to be
169174 // updated when/if Level Zero adds native support for in-order queues.
170175 //
171- if (Queue->isInOrderQueue () && InOrderBarrierBySignal) {
176+ if (Queue->isInOrderQueue () && InOrderBarrierBySignal &&
177+ !Queue->isProfilingEnabled ()) {
172178 if (EventWaitList.Length ) {
173179 ZE2UR_CALL (zeCommandListAppendWaitOnEvents,
174180 (CmdList->first , EventWaitList.Length ,
@@ -181,6 +187,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
181187 (CmdList->first , Event->ZeEvent , EventWaitList.Length ,
182188 EventWaitList.ZeEventList ));
183189 }
190+
184191 return UR_RESULT_SUCCESS;
185192 };
186193
@@ -964,8 +971,7 @@ ur_result_t CleanupCompletedEvent(ur_event_handle_t Event, bool QueueLocked,
964971ur_result_t EventCreate (ur_context_handle_t Context, ur_queue_handle_t Queue,
965972 bool HostVisible, ur_event_handle_t *RetEvent) {
966973
967- bool ProfilingEnabled =
968- !Queue || (Queue->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE) != 0 ;
974+ bool ProfilingEnabled = !Queue || Queue->isProfilingEnabled ();
969975
970976 if (auto CachedEvent =
971977 Context->getEventFromContextCache (HostVisible, ProfilingEnabled)) {
0 commit comments