Skip to content

Commit 028a5ee

Browse files
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 <[email protected]>
1 parent 9c7578f commit 028a5ee

File tree

5 files changed

+57
-11
lines changed

5 files changed

+57
-11
lines changed

shared/source/helpers/gfx_core_helper.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,30 @@ uint32_t GfxCoreHelper::getHighestEnabledSlice(const HardwareInfo &hwInfo) {
9494
return highestEnabledSlice;
9595
}
9696

97+
uint32_t getHighestEnabledSubSlice(const HardwareInfo &hwInfo) {
98+
uint32_t highestSubSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported;
99+
uint32_t numSubSlicesPerSlice = highestSubSlice / hwInfo.gtSystemInfo.MaxSlicesSupported;
100+
uint32_t highestEnabledSliceIdx = GfxCoreHelper::getHighestEnabledSlice(hwInfo) - 1;
101+
102+
for (int32_t subSliceId = GT_MAX_SUBSLICE_PER_SLICE - 1; subSliceId >= 0; subSliceId--) {
103+
if (hwInfo.gtSystemInfo.SliceInfo[highestEnabledSliceIdx].SubSliceInfo[subSliceId].Enabled) {
104+
return highestEnabledSliceIdx * numSubSlicesPerSlice + subSliceId + 1;
105+
}
106+
}
107+
108+
return highestSubSlice;
109+
}
110+
97111
uint32_t GfxCoreHelper::getHighestEnabledDualSubSlice(const HardwareInfo &hwInfo) {
98112
uint32_t highestDualSubSlice = hwInfo.gtSystemInfo.MaxDualSubSlicesSupported;
99-
100113
if (!hwInfo.gtSystemInfo.IsDynamicallyPopulated) {
101114
return highestDualSubSlice;
102115
}
103116

117+
if (highestDualSubSlice == 0) {
118+
return getHighestEnabledSubSlice(hwInfo);
119+
}
120+
104121
uint32_t numDssPerSlice = highestDualSubSlice / hwInfo.gtSystemInfo.MaxSlicesSupported;
105122
uint32_t highestEnabledSliceIdx = getHighestEnabledSlice(hwInfo) - 1;
106123

shared/source/os_interface/windows/wddm/wddm.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@ bool Wddm::queryAdapterInfo() {
267267
if (status == STATUS_SUCCESS) {
268268
memcpy_s(gtSystemInfo.get(), sizeof(GT_SYSTEM_INFO), &adapterInfo.SystemInfo, sizeof(GT_SYSTEM_INFO));
269269
memcpy_s(gfxPlatform.get(), sizeof(PLATFORM_KMD), &adapterInfo.GfxPlatform, sizeof(PLATFORM_KMD));
270-
if (gtSystemInfo->MaxDualSubSlicesSupported == 0) {
271-
gtSystemInfo->MaxDualSubSlicesSupported = gtSystemInfo->MaxSubSlicesSupported / 2;
272-
}
273270

274271
if (debugManager.flags.ForceDeviceId.get() != "unk") {
275272
gfxPlatform->usDeviceID = static_cast<unsigned short>(std::stoi(debugManager.flags.ForceDeviceId.get(), nullptr, 16));

shared/test/unit_test/helpers/gfx_core_helper_tests.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,36 @@ HWTEST_F(GfxCoreHelperTest, WhenIsDynamicallyPopulatedIsFalseThenGetHighestEnabl
14051405
EXPECT_EQ(maxDualSubSlice, hwInfo.gtSystemInfo.MaxDualSubSlicesSupported);
14061406
}
14071407

1408+
TEST_F(GfxCoreHelperTest, givenNoMaxDualSubSlicesSupportedThenMaxEnabledDualSubSliceIsCalculatedBasedOnSubSlices) {
1409+
HardwareInfo hwInfo = *defaultHwInfo.get();
1410+
1411+
constexpr uint32_t maxSlices = 4u;
1412+
constexpr uint32_t maxSliceIndex = maxSlices - 1;
1413+
constexpr uint32_t subSlicesPerSlice = 5u;
1414+
1415+
constexpr uint32_t maxSubSliceEnabledOnLastSliceIndex = 6;
1416+
constexpr uint32_t maxSubSliceEnabled = 22u;
1417+
1418+
hwInfo.gtSystemInfo.MaxSlicesSupported = maxSlices;
1419+
hwInfo.gtSystemInfo.MaxSubSlicesSupported = maxSlices * subSlicesPerSlice;
1420+
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 0u;
1421+
hwInfo.gtSystemInfo.IsDynamicallyPopulated = true;
1422+
1423+
for (uint32_t slice = 0u; slice < GT_MAX_SLICE; slice++) {
1424+
hwInfo.gtSystemInfo.SliceInfo[slice].Enabled = false;
1425+
for (uint32_t dualSubSlice = 0; dualSubSlice < GT_MAX_DUALSUBSLICE_PER_SLICE; dualSubSlice++) {
1426+
hwInfo.gtSystemInfo.SliceInfo[slice].DSSInfo[dualSubSlice].Enabled = false;
1427+
}
1428+
for (uint32_t subSlice = 0; subSlice < GT_MAX_SUBSLICE_PER_SLICE; subSlice++) {
1429+
hwInfo.gtSystemInfo.SliceInfo[slice].SubSliceInfo[subSlice].Enabled = false;
1430+
}
1431+
}
1432+
hwInfo.gtSystemInfo.SliceInfo[maxSliceIndex].Enabled = true;
1433+
hwInfo.gtSystemInfo.SliceInfo[maxSliceIndex].SubSliceInfo[maxSubSliceEnabledOnLastSliceIndex].Enabled = true;
1434+
1435+
EXPECT_EQ(maxSubSliceEnabled, GfxCoreHelper::getHighestEnabledDualSubSlice(hwInfo));
1436+
}
1437+
14081438
HWTEST2_F(GfxCoreHelperTest, givenLargeGrfIsNotSupportedWhenCalculatingMaxWorkGroupSizeThenAlwaysReturnDeviceDefault, IsAtMostGen12lp) {
14091439
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
14101440
auto defaultMaxGroupSize = 42u;

shared/test/unit_test/helpers/ray_tracing_helper_tests.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2023 Intel Corporation
2+
* Copyright (C) 2020-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -25,7 +25,9 @@ TEST(RayTracingHelperTests, whenMemoryBackedFifoSizeIsRequestedThenCorrectValueI
2525
MockDevice device;
2626

2727
size_t size = RayTracingHelper::getTotalMemoryBackedFifoSize(device);
28-
size_t expectedSize = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported * RayTracingHelper::memoryBackedFifoSizePerDss;
28+
uint32_t subSliceCount = GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo());
29+
size_t expectedSize = subSliceCount * RayTracingHelper::memoryBackedFifoSizePerDss;
30+
EXPECT_LT(0u, size);
2931
EXPECT_EQ(expectedSize, size);
3032
}
3133

@@ -57,8 +59,9 @@ TEST(RayTracingHelperTests, whenNumRtStacksIsQueriedThenItIsEqualToNumRtStacksPe
5759

5860
uint32_t numDssRtStacksPerDss = RayTracingHelper::getNumRtStacksPerDss(device);
5961
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacks(device);
60-
uint32_t subsliceCount = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported;
62+
uint32_t subsliceCount = GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo());
6163

64+
EXPECT_LT(0u, numDssRtStacks);
6265
EXPECT_EQ(numDssRtStacks, numDssRtStacksPerDss * subsliceCount);
6366
}
6467

shared/test/unit_test/os_interface/windows/wddm20_tests.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -1725,16 +1725,15 @@ TEST_F(WddmTestWithMockGdiDll, givenForceDeviceIdWhenQueryAdapterInfoThenProperD
17251725
EXPECT_EQ(expectedDeviceId, wddm->gfxPlatform->usDeviceID);
17261726
}
17271727

1728-
TEST_F(WddmTestWithMockGdiDll, givenNoMaxDualSubSlicesSupportedWhenQueryAdapterInfoThenMaxDualSubSliceIsEqualHalfOfMaxSubSlice) {
1728+
TEST_F(WddmTestWithMockGdiDll, givenNoMaxDualSubSlicesSupportedWhenQueryAdapterInfoThenMaxDualSubSliceIsNotSet) {
17291729
HardwareInfo hwInfo = *defaultHwInfo.get();
17301730
uint32_t maxSS = 8u;
1731-
uint32_t expectedMaxDSS = maxSS / 2;
17321731
hwInfo.gtSystemInfo.MaxSubSlicesSupported = maxSS;
17331732
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 0u;
17341733

17351734
mockGdiDll.reset(setAdapterInfo(&hwInfo.platform, &hwInfo.gtSystemInfo, hwInfo.capabilityTable.gpuAddressSpace));
17361735
EXPECT_TRUE(wddm->queryAdapterInfo());
1737-
EXPECT_EQ(expectedMaxDSS, wddm->getGtSysInfo()->MaxDualSubSlicesSupported);
1736+
EXPECT_EQ(0u, wddm->getGtSysInfo()->MaxDualSubSlicesSupported);
17381737
}
17391738

17401739
TEST_F(WddmTestWithMockGdiDll, givenNonZeroMaxDualSubSlicesSupportedWhenQueryAdapterInfoThenNothingChanged) {

0 commit comments

Comments
 (0)