diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl b/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl index a5577cdb1b..88b1ce74cb 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl @@ -678,9 +678,11 @@ ze_result_t CommandListCoreFamilyImmediate::appendMemoryCopy( auto estimatedSize = commonImmediateCommandSize; if (isCopyOnly(true)) { - auto nBlits = size / (NEO::BlitCommandsHelper::getMaxBlitWidth(this->device->getNEODevice()->getRootDeviceEnvironment()) * - NEO::BlitCommandsHelper::getMaxBlitHeight(this->device->getNEODevice()->getRootDeviceEnvironment(), true)); - auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper::estimatePostBlitCommandSize(); + auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment(); + auto &productHelper = rootDeviceEnvironment.getProductHelper(); + auto nBlits = size / (NEO::BlitCommandsHelper::getMaxBlitWidth(rootDeviceEnvironment) * + NEO::BlitCommandsHelper::getMaxBlitHeight(rootDeviceEnvironment, true)); + auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper::estimatePostBlitCommandSize(productHelper.isFlushBetweenBlitsRequired()); estimatedSize += nBlits * sizePerBlit; } checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false); @@ -740,10 +742,12 @@ ze_result_t CommandListCoreFamilyImmediate::appendMemoryCopyRegio auto estimatedSize = commonImmediateCommandSize; if (isCopyOnly(true)) { + auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment(); + auto &productHelper = rootDeviceEnvironment.getProductHelper(); auto xBlits = static_cast(std::ceil(srcRegion->width / static_cast(BlitterConstants::maxBlitWidth))); auto yBlits = static_cast(std::ceil(srcRegion->height / static_cast(BlitterConstants::maxBlitHeight))); auto zBlits = static_cast(srcRegion->depth); - auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper::estimatePostBlitCommandSize(); + auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper::estimatePostBlitCommandSize(productHelper.isFlushBetweenBlitsRequired()); estimatedSize += xBlits * yBlits * zBlits * sizePerBlit; } checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false); @@ -932,9 +936,11 @@ ze_result_t CommandListCoreFamilyImmediate::appendImageCopyRegion auto estimatedSize = commonImmediateCommandSize; if (isCopyOnly(false)) { + auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment(); + auto &productHelper = rootDeviceEnvironment.getProductHelper(); auto imgSize = L0::Image::fromHandle(hSrcImage)->getImageInfo().size; auto nBlits = static_cast(std::ceil(imgSize / static_cast(BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight))); - auto sizePerBlit = sizeof(typename GfxFamily::XY_BLOCK_COPY_BLT) + NEO::BlitCommandsHelper::estimatePostBlitCommandSize(); + auto sizePerBlit = sizeof(typename GfxFamily::XY_BLOCK_COPY_BLT) + NEO::BlitCommandsHelper::estimatePostBlitCommandSize(productHelper.isFlushBetweenBlitsRequired()); estimatedSize += nBlits * sizePerBlit; } checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp index 6542342d8e..e9283553be 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp @@ -692,12 +692,13 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeThenCal const uint32_t numberOfBlitOperations = 4; auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); + auto &productHelper = rootDeviceEnvironment.getProductHelper(); EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (productHelper.isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -752,7 +753,7 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectsubmissionEnabledEstima EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -798,7 +799,7 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeForWrit EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -853,7 +854,7 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectSubmissionEnabledEstima EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -906,7 +907,7 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands waArgs.isWaRequired = false; size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { expectedBaseSize += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -932,7 +933,7 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands waArgs.isWaRequired = false; size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize() + dummyBlitWaSize; - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { expectedBaseSize += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -966,7 +967,7 @@ HWTEST_F(BcsTests, givenBltSizeAndCsrDependenciesWhenEstimatingCommandSizeThenAd EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -996,7 +997,7 @@ HWTEST_F(BcsTests, givenBltSizeWithCsrDependenciesAndRelaxedOrderingWhenEstimati EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -1020,7 +1021,7 @@ HWTEST_F(BcsTests, givenImageAndBufferWhenEstimateBlitCommandSizeThenReturnCorre auto expectedSize = EncodeMiArbCheck::getCommandSize(); expectedSize += isImage ? sizeof(typename FamilyType::XY_BLOCK_COPY_BLT) : sizeof(typename FamilyType::XY_COPY_BLT); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { expectedSize += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } if (BlitCommandsHelper::preBlitCommandWARequired()) { @@ -1283,7 +1284,7 @@ HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredC EXPECT_EQ(expectedWidth, bltCmd->getDestinationPitch()); EXPECT_EQ(expectedWidth, bltCmd->getSourcePitch()); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { auto miFlush = genCmdCast(*(cmdIterator++)); EXPECT_NE(nullptr, miFlush); EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())}; @@ -1522,7 +1523,7 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP offset += (expectedWidth * expectedHeight); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { auto miFlush = genCmdCast(*(cmdIterator++)); EXPECT_NE(nullptr, miFlush); EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())}; @@ -1625,7 +1626,7 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP offset += (expectedWidth * expectedHeight); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { auto miFlush = genCmdCast(*(cmdIterator++)); EXPECT_NE(nullptr, miFlush); EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())}; @@ -1712,7 +1713,7 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP offset += (expectedWidth * expectedHeight); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { auto miFlush = genCmdCast(*(cmdIterator++)); EXPECT_NE(nullptr, miFlush); EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())}; diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp index 3a1979fa2c..35439be9eb 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp @@ -46,7 +46,7 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeThenAddAllRequiredComman waArgs.isWaRequired = false; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -82,7 +82,7 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -125,7 +125,7 @@ HWTEST_F(BcsTests, givenRelaxedOrderingEnabledWhenEstimatingCommandSizeThenAddAl EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -161,7 +161,7 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeForReadBufferRectThenAdd EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -197,7 +197,7 @@ HWTEST_F(BcsTests, givenBltWithBigCopySizeWhenEstimatingCommandSizeForReadBuffer EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } diff --git a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp index be0107a0b1..aa4807da37 100644 --- a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp +++ b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp @@ -198,11 +198,6 @@ size_t BlitCommandsHelper::getSizeForGlobalSequencerFlush() { return 0u; } -template -bool BlitCommandsHelper::miArbCheckWaRequired() { - return false; -} - template void BlitCommandsHelper::appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) { } diff --git a/shared/source/gen12lp/os_agnostic_product_helper_gen12lp.inl b/shared/source/gen12lp/os_agnostic_product_helper_gen12lp.inl index 9775293d8b..d72e1fb372 100644 --- a/shared/source/gen12lp/os_agnostic_product_helper_gen12lp.inl +++ b/shared/source/gen12lp/os_agnostic_product_helper_gen12lp.inl @@ -46,4 +46,9 @@ bool ProductHelperHw::isBufferPoolAllocatorSupported() const { return false; } +template <> +bool ProductHelperHw::isFlushBetweenBlitsRequired() const { + return false; +} + } // namespace NEO diff --git a/shared/source/helpers/blit_commands_helper.h b/shared/source/helpers/blit_commands_helper.h index a9f685f3a9..5e03ab4bc9 100644 --- a/shared/source/helpers/blit_commands_helper.h +++ b/shared/source/helpers/blit_commands_helper.h @@ -41,7 +41,7 @@ struct BlitCommandsHelper { static void dispatchPreBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment); static size_t estimatePreBlitCommandSize(); static void dispatchPostBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment); - static size_t estimatePostBlitCommandSize(); + static size_t estimatePostBlitCommandSize(bool withFlush); static size_t estimateBlitCommandSize(const Vec3 ©Size, const CsrDependencies &csrDependencies, bool updateTimestampPacket, bool profilingEnabled, bool isImage, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed, bool relaxedOrderingEnabled); static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, bool profilingEnabled, @@ -95,7 +95,6 @@ struct BlitCommandsHelper { static bool isCopyRegionPreferred(const Vec3 ©Size, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed); static void programGlobalSequencerFlush(LinearStream &commandStream); static size_t getSizeForGlobalSequencerFlush(); - static bool miArbCheckWaRequired(); static bool preBlitCommandWARequired(); static void appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd); static void printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const uint32_t sliceIndex); diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index 5dc7131dd3..025c313acb 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -93,7 +93,7 @@ void BlitCommandsHelper::dispatchPostBlitCommand(LinearStream &linear } } - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (rootDeviceEnvironment.getProductHelper().isFlushBetweenBlitsRequired()) { EncodeMiFlushDW::programWithWa(linearStream, 0, 0, args); } @@ -101,7 +101,7 @@ void BlitCommandsHelper::dispatchPostBlitCommand(LinearStream &linear } template -size_t BlitCommandsHelper::estimatePostBlitCommandSize() { +size_t BlitCommandsHelper::estimatePostBlitCommandSize(bool withFlush) { EncodeDummyBlitWaArgs waArgs{}; if (debugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::defaultMode) { @@ -115,7 +115,7 @@ size_t BlitCommandsHelper::estimatePostBlitCommandSize() { } } size_t size = 0u; - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (withFlush) { size += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } size += EncodeMiArbCheck::getCommandSize(); @@ -146,7 +146,7 @@ size_t BlitCommandsHelper::estimateBlitCommandSize(const Vec3 sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT); } - sizePerBlit += estimatePostBlitCommandSize(); + sizePerBlit += estimatePostBlitCommandSize(rootDeviceEnvironment.getProductHelper().isFlushBetweenBlitsRequired()); return TimestampPacketHelper::getRequiredCmdStreamSize(csrDependencies, relaxedOrderingEnabled) + TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer(csrDependencies) + (sizePerBlit * nBlits) + diff --git a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl index dd322853ba..88460d951e 100644 --- a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl @@ -290,11 +290,6 @@ size_t BlitCommandsHelper::getSizeForGlobalSequencerFlush() { return 0u; } -template -bool BlitCommandsHelper::miArbCheckWaRequired() { - return true; -} - template void BlitCommandsHelper::appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) { } diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 4e5b513e3a..c50de46291 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -272,6 +272,7 @@ class ProductHelper { virtual bool isCompressionForbidden(const HardwareInfo &hwInfo) const = 0; virtual bool isExposingSubdevicesAllowed() const = 0; virtual bool useAdditionalBlitProperties() const = 0; + virtual bool isFlushBetweenBlitsRequired() const = 0; virtual bool isNonCoherentTimestampsModeEnabled() const = 0; virtual bool isPackedCopyFormatSupported() const = 0; virtual bool isPidFdOrSocketForIpcSupported() const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 4463119250..d12a051609 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -1076,6 +1076,11 @@ bool ProductHelperHw::useAdditionalBlitProperties() const { return false; } +template +bool ProductHelperHw::isFlushBetweenBlitsRequired() const { + return true; +} + template bool ProductHelperHw::isPackedCopyFormatSupported() const { return false; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index b5450098de..b7b01c240a 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -209,6 +209,7 @@ class ProductHelperHw : public ProductHelper { bool isCompressionForbidden(const HardwareInfo &hwInfo) const override; bool isExposingSubdevicesAllowed() const override; bool useAdditionalBlitProperties() const override; + bool isFlushBetweenBlitsRequired() const override; bool isNonCoherentTimestampsModeEnabled() const override; bool getStorageInfoLocalOnlyFlag(LocalMemAllocationMode usmDeviceAllocationMode, bool defaultValue) const override; bool isPidFdOrSocketForIpcSupported() const override; diff --git a/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp b/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp index a5b6891be2..379d1cc408 100644 --- a/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp +++ b/shared/test/unit_test/gen12lp/test_command_encoder_gen12lp.cpp @@ -151,10 +151,10 @@ GEN12LPTEST_F(CommandEncoderTest, GivenGen12LpWhenProgrammingL3StateOffThenExpec EXPECT_EQ(itorLRI, commands.end()); } -using Gen12lpCommandEncodeTest = testing::Test; - -GEN12LPTEST_F(Gen12lpCommandEncodeTest, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue) { - EXPECT_FALSE(BlitCommandsHelper::miArbCheckWaRequired()); +GEN12LPTEST_F(CommandEncoderTest, givenBcsCommandsHelperWhenIsFlushBetweenBlitsRequiredThenReturnFalse) { + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + EXPECT_FALSE(productHelper.isFlushBetweenBlitsRequired()); } GEN12LPTEST_F(CommandEncodeStatesTest, givenGen12LpPlatformWhenAdjustPipelineSelectIsCalledThenPipelineIsDispatched) { diff --git a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp index 47ddc90f82..90feb73aa9 100644 --- a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp +++ b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp @@ -251,29 +251,31 @@ HWTEST_F(BlitTests, givenDebugVariablesWhenGettingMaxBlitSetSizeThenHonorUseProv } HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenReturnCorrectResult) { + const bool isFlushBetweenBlitsRequired = this->getHelper().isFlushBetweenBlitsRequired(); EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; DebugManagerStateRestore restore{}; size_t arbCheckSize = EncodeMiArbCheck::getCommandSize(); size_t expectedDefaultSize = arbCheckSize; - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (isFlushBetweenBlitsRequired) { expectedDefaultSize += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } - EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper::estimatePostBlitCommandSize()); + EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired)); debugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::miArbCheck); - EXPECT_EQ(arbCheckSize, BlitCommandsHelper::estimatePostBlitCommandSize()); + EXPECT_EQ(arbCheckSize, BlitCommandsHelper::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired)); debugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::miFlush); - EXPECT_EQ(EncodeMiFlushDW::getCommandSizeWithWa(waArgs), BlitCommandsHelper::estimatePostBlitCommandSize()); + EXPECT_EQ(EncodeMiFlushDW::getCommandSizeWithWa(waArgs), BlitCommandsHelper::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired)); debugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::none); - EXPECT_EQ(0u, BlitCommandsHelper::estimatePostBlitCommandSize()); + EXPECT_EQ(0u, BlitCommandsHelper::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired)); } HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorrectCommands) { + const auto isFlushBetweenBlitsRequired = this->getHelper().isFlushBetweenBlitsRequired(); using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK; using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW; DebugManagerStateRestore restore{}; @@ -284,7 +286,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr EncodeDummyBlitWaArgs waArgs{false, &rootDeviceEnvironment}; size_t expectedDefaultSize = EncodeMiArbCheck::getCommandSize() + BlitCommandsHelper::getDummyBlitSize(waArgs); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (isFlushBetweenBlitsRequired) { expectedDefaultSize += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } @@ -295,7 +297,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr CmdParse::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed()); auto iterator = commands.begin(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (isFlushBetweenBlitsRequired) { iterator = find(commands.begin(), commands.end()); EXPECT_NE(commands.end(), iterator); if (EncodeMiFlushDW::getCommandSizeWithWa(waArgs) == 2 * sizeof(MI_FLUSH_DW)) { @@ -1086,7 +1088,7 @@ HWTEST_F(BlitTests, givenBlitPropertiesContainerWithNullSrcOrDstAllocationWhenEs EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())}; size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck::getCommandSize(); - if (BlitCommandsHelper::miArbCheckWaRequired()) { + if (this->getHelper().isFlushBetweenBlitsRequired()) { cmdsSizePerBlit += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } auto expectedBlitInstructionsSize = cmdsSizePerBlit * numberOfBlts; @@ -1418,6 +1420,7 @@ HWTEST2_F(BlitTests, givenSystemMemoryPlatformWithBlitSyncPropertiesWithAndWitho } HWTEST_F(BlitTests, givenBlitPropertieswithImageOperationWhenCallingEstimateBlitCommandSizeThenBlockCopySizeIsReturned) { + const bool isFlushBetweenBlitsRequired = this->getHelper().isFlushBetweenBlitsRequired(); size_t maxBlitWidth = static_cast(BlitCommandsHelper::getMaxBlitWidth(pDevice->getRootDeviceEnvironmentRef())); Vec3 copySize{maxBlitWidth - 1, 1, 1}; NEO::CsrDependencies csrDependencies{}; @@ -1425,7 +1428,7 @@ HWTEST_F(BlitTests, givenBlitPropertieswithImageOperationWhenCallingEstimateBlit size_t totalSize = NEO::BlitCommandsHelper::estimateBlitCommandSize(copySize, csrDependencies, false, false, true, pDevice->getRootDeviceEnvironmentRef(), false, false); size_t expectedSize = sizeof(typename FamilyType::XY_BLOCK_COPY_BLT); - expectedSize += NEO::BlitCommandsHelper::estimatePostBlitCommandSize(); + expectedSize += NEO::BlitCommandsHelper::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired); expectedSize += NEO::BlitCommandsHelper::estimatePreBlitCommandSize(); EXPECT_EQ(expectedSize, totalSize); } diff --git a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp index 8e5cd60a81..02885fc1f3 100644 --- a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -431,7 +431,7 @@ HWTEST2_F(BlitTests, givenDisabledGlobalCacheInvalidationWhenProgrammingGlobalSe } HWTEST2_F(BlitTests, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue, IsXeHPOrAbove) { - EXPECT_TRUE(BlitCommandsHelper::miArbCheckWaRequired()); + EXPECT_TRUE(this->getHelper().isFlushBetweenBlitsRequired()); } HWTEST2_F(BlitTests, givenDebugVariableWhenDispatchBlitCommandsForImageRegionIsCalledThenCmdDetailsArePrintedToStdOutput, IsXeHPOrAbove) {