diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index d6d2949dbf..945db11dce 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -230,7 +230,9 @@ CompletionStamp CommandStreamReceiverHw::flushBcsTask(LinearStream &c auto &commandStreamCSR = getCS(getRequiredCmdStreamSizeAligned(dispatchBcsFlags)); size_t commandStreamStartCSR = commandStreamCSR.getUsed(); - programHardwareContext(commandStreamCSR); + if (dispatchBcsFlags.dispatchOperation != AppendOperations::cmdList) { + programHardwareContext(commandStreamCSR); + } if (debugManager.flags.FlushTlbBeforeCopy.get() == 1) { MiFlushArgs tlbFlushArgs{waArgs}; @@ -302,45 +304,47 @@ CompletionStamp CommandStreamReceiverHw::flushImmediateTask( Device &device) { ImmediateFlushData flushData; - flushData.pipelineSelectFullConfigurationNeeded = !getPreambleSetFlag(); - flushData.frontEndFullConfigurationNeeded = getMediaVFEStateDirty(); - flushData.stateComputeModeFullConfigurationNeeded = getStateComputeModeDirty(); - flushData.stateBaseAddressFullConfigurationNeeded = getGSBAStateDirty(); + if (dispatchFlags.dispatchOperation != AppendOperations::cmdList) { + flushData.pipelineSelectFullConfigurationNeeded = !getPreambleSetFlag(); + flushData.frontEndFullConfigurationNeeded = getMediaVFEStateDirty(); + flushData.stateComputeModeFullConfigurationNeeded = getStateComputeModeDirty(); + flushData.stateBaseAddressFullConfigurationNeeded = getGSBAStateDirty(); - if (!this->heaplessModeEnabled && dispatchFlags.sshCpuBase != nullptr && (this->requiredScratchSlot0Size > 0 || this->requiredScratchSlot1Size > 0)) { - bool checkFeStateDirty = false; - bool checkSbaStateDirty = false; - scratchSpaceController->setRequiredScratchSpace(dispatchFlags.sshCpuBase, - 0u, - this->requiredScratchSlot0Size, - this->requiredScratchSlot1Size, - *this->osContext, - checkSbaStateDirty, - checkFeStateDirty); - flushData.frontEndFullConfigurationNeeded |= checkFeStateDirty; - flushData.stateBaseAddressFullConfigurationNeeded |= checkSbaStateDirty; + if (!this->heaplessModeEnabled && dispatchFlags.sshCpuBase != nullptr && (this->requiredScratchSlot0Size > 0 || this->requiredScratchSlot1Size > 0)) { + bool checkFeStateDirty = false; + bool checkSbaStateDirty = false; + scratchSpaceController->setRequiredScratchSpace(dispatchFlags.sshCpuBase, + 0u, + this->requiredScratchSlot0Size, + this->requiredScratchSlot1Size, + *this->osContext, + checkSbaStateDirty, + checkFeStateDirty); + flushData.frontEndFullConfigurationNeeded |= checkFeStateDirty; + flushData.stateBaseAddressFullConfigurationNeeded |= checkSbaStateDirty; - if (scratchSpaceController->getScratchSpaceSlot0Allocation()) { - makeResident(*scratchSpaceController->getScratchSpaceSlot0Allocation()); + if (scratchSpaceController->getScratchSpaceSlot0Allocation()) { + makeResident(*scratchSpaceController->getScratchSpaceSlot0Allocation()); + } + if (scratchSpaceController->getScratchSpaceSlot1Allocation()) { + makeResident(*scratchSpaceController->getScratchSpaceSlot1Allocation()); + } } - if (scratchSpaceController->getScratchSpaceSlot1Allocation()) { - makeResident(*scratchSpaceController->getScratchSpaceSlot1Allocation()); + + handleImmediateFlushPipelineSelectState(dispatchFlags, flushData); + handleImmediateFlushFrontEndState(dispatchFlags, flushData); + handleImmediateFlushStateComputeModeState(dispatchFlags, flushData); + handleImmediateFlushStateBaseAddressState(dispatchFlags, flushData, device); + handleImmediateFlushOneTimeContextInitState(dispatchFlags, flushData, device); + + flushData.stateCacheFlushRequired = device.getBindlessHeapsHelper() ? device.getBindlessHeapsHelper()->getStateDirtyForContext(getOsContext().getContextId()) : false; + if (flushData.stateCacheFlushRequired) { + flushData.estimatedSize += MemorySynchronizationCommands::getSizeForFullCacheFlush(); } - } - handleImmediateFlushPipelineSelectState(dispatchFlags, flushData); - handleImmediateFlushFrontEndState(dispatchFlags, flushData); - handleImmediateFlushStateComputeModeState(dispatchFlags, flushData); - handleImmediateFlushStateBaseAddressState(dispatchFlags, flushData, device); - handleImmediateFlushOneTimeContextInitState(dispatchFlags, flushData, device); - - flushData.stateCacheFlushRequired = device.getBindlessHeapsHelper() ? device.getBindlessHeapsHelper()->getStateDirtyForContext(getOsContext().getContextId()) : false; - if (flushData.stateCacheFlushRequired) { - flushData.estimatedSize += MemorySynchronizationCommands::getSizeForFullCacheFlush(); - } - - if (requiresInstructionCacheFlush) { - flushData.estimatedSize += MemorySynchronizationCommands::getSizeForInstructionCacheFlush(); + if (requiresInstructionCacheFlush) { + flushData.estimatedSize += MemorySynchronizationCommands::getSizeForInstructionCacheFlush(); + } } // this must be the last call after all estimate size operations @@ -349,21 +353,23 @@ CompletionStamp CommandStreamReceiverHw::flushImmediateTask( auto &csrCommandStream = getCS(flushData.estimatedSize); flushData.csrStartOffset = csrCommandStream.getUsed(); - if (flushData.stateCacheFlushRequired) { - device.getBindlessHeapsHelper()->clearStateDirtyForContext(getOsContext().getContextId()); - MemorySynchronizationCommands::addStateCacheFlush(csrCommandStream, device.getRootDeviceEnvironment()); - } + if (dispatchFlags.dispatchOperation != AppendOperations::cmdList) { + if (flushData.stateCacheFlushRequired) { + device.getBindlessHeapsHelper()->clearStateDirtyForContext(getOsContext().getContextId()); + MemorySynchronizationCommands::addStateCacheFlush(csrCommandStream, device.getRootDeviceEnvironment()); + } - if (requiresInstructionCacheFlush) { - MemorySynchronizationCommands::addInstructionCacheFlush(csrCommandStream); - requiresInstructionCacheFlush = false; - } + if (requiresInstructionCacheFlush) { + MemorySynchronizationCommands::addInstructionCacheFlush(csrCommandStream); + requiresInstructionCacheFlush = false; + } - dispatchImmediateFlushPipelineSelectCommand(flushData, csrCommandStream); - dispatchImmediateFlushFrontEndCommand(flushData, device, csrCommandStream); - dispatchImmediateFlushStateComputeModeCommand(flushData, csrCommandStream); - dispatchImmediateFlushStateBaseAddressCommand(flushData, csrCommandStream, device); - dispatchImmediateFlushOneTimeContextInitCommand(flushData, csrCommandStream, device); + dispatchImmediateFlushPipelineSelectCommand(flushData, csrCommandStream); + dispatchImmediateFlushFrontEndCommand(flushData, device, csrCommandStream); + dispatchImmediateFlushStateComputeModeCommand(flushData, csrCommandStream); + dispatchImmediateFlushStateBaseAddressCommand(flushData, csrCommandStream, device); + dispatchImmediateFlushOneTimeContextInitCommand(flushData, csrCommandStream, device); + } dispatchImmediateFlushJumpToImmediateCommand(immediateCommandStream, immediateCommandStreamStart, flushData, csrCommandStream); @@ -1936,7 +1942,7 @@ void CommandStreamReceiverHw::handleImmediateFlushPipelineSelectState this->streamProperties.pipelineSelect.copyPropertiesAll(dispatchFlags.requiredState->pipelineSelect); flushData.pipelineSelectDirty = true; setPreambleSetFlag(true); - } else { + } else if (dispatchFlags.dispatchOperation == AppendOperations::kernel) { this->streamProperties.pipelineSelect.copyPropertiesSystolicMode(dispatchFlags.requiredState->pipelineSelect); flushData.pipelineSelectDirty = this->streamProperties.pipelineSelect.isDirty(); } @@ -1966,7 +1972,7 @@ void CommandStreamReceiverHw::handleImmediateFlushFrontEndState(Immed this->streamProperties.frontEndState.copyPropertiesAll(dispatchFlags.requiredState->frontEndState); flushData.frontEndDirty = true; setMediaVFEStateDirty(false); - } else { + } else if (dispatchFlags.dispatchOperation == AppendOperations::kernel) { this->streamProperties.frontEndState.copyPropertiesComputeDispatchAllWalkerEnableDisableEuFusion(dispatchFlags.requiredState->frontEndState); flushData.frontEndDirty = this->streamProperties.frontEndState.isDirty(); } @@ -1999,7 +2005,7 @@ void CommandStreamReceiverHw::handleImmediateFlushStateComputeModeSta this->streamProperties.stateComputeMode.copyPropertiesAll(dispatchFlags.requiredState->stateComputeMode); flushData.stateComputeModeDirty = true; setStateComputeModeDirty(false); - } else { + } else if (dispatchFlags.dispatchOperation == AppendOperations::kernel) { this->streamProperties.stateComputeMode.copyPropertiesGrfNumberThreadArbitration(dispatchFlags.requiredState->stateComputeMode); flushData.stateComputeModeDirty = this->streamProperties.stateComputeMode.isDirty(); } @@ -2026,7 +2032,7 @@ void CommandStreamReceiverHw::handleImmediateFlushStateBaseAddressSta this->streamProperties.stateBaseAddress.copyPropertiesAll(dispatchFlags.requiredState->stateBaseAddress); flushData.stateBaseAddressDirty = true; setGSBAStateDirty(false); - } else { + } else if (dispatchFlags.dispatchOperation == AppendOperations::kernel) { if (this->streamProperties.stateBaseAddress.indirectObjectBaseAddress.value == StreamProperty64::initValue) { this->streamProperties.stateBaseAddress.copyPropertiesStatelessMocsIndirectState(dispatchFlags.requiredState->stateBaseAddress); } else { diff --git a/shared/test/common/fixtures/command_stream_receiver_fixture.cpp b/shared/test/common/fixtures/command_stream_receiver_fixture.cpp index 9bc8a3ad2e..27e3244e6a 100644 --- a/shared/test/common/fixtures/command_stream_receiver_fixture.cpp +++ b/shared/test/common/fixtures/command_stream_receiver_fixture.cpp @@ -37,6 +37,7 @@ void CommandStreamReceiverFixture::setUp() { requiredStreamProperties.initSupport(pDevice->getRootDeviceEnvironment()); immediateFlushTaskFlags.requiredState = &requiredStreamProperties; immediateFlushTaskFlags.sshCpuBase = sshBuffer; + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::kernel; if (pDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread) { auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); diff --git a/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp b/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp index d7a8aa12c7..29c60b9e5f 100644 --- a/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp +++ b/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp @@ -3705,6 +3705,21 @@ HWTEST2_F(CommandStreamReceiverHwTest, EXPECT_EQ(nullptr, pipelineSelectCmd); } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskCmdListDispatchWhenPipelineSelectNotInitializedThenDoNotDispatchPipelineSelectCommand, + IsWithinXeGfxFamily) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + EXPECT_FALSE(commandStreamReceiver.getPreambleSetFlag()); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::cmdList; + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); + EXPECT_FALSE(commandStreamReceiver.getPreambleSetFlag()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskOnSystolicPlatformWhenPipelineSelectAlreadyInitializedAndSystolicRequiredThenDispatchPipelineSelectCommandForSystolic, IsWithinXeGfxFamily) { @@ -3742,6 +3757,35 @@ HWTEST2_F(CommandStreamReceiverHwTest, } } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskNonKernelDispatchWhenPipelineSelectAlreadyInitializedAndSystolicRequiredThenIgnoreRequiredStreamProperties, + IsWithinXeGfxFamily) { + using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT; + + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + EXPECT_FALSE(commandStreamReceiver.getPreambleSetFlag()); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::nonKernel; + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + HardwareParse hwParserCsr; + hwParserCsr.parseCommands(commandStreamReceiver.commandStream, 0); + auto pipelineSelectCmd = hwParserCsr.getCommand(); + ASSERT_NE(nullptr, pipelineSelectCmd); + EXPECT_TRUE(commandStreamReceiver.getPreambleSetFlag()); + + this->requiredStreamProperties.pipelineSelect.setPropertySystolicMode(true); + + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, + commandStream.getUsed(), + immediateFlushTaskFlags, + *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskWhenFrontEndNotInitializedThenDispatchFrontEndCommand, IsAtLeastXeHpCore) { @@ -3772,6 +3816,21 @@ HWTEST2_F(CommandStreamReceiverHwTest, EXPECT_EQ(nullptr, frontEndCmd); } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskCmdListDispatchWhenFrontEndNotInitializedThenDoNotDispatchFrontEndCommand, + IsAtLeastXeHpCore) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + EXPECT_TRUE(commandStreamReceiver.getMediaVFEStateDirty()); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::cmdList; + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); + EXPECT_TRUE(commandStreamReceiver.getMediaVFEStateDirty()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskOnChangingFrontEndPropertiesPlatformWhenFrontEndAlreadyInitializedAndFrontEndPropertyChangeRequiredThenDispatchFrontEndCommand, IsWithinXeGfxFamily) { @@ -3818,6 +3877,35 @@ HWTEST2_F(CommandStreamReceiverHwTest, } } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskNonKernelDispatchWhenFrontEndAlreadyInitializedAndFrontEndPropertyChangeRequiredThenIgnoreRequiredStreamProperties, + IsWithinXeGfxFamily) { + using CFE_STATE = typename FamilyType::CFE_STATE; + + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + EXPECT_TRUE(commandStreamReceiver.getMediaVFEStateDirty()); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::nonKernel; + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + HardwareParse hwParserCsr; + hwParserCsr.parseCommands(commandStreamReceiver.commandStream, 0); + auto frontEndCmd = hwParserCsr.getCommand(); + ASSERT_NE(nullptr, frontEndCmd); + EXPECT_FALSE(commandStreamReceiver.getMediaVFEStateDirty()); + + this->requiredStreamProperties.frontEndState.setPropertiesComputeDispatchAllWalkerEnableDisableEuFusion(true, true); + + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, + commandStream.getUsed(), + immediateFlushTaskFlags, + *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskWhenStateComputeModeNotInitializedThenDispatchStateComputeModeCommand, IsAtLeastXeHpCore) { @@ -3851,6 +3939,24 @@ HWTEST2_F(CommandStreamReceiverHwTest, EXPECT_EQ(nullptr, stateComputeModeCmd); } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskCmdListDispatchWhenStateComputeModeNotInitializedThenDoNotDispatchStateComputeModeCommand, + IsAtLeastXeHpCore) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + if (commandStreamReceiver.heaplessStateInitialized) { + GTEST_SKIP(); + } + + EXPECT_TRUE(commandStreamReceiver.getStateComputeModeDirty()); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::cmdList; + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); + EXPECT_TRUE(commandStreamReceiver.getStateComputeModeDirty()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskOnChangingStateComputeModePropertiesPlatformWhenStateComputeModeAlreadyInitializedAndStateComputeModePropertyChangeRequiredThenDispatchStateComputeModeCommand, IsAtLeastXeHpCore) { @@ -3896,6 +4002,40 @@ HWTEST2_F(CommandStreamReceiverHwTest, } } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskNonKernelDispatchWhenStateComputeModeAlreadyInitializedAndStateComputeModePropertyChangeRequiredThenIgnoreRequiredStreamProperties, + IsAtLeastXeHpCore) { + using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; + + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + if (commandStreamReceiver.heaplessStateInitialized) { + GTEST_SKIP(); + } + + EXPECT_TRUE(commandStreamReceiver.getStateComputeModeDirty()); + + this->requiredStreamProperties.stateComputeMode.setPropertiesAll(false, GrfConfig::defaultGrfNumber, ThreadArbitrationPolicy::AgeBased, NEO::PreemptionMode::ThreadGroup); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::nonKernel; + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + HardwareParse hwParserCsr; + hwParserCsr.parseCommands(commandStreamReceiver.commandStream, 0); + auto stateComputeModeCmd = hwParserCsr.getCommand(); + ASSERT_NE(nullptr, stateComputeModeCmd); + EXPECT_FALSE(commandStreamReceiver.getStateComputeModeDirty()); + + this->requiredStreamProperties.stateComputeMode.setPropertiesGrfNumberThreadArbitration(GrfConfig::largeGrfNumber, ThreadArbitrationPolicy::RoundRobin); + + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, + commandStream.getUsed(), + immediateFlushTaskFlags, + *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskAndBindingPoolBaseAddressNeededWhenStateBaseAddressNotInitializedThenDispatchStateBaseAddressAndBindingPoolBaseAddressCommand, IsAtLeastXeHpCore) { @@ -3937,6 +4077,25 @@ HWTEST2_F(CommandStreamReceiverHwTest, EXPECT_EQ(nullptr, bindingTableAddress); } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskCmdListDispatchWhenStateBaseAddressNotInitializedThenDoNotDispatchStateBaseAddressAndBindingPoolBaseAddressCommand, + IsAtLeastXeHpCore) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + if (commandStreamReceiver.heaplessStateInitialized) { + GTEST_SKIP(); + } + + EXPECT_TRUE(commandStreamReceiver.getGSBAStateDirty()); + + this->requiredStreamProperties.stateBaseAddress.setPropertiesAll(1, 0x1000, 0x100, 0x2000, 0x100, 0x3000, 0x100, 0x4000, 0x100); + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::cmdList; + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); + EXPECT_TRUE(commandStreamReceiver.getGSBAStateDirty()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskAndBindingPoolBaseAddressNeededWhenStateBaseAddressInitializedAndHeapsChangedThenDispatchStateBaseAddressAndBindingPoolBaseAddressCommandTwice, IsAtLeastXeHpCore) { @@ -3980,6 +4139,46 @@ HWTEST2_F(CommandStreamReceiverHwTest, ASSERT_NE(nullptr, bindingTableAddress); } +HWTEST2_F(CommandStreamReceiverHwTest, + givenImmediateFlushTaskNonKernelDispatchWhenStateBaseAddressInitializedThenDispatchInitialStateBaseAddressAndIgnoreRequiredStreamProperties, + IsAtLeastXeHpCore) { + using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; + using _3DSTATE_BINDING_TABLE_POOL_ALLOC = typename FamilyType::_3DSTATE_BINDING_TABLE_POOL_ALLOC; + + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + if (commandStreamReceiver.heaplessStateInitialized) { + GTEST_SKIP(); + } + + EXPECT_TRUE(commandStreamReceiver.getGSBAStateDirty()); + + this->requiredStreamProperties.stateBaseAddress.setPropertiesAll(1, 0x1000, 0x100, 0x2000, 0x100, 0x3000, 0x100, 0x4000, 0x100); + + immediateFlushTaskFlags.dispatchOperation = NEO::AppendOperations::nonKernel; + commandStreamReceiver.flushImmediateTask(commandStream, commandStream.getUsed(), immediateFlushTaskFlags, *pDevice); + + HardwareParse hwParserCsr; + hwParserCsr.parseCommands(commandStreamReceiver.commandStream, 0); + auto stateBaseAddress = hwParserCsr.getCommand(); + ASSERT_NE(nullptr, stateBaseAddress); + EXPECT_EQ(0x4000u, stateBaseAddress->getGeneralStateBaseAddress()); + + auto bindingTableAddress = hwParserCsr.getCommand<_3DSTATE_BINDING_TABLE_POOL_ALLOC>(); + ASSERT_NE(nullptr, bindingTableAddress); + + EXPECT_FALSE(commandStreamReceiver.getGSBAStateDirty()); + + this->requiredStreamProperties.stateBaseAddress.setPropertiesBindingTableSurfaceState(0x5000, 0x100, 0x6000, 0x100); + + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + commandStreamReceiver.flushImmediateTask(commandStream, + commandStream.getUsed(), + immediateFlushTaskFlags, + *pDevice); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); +} + HWTEST2_F(CommandStreamReceiverHwTest, givenImmediateFlushTaskAndBindingPoolBaseAddressNeededWhenStateBaseAddressPropertiesNotProvidedForFirstFlushThenDispatchSecondSbaCommandWhenProvided, IsAtLeastXeHpCore) { @@ -6148,3 +6347,19 @@ HWTEST_F(CommandStreamReceiverHwTest, givenEpilogueStreamAvailableWhenFlushImmed commandStreamReceiver.getMemoryManager()->freeGraphicsMemoryImpl(commandBuffer); } + +HWTEST_F(CommandStreamReceiverHwTest, givenFlushBcsTaskCmdListDispatchWhenCalledThenNoPrologueIsSent) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + DispatchBcsFlags dispatchBcsFlags(false, false, false); + dispatchBcsFlags.dispatchOperation = NEO::AppendOperations::cmdList; + + size_t usedSize = commandStreamReceiver.commandStream.getUsed(); + + commandStreamReceiver.flushBcsTask(commandStream, + commandStream.getUsed(), + dispatchBcsFlags, + pDevice->getHardwareInfo()); + + EXPECT_EQ(usedSize, commandStreamReceiver.commandStream.getUsed()); +}