Revert "fix: correct calculating max subslice space"

This reverts commit 67f2500c03.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-08-02 11:53:36 +02:00
committed by Compute-Runtime-Automation
parent 43b81637df
commit e27efd701f
13 changed files with 61 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ uint32_t GfxCoreHelper::getHighestEnabledSlice(const HardwareInfo &hwInfo) {
return highestEnabledSlice; return highestEnabledSlice;
} }
uint32_t GfxCoreHelper::getHighestEnabledSubSlice(const HardwareInfo &hwInfo) { uint32_t getHighestEnabledSubSlice(const HardwareInfo &hwInfo) {
uint32_t numSubSlicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported; uint32_t numSubSlicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
uint32_t highestEnabledSliceIdx = GfxCoreHelper::getHighestEnabledSlice(hwInfo) - 1; uint32_t highestEnabledSliceIdx = GfxCoreHelper::getHighestEnabledSlice(hwInfo) - 1;
uint32_t highestSubSlice = (highestEnabledSliceIdx + 1) * numSubSlicesPerSlice; uint32_t highestSubSlice = (highestEnabledSliceIdx + 1) * numSubSlicesPerSlice;

View File

@@ -76,7 +76,6 @@ class GfxCoreHelper {
static bool cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo); static bool cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo);
static uint32_t getHighestEnabledSlice(const HardwareInfo &hwInfo); static uint32_t getHighestEnabledSlice(const HardwareInfo &hwInfo);
static uint32_t getHighestEnabledDualSubSlice(const HardwareInfo &hwInfo); static uint32_t getHighestEnabledDualSubSlice(const HardwareInfo &hwInfo);
static uint32_t getHighestEnabledSubSlice(const HardwareInfo &hwInfo);
virtual bool timestampPacketWriteSupported() const = 0; virtual bool timestampPacketWriteSupported() const = 0;
virtual bool isTimestampWaitSupportedForQueues() const = 0; virtual bool isTimestampWaitSupportedForQueues() const = 0;
virtual bool isUpdateTaskCountFromWaitSupported() const = 0; virtual bool isUpdateTaskCountFromWaitSupported() const = 0;

View File

@@ -26,8 +26,9 @@ uint32_t GfxCoreHelperHw<GfxFamily>::getComputeUnitsUsedForScratch(const RootDev
return static_cast<uint32_t>(debugManager.flags.OverrideNumComputeUnitsForScratch.get()); return static_cast<uint32_t>(debugManager.flags.OverrideNumComputeUnitsForScratch.get());
} }
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto hwInfo = rootDeviceEnvironment.getHardwareInfo(); auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
auto maxSubSlice = GfxCoreHelper::getHighestEnabledSubSlice(*hwInfo); auto maxSubSlice = productHelper.computeMaxNeededSubSliceSpace(*hwInfo);
// XeHP and later products return physical threads // XeHP and later products return physical threads
return maxSubSlice * hwInfo->gtSystemInfo.MaxEuPerSubSlice * (hwInfo->gtSystemInfo.ThreadCount / hwInfo->gtSystemInfo.EUCount); return maxSubSlice * hwInfo->gtSystemInfo.MaxEuPerSubSlice * (hwInfo->gtSystemInfo.ThreadCount / hwInfo->gtSystemInfo.EUCount);
} }

View File

