diff --git a/shared/source/helpers/gfx_core_helper.cpp b/shared/source/helpers/gfx_core_helper.cpp index f416bcbe50..8582e395d5 100644 --- a/shared/source/helpers/gfx_core_helper.cpp +++ b/shared/source/helpers/gfx_core_helper.cpp @@ -94,7 +94,7 @@ uint32_t GfxCoreHelper::getHighestEnabledSlice(const HardwareInfo &hwInfo) { return highestEnabledSlice; } -uint32_t getHighestEnabledSubSlice(const HardwareInfo &hwInfo) { +uint32_t GfxCoreHelper::getHighestEnabledSubSlice(const HardwareInfo &hwInfo) { uint32_t numSubSlicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported; uint32_t highestEnabledSliceIdx = GfxCoreHelper::getHighestEnabledSlice(hwInfo) - 1; uint32_t highestSubSlice = (highestEnabledSliceIdx + 1) * numSubSlicesPerSlice; diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index fd7a526b5c..1ec5c7a66b 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -76,6 +76,7 @@ class GfxCoreHelper { static bool cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo); static uint32_t getHighestEnabledSlice(const HardwareInfo &hwInfo); static uint32_t getHighestEnabledDualSubSlice(const HardwareInfo &hwInfo); + static uint32_t getHighestEnabledSubSlice(const HardwareInfo &hwInfo); virtual bool timestampPacketWriteSupported() const = 0; virtual bool isTimestampWaitSupportedForQueues() const = 0; virtual bool isUpdateTaskCountFromWaitSupported() const = 0; 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 04349e633f..bbaf0e98bb 100644 --- a/shared/source/helpers/gfx_core_helper_xehp_and_later.inl +++ b/shared/source/helpers/gfx_core_helper_xehp_and_later.inl @@ -26,9 +26,8 @@ uint32_t GfxCoreHelperHw::getComputeUnitsUsedForScratch(const RootDev return static_cast(debugManager.flags.OverrideNumComputeUnitsForScratch.get()); } - auto &productHelper = rootDeviceEnvironment.getHelper(); auto hwInfo = rootDeviceEnvironment.getHardwareInfo(); - auto maxSubSlice = productHelper.computeMaxNeededSubSliceSpace(*hwInfo); + auto maxSubSlice = GfxCoreHelper::getHighestEnabledSubSlice(*hwInfo); // XeHP and later products return physical threads return maxSubSlice * hwInfo->gtSystemInfo.MaxEuPerSubSlice * (hwInfo->gtSystemInfo.ThreadCount / hwInfo->gtSystemInfo.EUCount); } diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 4bc3b65ee2..dba5f4520c 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -134,7 +134,6 @@ class ProductHelper { virtual bool isDcFlushMitigated() const = 0; virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0; virtual bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const = 0; - virtual uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const = 0; virtual bool getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array &uuid) const = 0; virtual bool isFlushTaskAllowed() const = 0; virtual bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 0aa96e6586..80579b7a82 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -433,11 +433,6 @@ bool ProductHelperHw::overrideCacheableForDcFlushMitigation(Allocati allocationType == AllocationType::printfSurface); } -template -uint32_t ProductHelperHw::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const { - return hwInfo.gtSystemInfo.MaxSubSlicesSupported; -} - template bool ProductHelperHw::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array &uuid) const { return false; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 64b1e2d410..36840527c2 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -78,7 +78,6 @@ class ProductHelperHw : public ProductHelper { bool isDcFlushMitigated() const override; bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override; bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const override; - uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const override; bool getUuid(NEO::DriverModel *driverModel, uint32_t subDeviceCount, uint32_t deviceIndex, std::array &uuid) const override; bool isFlushTaskAllowed() const override; bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const override; 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 fba0693d54..35b346394c 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 @@ -354,7 +354,7 @@ uint32_t GfxCoreHelperHw::getComputeUnitsUsedForScratch(const RootDevice auto hwInfo = rootDeviceEnvironment.getHardwareInfo(); uint32_t threadEuRatio = helper.getThreadEuRatioForScratch(*hwInfo); - return hwInfo->gtSystemInfo.MaxSubSlicesSupported * hwInfo->gtSystemInfo.MaxEuPerSubSlice * threadEuRatio; + return getHighestEnabledSubSlice(*hwInfo) * hwInfo->gtSystemInfo.MaxEuPerSubSlice * threadEuRatio; } template <> diff --git a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl index 8e7480163d..0f43137bf6 100644 --- a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl +++ b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl @@ -162,18 +162,6 @@ bool ProductHelperHw::isTile64With3DSurfaceOnBCSSupported(const Hard return true; } -template <> -uint32_t ProductHelperHw::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const { - const uint32_t highestEnabledSlice = NEO::GfxCoreHelper::getHighestEnabledSlice(hwInfo); - - UNRECOVERABLE_IF(highestEnabledSlice == 0); - UNRECOVERABLE_IF(hwInfo.gtSystemInfo.MaxSlicesSupported == 0); - auto subSlicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported; - auto maxSubSlice = std::max(highestEnabledSlice * subSlicesPerSlice, hwInfo.gtSystemInfo.MaxSubSlicesSupported); - - return maxSubSlice; -} - template <> bool ProductHelperHw::isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const { if (memoryManager) { diff --git a/shared/test/common/mocks/mock_product_helper.cpp b/shared/test/common/mocks/mock_product_helper.cpp index 869e2216cc..4049c374ba 100644 --- a/shared/test/common/mocks/mock_product_helper.cpp +++ b/shared/test/common/mocks/mock_product_helper.cpp @@ -291,11 +291,6 @@ bool ProductHelperHw::overrideCacheableForDcFlushMitigation(Alloca return false; } -template <> -uint32_t ProductHelperHw::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const { - return hwInfo.gtSystemInfo.MaxSubSlicesSupported; -} - template <> bool ProductHelperHw::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array &uuid) const { return false; diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index e5b89c68f4..0f5848aaeb 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -1106,7 +1106,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTest, givenHwInfoWhenRequestedComputeUnitsUse const uint32_t multiplyFactor = productHelper.getThreadEuRatioForScratch(hwInfo) / 8u; const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount) * multiplyFactor; - uint32_t expectedValue = productHelper.computeMaxNeededSubSliceSpace(hwInfo) * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu; + uint32_t expectedValue = GfxCoreHelper::getHighestEnabledSubSlice(hwInfo) * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu; EXPECT_EQ(expectedValue, gfxCoreHelper.getComputeUnitsUsedForScratch(pDevice->getRootDeviceEnvironment())); EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch); diff --git a/shared/test/unit_test/os_interface/product_helper_tests.cpp b/shared/test/unit_test/os_interface/product_helper_tests.cpp index c19f2ee494..2247148a50 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -992,26 +992,6 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenItsXe2PlusThenCacheLineSizeIs EXPECT_EQ(productHelper->getCacheLineSize(), 256u); } -TEST_F(ProductHelperTest, whenGettingMaxSubSliceSpaceThenValueIsNotSmallerThanMaxSubSliceCount) { - constexpr auto maxSupportedSubSlices = 128u; - auto hwInfo = *defaultHwInfo; - auto >SystemInfo = hwInfo.gtSystemInfo; - gtSystemInfo.SliceCount = 1; - gtSystemInfo.SubSliceCount = 2; - gtSystemInfo.DualSubSliceCount = 2; - - gtSystemInfo.MaxSlicesSupported = 2; - gtSystemInfo.MaxSlicesSupported = 2; - gtSystemInfo.MaxSubSlicesSupported = maxSupportedSubSlices; - gtSystemInfo.MaxDualSubSlicesSupported = maxSupportedSubSlices; - - gtSystemInfo.IsDynamicallyPopulated = true; - for (uint32_t slice = 0; slice < GT_MAX_SLICE; slice++) { - gtSystemInfo.SliceInfo[slice].Enabled = slice < gtSystemInfo.SliceCount; - } - EXPECT_EQ(maxSupportedSubSlices, productHelper->computeMaxNeededSubSliceSpace(hwInfo)); -} - HWTEST_F(ProductHelperTest, givenDefaultProductHelperWhenQuery2DBlockLoadThenReturnFalse) { EXPECT_FALSE(productHelper->supports2DBlockLoad()); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp index 225a448f93..bff3364c3d 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/gfx_core_helper_tests_pvc.cpp @@ -78,7 +78,9 @@ PVCTEST_F(GfxCoreHelperTestsPvc, givenRevisionIdWhenGetComputeUnitsUsedForScratc auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo.gtSystemInfo.EUCount *= 2; - uint32_t expectedValue = hwInfo.gtSystemInfo.MaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice; + auto highestEnabledSubSlice = GfxCoreHelper::getHighestEnabledSubSlice(hwInfo); + + uint32_t expectedValue = highestEnabledSubSlice * hwInfo.gtSystemInfo.MaxEuPerSubSlice; struct { unsigned short revId; diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp index 7dc36e0eca..08a668ec2d 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp @@ -695,17 +695,6 @@ DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeU EXPECT_EQ(expectedCalculation, gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0])); } -DG2TEST_F(ProductHelperTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScratchThenThrowUnrecoverableIf) { - HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); - GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; - testSysInfo.IsDynamicallyPopulated = false; - testSysInfo.MaxSlicesSupported = 0; - - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - - EXPECT_THROW(gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0]), std::exception); -} - DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents());