diff --git a/runtime/command_queue/hardware_interface.inl b/runtime/command_queue/hardware_interface.inl index 67bd197551..3f73331497 100644 --- a/runtime/command_queue/hardware_interface.inl +++ b/runtime/command_queue/hardware_interface.inl @@ -123,6 +123,7 @@ void HardwareInterface::dispatchWalker( using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL; auto pPipeControlCmd = static_cast(commandStream->getSpace(sizeof(PIPE_CONTROL))); *pPipeControlCmd = GfxFamily::cmdInitPipeControl; + pPipeControlCmd->setDcFlushEnable(true); pPipeControlCmd->setCommandStreamerStallEnable(true); } diff --git a/unit_tests/command_queue/dispatch_walker_tests.cpp b/unit_tests/command_queue/dispatch_walker_tests.cpp index 805f41f7cd..16b6f261fa 100644 --- a/unit_tests/command_queue/dispatch_walker_tests.cpp +++ b/unit_tests/command_queue/dispatch_walker_tests.cpp @@ -1110,7 +1110,7 @@ HWTEST_F(DispatchWalkerTest, WhenCallingDefaultWaMethodsThenExpectNothing) { EXPECT_EQ(expectedSize, actualSize); } -HWTEST_F(DispatchWalkerTest, givenKernelWhenAuxTranslationWithoutParentKernelThenPipeControlAdded) { +HWTEST_F(DispatchWalkerTest, givenKernelWhenAuxTranslationRequiredThenPipeControlWithStallAndDCFlushAdded) { MockKernel kernel(program.get(), kernelInfo, *pDevice); kernelInfo.workloadInfo.workDimOffset = 0; ASSERT_EQ(CL_SUCCESS, kernel.initialize()); @@ -1141,8 +1141,17 @@ HWTEST_F(DispatchWalkerTest, givenKernelWhenAuxTranslationWithoutParentKernelThe GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, buffer, sizeUsed)); - auto itorCmd = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), itorCmd); + auto pipeControls = findAll(cmdList.begin(), cmdList.end()); + + ASSERT_EQ(2u, pipeControls.size()); + + auto beginPipeControl = genCmdCast(*(pipeControls[0])); + EXPECT_TRUE(beginPipeControl->getDcFlushEnable()); + EXPECT_TRUE(beginPipeControl->getCommandStreamerStallEnable()); + + auto endPipeControl = genCmdCast(*(pipeControls[1])); + EXPECT_FALSE(endPipeControl->getDcFlushEnable()); + EXPECT_TRUE(endPipeControl->getCommandStreamerStallEnable()); } struct ProfilingCommandsTest : public DispatchWalkerTest, ::testing::WithParamInterface { diff --git a/unit_tests/gen_common/gen_cmd_parse.h b/unit_tests/gen_common/gen_cmd_parse.h index 09d6af7b72..3395c66219 100644 --- a/unit_tests/gen_common/gen_cmd_parse.h +++ b/unit_tests/gen_common/gen_cmd_parse.h @@ -7,6 +7,7 @@ #pragma once #include "runtime/gen_common/hw_cmds.h" +#include #include typedef std::list GenCmdList; @@ -25,6 +26,19 @@ static inline GenCmdList::iterator find(GenCmdList::iterator itorStart, GenCmdLi return itor; } +template +static inline std::vector findAll(GenCmdList::iterator commandListStart, GenCmdList::const_iterator commandListEnd) { + std::vector matchedCommands; + GenCmdList::iterator currentCommand = commandListStart; + while (currentCommand != commandListEnd) { + if (genCmdCast(*currentCommand)) { + matchedCommands.push_back(currentCommand); + } + ++currentCommand; + } + return matchedCommands; +} + template static inline GenCmdList::iterator findMmio(GenCmdList::iterator itorStart, GenCmdList::const_iterator itorEnd, uint32_t regOffset) { GenCmdList::iterator itor = itorStart;