From c27921767b866bffe5f1430d53bba09d1cf484ef Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Sat, 28 Dec 2024 01:32:41 +0100 Subject: [PATCH] Revert "performance: Signal inOrder counter with pipe control, part 4" This reverts commit 332002d9ea539abc865d3f5fa4a5503fef8b42ed. Signed-off-by: Compute-Runtime-Validation --- .../cmdlist/cmdlist_hw_xehp_and_later.inl | 4 +- .../cmdlist/test_cmdlist_xehp_and_later.cpp | 19 ++++++-- .../cmdlist/test_in_order_cmdlist_1.cpp | 46 +++++++++---------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index b56c02e601..5a0729b9b5 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -304,9 +304,9 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K if (!eventForInOrderExec->getAllocation(this->device) && Event::standaloneInOrderTimestampAllocationEnabled()) { eventForInOrderExec->resetInOrderTimestampNode(device->getInOrderTimestampAllocator()->getTag()); } - if ((!compactEvent && this->heaplessModeEnabled) || this->asMutable() || !eventForInOrderExec->isCounterBased()) { + if (!compactEvent || this->asMutable() || !compactEvent->isCounterBased()) { dispatchEventPostSyncOperation(eventForInOrderExec, nullptr, launchParams.outListCommands, Event::STATE_CLEARED, false, false, false, false, false); - } else if (compactEvent) { + } else { eventAddress = eventForInOrderExec->getPacketAddress(this->device); isTimestampEvent = true; if (!launchParams.omitAddingEventResidency) { diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp index 75d8fd390a..3a39be2bb6 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp @@ -2852,8 +2852,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, auto eventCompletionAddress = event->getCompletionFieldGpuAddress(device); - ASSERT_EQ(heapless ? 0u : 1u, outCbEventCmds.size()); - size_t expectedSdi = heapless ? 0 : 1; + ASSERT_EQ(heapless ? 0u : 2u, outCbEventCmds.size()); + size_t expectedSdi = heapless ? 0 : commandList->inOrderAtomicSignalingEnabled ? 1 + : 2; auto storeDataImmList = findAll(cmdList.begin(), cmdList.end()); ASSERT_EQ(expectedSdi, storeDataImmList.size()); @@ -2861,6 +2862,14 @@ HWTEST2_F(CommandListAppendLaunchKernel, ASSERT_EQ(1u, computeWalkerList.size()); auto semaphoreWaitList = findAll(cmdList.begin(), cmdList.end()); ASSERT_EQ(heapless ? 0u : 1u, semaphoreWaitList.size()); + + if (!heapless) { + EXPECT_EQ(CommandToPatch::CbEventTimestampClearStoreDataImm, outCbEventCmds[0].type); + EXPECT_EQ(*storeDataImmList[0], outCbEventCmds[0].pDestination); + auto storeDataImmCmd = genCmdCast(outCbEventCmds[0].pDestination); + ASSERT_NE(nullptr, storeDataImmCmd); + EXPECT_EQ(eventCompletionAddress, storeDataImmCmd->getAddress()); + } EXPECT_EQ(launchParams.outWalker, *computeWalkerList[0]); ASSERT_NE(nullptr, launchParams.outWalker); @@ -2879,9 +2888,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, if (!heapless) { - EXPECT_EQ(CommandToPatch::CbEventTimestampPostSyncSemaphoreWait, outCbEventCmds[0].type); - EXPECT_EQ(*semaphoreWaitList[0], outCbEventCmds[0].pDestination); - auto semaphoreWaitCmd = genCmdCast(outCbEventCmds[0].pDestination); + EXPECT_EQ(CommandToPatch::CbEventTimestampPostSyncSemaphoreWait, outCbEventCmds[1].type); + EXPECT_EQ(*semaphoreWaitList[0], outCbEventCmds[1].pDestination); + auto semaphoreWaitCmd = genCmdCast(outCbEventCmds[1].pDestination); ASSERT_NE(nullptr, semaphoreWaitCmd); EXPECT_EQ(eventCompletionAddress, semaphoreWaitCmd->getSemaphoreGraphicsAddress()); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp index ff65152588..105e6096e1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp @@ -2574,26 +2574,24 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingTimestampEventThen GenCmdList cmdList; ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, cmdStream->getCpuBase(), cmdStream->getUsed())); - if (immCmdList->isHeaplessModeEnabled()) { - auto sdiItor = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), sdiItor); + auto sdiItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), sdiItor); - auto sdiCmd = genCmdCast(*sdiItor); - ASSERT_NE(nullptr, sdiCmd); + auto sdiCmd = genCmdCast(*sdiItor); + ASSERT_NE(nullptr, sdiCmd); - EXPECT_EQ(events[0]->getCompletionFieldGpuAddress(device), sdiCmd->getAddress()); - EXPECT_EQ(0u, sdiCmd->getStoreQword()); - EXPECT_EQ(Event::STATE_CLEARED, sdiCmd->getDataDword0()); - } + EXPECT_EQ(events[0]->getCompletionFieldGpuAddress(device), sdiCmd->getAddress()); + EXPECT_EQ(0u, sdiCmd->getStoreQword()); + EXPECT_EQ(Event::STATE_CLEARED, sdiCmd->getDataDword0()); auto eventBaseGpuVa = events[0]->getPacketAddress(device); auto eventEndGpuVa = events[0]->getCompletionFieldGpuAddress(device); - auto walkerItor = NEO::UnitTestHelper::findWalkerTypeCmd(cmdList.begin(), cmdList.end()); + auto walkerItor = NEO::UnitTestHelper::findWalkerTypeCmd(sdiItor, cmdList.end()); ASSERT_NE(cmdList.end(), walkerItor); WalkerVariant walkerVariant = NEO::UnitTestHelper::getWalkerVariant(*walkerItor); - std::visit([eventBaseGpuVa, eventEndGpuVa, &immCmdList](auto &&walker) { + std::visit([eventBaseGpuVa, eventEndGpuVa, &immCmdList, &sdiCmd](auto &&walker) { auto &postSync = walker->getPostSync(); using PostSyncType = std::decay_t; @@ -2606,7 +2604,7 @@ HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenProgrammingTimestampEventThen EXPECT_EQ(eventEndGpuVa, semaphoreCmd->getSemaphoreGraphicsAddress()); EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD, semaphoreCmd->getCompareOperation()); - auto sdiCmd = genCmdCast(++semaphoreCmd); + sdiCmd = genCmdCast(++semaphoreCmd); ASSERT_NE(nullptr, sdiCmd); EXPECT_EQ(immCmdList->inOrderExecInfo->getBaseDeviceAddress(), sdiCmd->getAddress()); @@ -2720,23 +2718,21 @@ HWTEST2_F(InOrderCmdListTests, givenRelaxedOrderingWhenProgrammingTimestampEvent GenCmdList cmdList; ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, cmdStream->getCpuBase(), immCmdList->flushData[1])); - if (immCmdList->isHeaplessModeEnabled()) { - auto sdiItor = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), sdiItor); + auto sdiItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), sdiItor); - auto sdiCmd = genCmdCast(*sdiItor); - ASSERT_NE(nullptr, sdiCmd); + auto sdiCmd = genCmdCast(*sdiItor); + ASSERT_NE(nullptr, sdiCmd); - EXPECT_EQ(events[0]->getCompletionFieldGpuAddress(device), sdiCmd->getAddress()); - EXPECT_EQ(0u, sdiCmd->getStoreQword()); - EXPECT_EQ(Event::STATE_CLEARED, sdiCmd->getDataDword0()); + EXPECT_EQ(events[0]->getCompletionFieldGpuAddress(device), sdiCmd->getAddress()); + EXPECT_EQ(0u, sdiCmd->getStoreQword()); + EXPECT_EQ(Event::STATE_CLEARED, sdiCmd->getDataDword0()); - auto sdiOffset = ptrDiff(sdiCmd, cmdStream->getCpuBase()); - EXPECT_TRUE(sdiOffset >= immCmdList->flushData[0]); - EXPECT_TRUE(sdiOffset < immCmdList->flushData[1]); - } + auto sdiOffset = ptrDiff(sdiCmd, cmdStream->getCpuBase()); + EXPECT_TRUE(sdiOffset >= immCmdList->flushData[0]); + EXPECT_TRUE(sdiOffset < immCmdList->flushData[1]); - auto walkerItor = NEO::UnitTestHelper::findWalkerTypeCmd(cmdList.begin(), cmdList.end()); + auto walkerItor = NEO::UnitTestHelper::findWalkerTypeCmd(sdiItor, cmdList.end()); ASSERT_NE(cmdList.end(), walkerItor); auto eventBaseGpuVa = events[0]->getPacketAddress(device);