fix: correct calculating highest enabled dual subslice

when no DSS is exposed then calculate highest enabled subslice instead

Related-To: NEO-9614
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-01-18 17:19:39 +00:00
committed by Compute-Runtime-Automation
parent 9c7578f5f4
commit 028a5ee2fc
5 changed files with 57 additions and 11 deletions

View File

@@ -94,13 +94,30 @@ uint32_t GfxCoreHelper::getHighestEnabledSlice(const HardwareInfo &hwInfo) {
return highestEnabledSlice;
}
uint32_t getHighestEnabledSubSlice(const HardwareInfo &hwInfo) {
uint32_t highestSubSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported;
uint32_t numSubSlicesPerSlice = highestSubSlice / hwInfo.gtSystemInfo.MaxSlicesSupported;
uint32_t highestEnabledSliceIdx = GfxCoreHelper::getHighestEnabledSlice(hwInfo) - 1;
for (int32_t subSliceId = GT_MAX_SUBSLICE_PER_SLICE - 1; subSliceId >= 0; subSliceId--) {
if (hwInfo.gtSystemInfo.SliceInfo[highestEnabledSliceIdx].SubSliceInfo[subSliceId].Enabled) {
return highestEnabledSliceIdx * numSubSlicesPerSlice + subSliceId + 1;
}
}
return highestSubSlice;
}
uint32_t GfxCoreHelper::getHighestEnabledDualSubSlice(const HardwareInfo &hwInfo) {
uint32_t highestDualSubSlice = hwInfo.gtSystemInfo.MaxDualSubSlicesSupported;
if (!hwInfo.gtSystemInfo.IsDynamicallyPopulated) {
return highestDualSubSlice;
}
if (highestDualSubSlice == 0) {
return getHighestEnabledSubSlice(hwInfo);
}
uint32_t numDssPerSlice = highestDualSubSlice / hwInfo.gtSystemInfo.MaxSlicesSupported;
uint32_t highestEnabledSliceIdx = getHighestEnabledSlice(hwInfo) - 1;

View File

@@ -267,9 +267,6 @@ bool Wddm::queryAdapterInfo() {
if (status == STATUS_SUCCESS) {
memcpy_s(gtSystemInfo.get(), sizeof(GT_SYSTEM_INFO), &adapterInfo.SystemInfo, sizeof(GT_SYSTEM_INFO));
memcpy_s(gfxPlatform.get(), sizeof(PLATFORM_KMD), &adapterInfo.GfxPlatform, sizeof(PLATFORM_KMD));
if (gtSystemInfo->MaxDualSubSlicesSupported == 0) {
gtSystemInfo->MaxDualSubSlicesSupported = gtSystemInfo->MaxSubSlicesSupported / 2;
}
if (debugManager.flags.ForceDeviceId.get() != "unk") {
gfxPlatform->usDeviceID = static_cast<unsigned short>(std::stoi(debugManager.flags.ForceDeviceId.get(), nullptr, 16));

View File

@@ -1405,6 +1405,36 @@ HWTEST_F(GfxCoreHelperTest, WhenIsDynamicallyPopulatedIsFalseThenGetHighestEnabl
EXPECT_EQ(maxDualSubSlice, hwInfo.gtSystemInfo.MaxDualSubSlicesSupported);
}
TEST_F(GfxCoreHelperTest, givenNoMaxDualSubSlicesSupportedThenMaxEnabledDualSubSliceIsCalculatedBasedOnSubSlices) {
HardwareInfo hwInfo = *defaultHwInfo.get();
constexpr uint32_t maxSlices = 4u;
constexpr uint32_t maxSliceIndex = maxSlices - 1;
constexpr uint32_t subSlicesPerSlice = 5u;
constexpr uint32_t maxSubSliceEnabledOnLastSliceIndex = 6;
constexpr uint32_t maxSubSliceEnabled = 22u;
hwInfo.gtSystemInfo.MaxSlicesSupported = maxSlices;
hwInfo.gtSystemInfo.MaxSubSlicesSupported = maxSlices * subSlicesPerSlice;
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 0u;
hwInfo.gtSystemInfo.IsDynamicallyPopulated = true;
for (uint32_t slice = 0u; slice < GT_MAX_SLICE; slice++) {
hwInfo.gtSystemInfo.SliceInfo[slice].Enabled = false;
for (uint32_t dualSubSlice = 0; dualSubSlice < GT_MAX_DUALSUBSLICE_PER_SLICE; dualSubSlice++) {
hwInfo.gtSystemInfo.SliceInfo[slice].DSSInfo[dualSubSlice].Enabled = false;
}
for (uint32_t subSlice = 0; subSlice < GT_MAX_SUBSLICE_PER_SLICE; subSlice++) {
hwInfo.gtSystemInfo.SliceInfo[slice].SubSliceInfo[subSlice].Enabled = false;
}
}
hwInfo.gtSystemInfo.SliceInfo[maxSliceIndex].Enabled = true;
hwInfo.gtSystemInfo.SliceInfo[maxSliceIndex].SubSliceInfo[maxSubSliceEnabledOnLastSliceIndex].Enabled = true;
EXPECT_EQ(maxSubSliceEnabled, GfxCoreHelper::getHighestEnabledDualSubSlice(hwInfo));
}
HWTEST2_F(GfxCoreHelperTest, givenLargeGrfIsNotSupportedWhenCalculatingMaxWorkGroupSizeThenAlwaysReturnDeviceDefault, IsAtMostGen12lp) {
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto defaultMaxGroupSize = 42u;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -25,7 +25,9 @@ TEST(RayTracingHelperTests, whenMemoryBackedFifoSizeIsRequestedThenCorrectValueI
MockDevice device;
size_t size = RayTracingHelper::getTotalMemoryBackedFifoSize(device);
size_t expectedSize = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported * RayTracingHelper::memoryBackedFifoSizePerDss;
uint32_t subSliceCount = GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo());
size_t expectedSize = subSliceCount * RayTracingHelper::memoryBackedFifoSizePerDss;
EXPECT_LT(0u, size);
EXPECT_EQ(expectedSize, size);
}
@@ -57,8 +59,9 @@ TEST(RayTracingHelperTests, whenNumRtStacksIsQueriedThenItIsEqualToNumRtStacksPe
uint32_t numDssRtStacksPerDss = RayTracingHelper::getNumRtStacksPerDss(device);
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacks(device);
uint32_t subsliceCount = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported;
uint32_t subsliceCount = GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo());
EXPECT_LT(0u, numDssRtStacks);
EXPECT_EQ(numDssRtStacks, numDssRtStacksPerDss * subsliceCount);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -1725,16 +1725,15 @@ TEST_F(WddmTestWithMockGdiDll, givenForceDeviceIdWhenQueryAdapterInfoThenProperD
EXPECT_EQ(expectedDeviceId, wddm->gfxPlatform->usDeviceID);
}
TEST_F(WddmTestWithMockGdiDll, givenNoMaxDualSubSlicesSupportedWhenQueryAdapterInfoThenMaxDualSubSliceIsEqualHalfOfMaxSubSlice) {
TEST_F(WddmTestWithMockGdiDll, givenNoMaxDualSubSlicesSupportedWhenQueryAdapterInfoThenMaxDualSubSliceIsNotSet) {
HardwareInfo hwInfo = *defaultHwInfo.get();
uint32_t maxSS = 8u;
uint32_t expectedMaxDSS = maxSS / 2;
hwInfo.gtSystemInfo.MaxSubSlicesSupported = maxSS;
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 0u;
mockGdiDll.reset(setAdapterInfo(&hwInfo.platform, &hwInfo.gtSystemInfo, hwInfo.capabilityTable.gpuAddressSpace));
EXPECT_TRUE(wddm->queryAdapterInfo());
EXPECT_EQ(expectedMaxDSS, wddm->getGtSysInfo()->MaxDualSubSlicesSupported);
EXPECT_EQ(0u, wddm->getGtSysInfo()->MaxDualSubSlicesSupported);
}
TEST_F(WddmTestWithMockGdiDll, givenNonZeroMaxDualSubSlicesSupportedWhenQueryAdapterInfoThenNothingChanged) {