diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 6f094b8659..87ab286e5c 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -681,14 +681,6 @@ bool GfxCoreHelperHw::copyThroughLockedPtrEnabled(const HardwareInfo return false; } -template -uint32_t GfxCoreHelperHw::getAmountOfAllocationsToFill() const { - if (debugManager.flags.SetAmountOfReusableAllocations.get() != -1) { - return debugManager.flags.SetAmountOfReusableAllocations.get(); - } - return 0u; -} - template bool GfxCoreHelperHw::isChipsetUniqueUUIDSupported() const { return false; diff --git a/shared/source/helpers/gfx_core_helper_bdw_and_later.inl b/shared/source/helpers/gfx_core_helper_bdw_and_later.inl index 3a6cef9d02..142b8e94ee 100644 --- a/shared/source/helpers/gfx_core_helper_bdw_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_bdw_and_later.inl @@ -43,6 +43,14 @@ bool GfxCoreHelperHw::timestampPacketWriteSupported() const { return false; } +template +uint32_t GfxCoreHelperHw::getAmountOfAllocationsToFill() const { + if (debugManager.flags.SetAmountOfReusableAllocations.get() != -1) { + return debugManager.flags.SetAmountOfReusableAllocations.get(); + } + return 0u; +} + template bool GfxCoreHelperHw::isTimestampWaitSupportedForQueues() const { return false; diff --git a/shared/source/helpers/gfx_core_helper_xehp_and_later.inl b/shared/source/helpers/gfx_core_helper_xehp_and_later.inl index 0b962abe1c..f4a32f4141 100644 --- a/shared/source/helpers/gfx_core_helper_xehp_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_xehp_and_later.inl @@ -58,6 +58,14 @@ bool GfxCoreHelperHw::isTimestampWaitSupportedForQueues() const { return true; } +template +uint32_t GfxCoreHelperHw::getAmountOfAllocationsToFill() const { + if (debugManager.flags.SetAmountOfReusableAllocations.get() != -1) { + return debugManager.flags.SetAmountOfReusableAllocations.get(); + } + return 1u; +} + template bool GfxCoreHelperHw::makeResidentBeforeLockNeeded(bool precondition) const { return true; diff --git a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp index 30d4b0c3a4..30bf591243 100644 --- a/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/gfx_core_helper_xe_hpc_core.cpp @@ -399,14 +399,6 @@ bool GfxCoreHelperHw::copyThroughLockedPtrEnabled(const HardwareInfo &hw return true; } -template <> -uint32_t GfxCoreHelperHw::getAmountOfAllocationsToFill() const { - if (debugManager.flags.SetAmountOfReusableAllocations.get() != -1) { - return debugManager.flags.SetAmountOfReusableAllocations.get(); - } - return 1u; -} - template <> bool GfxCoreHelperHw::isRelaxedOrderingSupported() const { return true; diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 96758f7dff..af8b515d8f 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -1347,11 +1347,6 @@ HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabl EXPECT_FALSE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo, productHelper)); } -HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallGetAmountOfAllocationsToFillThenReturnFalse, IsNotXeHpcCore) { - const auto &gfxCoreHelper = getHelper(); - EXPECT_EQ(gfxCoreHelper.getAmountOfAllocationsToFill(), 0u); -} - HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenFlagSetAndCallCopyThroughLockedPtrEnabledThenReturnCorrectValue) { DebugManagerStateRestore restorer; const auto &gfxCoreHelper = getHelper(); @@ -1363,9 +1358,11 @@ HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenFlagSetAndCallCopyThroughLocke EXPECT_TRUE(gfxCoreHelper.copyThroughLockedPtrEnabled(*defaultHwInfo, productHelper)); } -HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenFlagSetAndCallGetAmountOfAllocationsToFillThenReturnCorrectValue) { +HWTEST2_F(GfxCoreHelperTest, givenGfxCoreHelperWhenFlagSetAndCallGetAmountOfAllocationsToFillThenReturnCorrectValue, IsBeforeXeHpCore) { DebugManagerStateRestore restorer; const auto &gfxCoreHelper = getHelper(); + EXPECT_EQ(gfxCoreHelper.getAmountOfAllocationsToFill(), 0u); + debugManager.flags.SetAmountOfReusableAllocations.set(0); EXPECT_EQ(gfxCoreHelper.getAmountOfAllocationsToFill(), 0u); diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp index 858893c57e..9c89de0aed 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests_dg2_and_later.cpp @@ -232,6 +232,19 @@ HWTEST2_F(GfxCoreHelperDg2AndLaterTest, givenGfxCoreHelperWhenCheckMakeResidentB EXPECT_TRUE(gfxCoreHelper.makeResidentBeforeLockNeeded(false)); } +HWTEST2_F(GfxCoreHelperDg2AndLaterTest, givenGfxCoreHelperWhenFlagSetAndCallGetAmountOfAllocationsToFillThenReturnCorrectValue, IsAtLeastXeHpgCore) { + DebugManagerStateRestore restorer; + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + EXPECT_EQ(gfxCoreHelper.getAmountOfAllocationsToFill(), 1u); + + debugManager.flags.SetAmountOfReusableAllocations.set(0); + EXPECT_EQ(gfxCoreHelper.getAmountOfAllocationsToFill(), 0u); + + debugManager.flags.SetAmountOfReusableAllocations.set(1); + EXPECT_EQ(gfxCoreHelper.getAmountOfAllocationsToFill(), 1u); +} + using ProductHelperTestDg2AndLater = ::testing::Test; HWTEST2_F(ProductHelperTestDg2AndLater, givenDg2AndLaterPlatformWhenAskedIfHeapInLocalMemThenTrueIsReturned, IsAtLeastXeHpgCore) {