Skip to content

Commit 987c422

Browse files
committed
[L0] Reordered/added checks for OOQ signal events and added comments
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent d621b50 commit 987c422

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

source/adapters/level_zero/context.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ ur_result_t ur_context_handle_t_::getAvailableCommandList(
658658
if (Queue->hasOpenCommandList(UseCopyEngine)) {
659659
if (AllowBatching) {
660660
bool batchingAllowed = true;
661-
if (Queue->Device->isIntegrated() &&
662-
!UrL0OutOfOrderIntegratedSignalEvent) {
661+
if (!UrL0OutOfOrderIntegratedSignalEvent &&
662+
Queue->Device->isIntegrated()) {
663663
batchingAllowed = eventCanBeBatched(Queue, UseCopyEngine,
664664
NumEventsInWaitList, EventWaitList);
665665
}

source/adapters/level_zero/queue.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,16 +1405,25 @@ ur_queue_handle_t_::executeCommandList(ur_command_list_ptr_t CommandList,
14051405
// If we don't have host visible proxy then signal event if needed.
14061406
this->signalEventFromCmdListIfLastEventDiscarded(CommandList);
14071407
}
1408-
// Append Signalling of the inner events at the end of the batch
1409-
for (auto &Event : CommandList->second.EventList) {
1410-
if (Event->IsInnerBatchedEvent) {
1411-
if (AppendBarrierNeeded) {
1412-
ZE2UR_CALL(zeCommandListAppendBarrier,
1413-
(CommandList->first, nullptr, 0, nullptr));
1414-
AppendBarrierNeeded = false;
1408+
// Append Signalling of the inner events at the end of the batch if this is
1409+
// an integrated gpu and out of order signal events are not allowed.
1410+
if (!UrL0OutOfOrderIntegratedSignalEvent && this->Device->isIntegrated()) {
1411+
for (auto &Event : CommandList->second.EventList) {
1412+
// If the events scope does not apply a barrier already above, then we
1413+
// need to apply a barrier to wait on all the previous commands without
1414+
// signal events to complete before we can signal the batched events as
1415+
// completed. This functionality is only used if this command list is
1416+
// out of order and there are events created that were not used as
1417+
// signal events.
1418+
if (Event->IsInnerBatchedEvent) {
1419+
if (AppendBarrierNeeded) {
1420+
ZE2UR_CALL(zeCommandListAppendBarrier,
1421+
(CommandList->first, nullptr, 0, nullptr));
1422+
AppendBarrierNeeded = false;
1423+
}
1424+
ZE2UR_CALL(zeCommandListAppendSignalEvent,
1425+
(CommandList->first, Event->ZeEvent));
14151426
}
1416-
ZE2UR_CALL(zeCommandListAppendSignalEvent,
1417-
(CommandList->first, Event->ZeEvent));
14181427
}
14191428
}
14201429

@@ -1771,11 +1780,10 @@ ur_result_t setSignalEvent(ur_queue_handle_t Queue, bool UseCopyEngine,
17711780
uint32_t NumEventsInWaitList,
17721781
const ur_event_handle_t *EventWaitList,
17731782
ze_command_queue_handle_t ZeQueue) {
1774-
if (Queue->Device->isIntegrated() &&
1783+
if (!UrL0OutOfOrderIntegratedSignalEvent && Queue->Device->isIntegrated() &&
17751784
eventCanBeBatched(Queue, UseCopyEngine, NumEventsInWaitList,
17761785
EventWaitList) &&
1777-
!Queue->isInOrderQueue() && !Queue->UsingImmCmdLists &&
1778-
!UrL0OutOfOrderIntegratedSignalEvent) {
1786+
!Queue->isInOrderQueue() && !Queue->UsingImmCmdLists) {
17791787
ZeEvent = nullptr;
17801788
(*Event)->IsInnerBatchedEvent = true;
17811789
(*Event)->ZeBatchedQueue = ZeQueue;

0 commit comments

Comments
 (0)