diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 30fd18ece0..0b3dbaddc1 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -1474,17 +1474,6 @@ ze_result_t CommandListCoreFamily::appendWaitOnEvents(uint32_t nu for (uint32_t i = 0; i < numEvents; i++) { auto event = Event::fromHandle(phEvent[i]); - commandContainer.addToResidencyContainer(&event->getAllocation()); - - gpuAddr = event->getGpuAddress(); - if (event->isTimestampEvent) { - gpuAddr += offsetof(TimestampPacketStorage::Packet, contextEnd); - } - NEO::EncodeSempahore::addMiSemaphoreWaitCommand(*commandContainer.getCommandStream(), - gpuAddr, - eventStateClear, - COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD); - dcFlushRequired |= (!event->waitScope) ? false : true; } @@ -1497,6 +1486,20 @@ ze_result_t CommandListCoreFamily::appendWaitOnEvents(uint32_t nu } } + for (uint32_t i = 0; i < numEvents; i++) { + auto event = Event::fromHandle(phEvent[i]); + commandContainer.addToResidencyContainer(&event->getAllocation()); + + gpuAddr = event->getGpuAddress(); + if (event->isTimestampEvent) { + gpuAddr += offsetof(TimestampPacketStorage::Packet, contextEnd); + } + NEO::EncodeSempahore::addMiSemaphoreWaitCommand(*commandContainer.getCommandStream(), + gpuAddr, + eventStateClear, + COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD); + } + return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index c85932d5f5..082de322af 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -990,7 +990,7 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushTheP EXPECT_NE(cmdList.end(), itor); } -HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushThePipeControlIsProgrammedOnlyOnce) { +HWTEST_F(CommandListCreate, givenCommandListWhenAppendWaitEventsWithDcFlushThePipeControlIsProgrammedOnlyOnce) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; ze_result_t returnValue; @@ -1007,14 +1007,11 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushTheP ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed())); - auto itor = find(cmdList.begin(), cmdList.end()); + auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); itor++; - auto itor2 = find(itor, cmdList.end()); + auto itor2 = find(itor, cmdList.end()); EXPECT_NE(cmdList.end(), itor2); - itor2++; - auto itor3 = find(itor2, cmdList.end()); - EXPECT_EQ(cmdList.end(), itor3); } using Platforms = IsAtLeastProduct;