From cd27bb32c5832b4bec47a3ed0df97a82da1b3b5c Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Mon, 16 Jun 2025 12:36:06 +0000 Subject: [PATCH] fix: In order signaling with pipe control for fill operation Related-To: NEO-15192 Signed-off-by: Maciej Plewka --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 3 +- .../cmdlist/test_in_order_cmdlist_1.cpp | 34 ++++++++++++++++++- .../cmdlist/test_in_order_cmdlist_2.cpp | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index b4b08845a4..45adee3a02 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -2389,6 +2389,7 @@ ze_result_t CommandListCoreFamily::appendMemoryFill(void *ptr, launchParams.isKernelSplitOperation = (fillArguments.leftRemainingBytes > 0 || fillArguments.rightRemainingBytes > 0); bool singlePipeControlPacket = eventSignalPipeControl(launchParams.isKernelSplitOperation, dcFlush); + launchParams.pipeControlSignalling = (signalEvent && singlePipeControlPacket) || getDcFlushRequired(dstAllocation.needsFlush); appendEventForProfilingAllWalkers(signalEvent, nullptr, nullptr, true, singlePipeControlPacket, false, isCopyOnly(false)); @@ -2536,7 +2537,7 @@ ze_result_t CommandListCoreFamily::appendMemoryFill(void *ptr, bool nonWalkerInOrderCmdChaining = false; if (this->isInOrderExecutionEnabled()) { - if (launchParams.isKernelSplitOperation) { + if (launchParams.isKernelSplitOperation || launchParams.pipeControlSignalling) { dispatchInOrderPostOperationBarrier(signalEvent, dcFlush, isCopyOnly(false)); appendSignalInOrderDependencyCounter(signalEvent, false, false, false); } else { 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 787a2f6b92..f737dcbdd8 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 @@ -4238,7 +4238,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenInOrderModeWhenProgrammin auto cmdStream = immCmdList->getCmdContainer().getCommandStream(); constexpr size_t size = 128 * sizeof(uint32_t); - auto data = allocHostMem(size); + auto data = allocDeviceMem(size); immCmdList->appendMemoryFill(data, data, 1, size, nullptr, 0, nullptr, copyParams); @@ -4265,6 +4265,38 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenInOrderModeWhenProgrammin context->freeMem(data); } +HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenInOrderModeWhenProgrammingFillWithoutSplitAndWithEventThenDoNotSignalByWalker) { + using WalkerType = typename FamilyType::DefaultWalkerType; + + auto immCmdList = createImmCmdList(); + immCmdList->dcFlushSupport = true; + auto cmdStream = immCmdList->getCmdContainer().getCommandStream(); + + constexpr size_t size = 128 * sizeof(uint32_t); + auto data = allocDeviceMem(size); + auto eventPool = createEvents(1, true); + immCmdList->appendMemoryFill(data, data, 1, size, events[0]->toHandle(), 0, nullptr, copyParams); + + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, cmdStream->getCpuBase(), cmdStream->getUsed())); + + auto walkerItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), walkerItor); + + auto walker = genCmdCast(*walkerItor); + auto &postSync = walker->getPostSync(); + using PostSyncType = std::decay_t; + + if (!immCmdList->inOrderAtomicSignalingEnabled) { + EXPECT_EQ(PostSyncType::OPERATION::OPERATION_NO_WRITE, postSync.getOperation()); + EXPECT_EQ(0u, postSync.getImmediateData()); + } + + EXPECT_EQ(0u, postSync.getDestinationAddress()); + + context->freeMem(data); +} + HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenCopyOnlyInOrderModeWhenProgrammingCopyRegionThenSignalInOrderAllocation) { using XY_COPY_BLT = typename std::remove_const::type; using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp index 3c25a9074e..51eafd1998 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp @@ -1885,7 +1885,7 @@ HWTEST2_F(InOrderRegularCmdListTests, givenInOrderModeWhenDispatchingRegularCmdL EXPECT_NE(nullptr, regularCmdList->inOrderExecInfo.get()); constexpr size_t size = 128 * sizeof(uint32_t); - auto data = allocHostMem(size); + auto data = allocDeviceMem(size); ze_copy_region_t region = {0, 0, 0, 1, 1, 1};