@@ -134,6 +134,7 @@ class ProductHelper {
virtual bool isDcFlushMitigated() const = 0; virtual bool isDcFlushMitigated() const = 0;
virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0; virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0;
virtual bool overrideCacheableForDcFlushMitigation(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<uint8_t, ProductHelper::uuidSize> &uuid) const = 0; virtual bool getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const = 0;
virtual bool isFlushTaskAllowed() const = 0; virtual bool isFlushTaskAllowed() const = 0;
virtual bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const = 0; virtual bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const = 0;

View File

@@ -433,6 +433,11 @@ bool ProductHelperHw<gfxProduct>::overrideCacheableForDcFlushMitigation(Allocati
allocationType == AllocationType::printfSurface); allocationType == AllocationType::printfSurface);
} }
template <PRODUCT_FAMILY gfxProduct>
uint32_t ProductHelperHw<gfxProduct>::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const {
return hwInfo.gtSystemInfo.MaxSubSlicesSupported;
}
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const { bool ProductHelperHw<gfxProduct>::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const {
return false; return false;

View File

@@ -78,6 +78,7 @@ class ProductHelperHw : public ProductHelper {
bool isDcFlushMitigated() const override; bool isDcFlushMitigated() const override;
bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override; bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override;
bool overrideCacheableForDcFlushMitigation(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<uint8_t, ProductHelper::uuidSize> &uuid) const override; bool getUuid(NEO::DriverModel *driverModel, uint32_t subDeviceCount, uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const override;
bool isFlushTaskAllowed() const override; bool isFlushTaskAllowed() const override;
bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const override; bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const override;

View File

@@ -354,7 +354,7 @@ uint32_t GfxCoreHelperHw<Family>::getComputeUnitsUsedForScratch(const RootDevice
auto hwInfo = rootDeviceEnvironment.getHardwareInfo(); auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
uint32_t threadEuRatio = helper.getThreadEuRatioForScratch(*hwInfo); uint32_t threadEuRatio = helper.getThreadEuRatioForScratch(*hwInfo);
return getHighestEnabledSubSlice(*hwInfo) * hwInfo->gtSystemInfo.MaxEuPerSubSlice * threadEuRatio; return hwInfo->gtSystemInfo.MaxSubSlicesSupported * hwInfo->gtSystemInfo.MaxEuPerSubSlice * threadEuRatio;
} }
template <> template <>

View File

@@ -162,6 +162,18 @@ bool ProductHelperHw<gfxProduct>::isTile64With3DSurfaceOnBCSSupported(const Hard
return true; return true;
} }
template <>
uint32_t ProductHelperHw<gfxProduct>::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 <> template <>
bool ProductHelperHw<gfxProduct>::isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const { bool ProductHelperHw<gfxProduct>::isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const {
if (memoryManager) { if (memoryManager) {

View File

@@ -291,6 +291,11 @@ bool ProductHelperHw<IGFX_UNKNOWN>::overrideCacheableForDcFlushMitigation(Alloca
return false; return false;
} }
template <>
uint32_t ProductHelperHw<IGFX_UNKNOWN>::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const {
return hwInfo.gtSystemInfo.MaxSubSlicesSupported;
}
template <> template <>
bool ProductHelperHw<IGFX_UNKNOWN>::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const { bool ProductHelperHw<IGFX_UNKNOWN>::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const {
return false; return false;

View File

@@ -1106,7 +1106,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTest, givenHwInfoWhenRequestedComputeUnitsUse
const uint32_t multiplyFactor = productHelper.getThreadEuRatioForScratch(hwInfo) / 8u; const uint32_t multiplyFactor = productHelper.getThreadEuRatioForScratch(hwInfo) / 8u;
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount) * multiplyFactor; const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount) * multiplyFactor;
uint32_t expectedValue = GfxCoreHelper::getHighestEnabledSubSlice(hwInfo) * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu; uint32_t expectedValue = productHelper.computeMaxNeededSubSliceSpace(hwInfo) * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu;
EXPECT_EQ(expectedValue, gfxCoreHelper.getComputeUnitsUsedForScratch(pDevice->getRootDeviceEnvironment())); EXPECT_EQ(expectedValue, gfxCoreHelper.getComputeUnitsUsedForScratch(pDevice->getRootDeviceEnvironment()));
EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch); EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch);

View File

@@ -992,6 +992,26 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenItsXe2PlusThenCacheLineSizeIs
EXPECT_EQ(productHelper->getCacheLineSize(), 256u); EXPECT_EQ(productHelper->getCacheLineSize(), 256u);
} }
TEST_F(ProductHelperTest, whenGettingMaxSubSliceSpaceThenValueIsNotSmallerThanMaxSubSliceCount) {
constexpr auto maxSupportedSubSlices = 128u;
auto hwInfo = *defaultHwInfo;
auto &gtSystemInfo = 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) { HWTEST_F(ProductHelperTest, givenDefaultProductHelperWhenQuery2DBlockLoadThenReturnFalse) {
EXPECT_FALSE(productHelper->supports2DBlockLoad()); EXPECT_FALSE(productHelper->supports2DBlockLoad());

View File

@@ -78,9 +78,7 @@ PVCTEST_F(GfxCoreHelperTestsPvc, givenRevisionIdWhenGetComputeUnitsUsedForScratc
auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.gtSystemInfo.EUCount *= 2; hwInfo.gtSystemInfo.EUCount *= 2;
auto highestEnabledSubSlice = GfxCoreHelper::getHighestEnabledSubSlice(hwInfo); uint32_t expectedValue = hwInfo.gtSystemInfo.MaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice;
uint32_t expectedValue = highestEnabledSubSlice * hwInfo.gtSystemInfo.MaxEuPerSubSlice;
struct { struct {
unsigned short revId; unsigned short revId;

View File

@@ -695,6 +695,17 @@ DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeU
EXPECT_EQ(expectedCalculation, gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0])); 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<GfxCoreHelper>();
EXPECT_THROW(gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0]), std::exception);
}
DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) {
EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents()); EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents());