From 6d945ad28b5fba6c2d5ef09bb55a4ccba15c19c1 Mon Sep 17 00:00:00 2001 From: Jemale Lockett Date: Wed, 27 Mar 2024 20:53:04 +0000 Subject: [PATCH] fix: Update topology mapping Updates topology mapping to handle case when no dual subslices Resolves: NEO-10670 Signed-off-by: Jemale Lockett --- .../source/os_interface/windows/wddm/wddm.cpp | 16 +++- .../os_interface/windows/wddm_tests.cpp | 80 ++++++++++++++++++- 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 5d748e28b7..2067e7e62e 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -201,7 +201,7 @@ bool Wddm::translateTopologyInfo(TopologyMapping &mapping) { std::vector subSliceIndices; subSliceIndices.reserve((gtSystemInfo.SliceInfo[x].DualSubSliceEnabledCount) * GT_MAX_SUBSLICE_PER_DSS); - // subSliceIndex is used to track the index number of subslices from all DSS in this slice + // subSliceIndex is used to track the index number of subslices from all SS or DSS in this slice int subSliceIndex = -1; for (uint32_t dss = 0; dss < GT_MAX_DUALSUBSLICE_PER_SLICE; dss++) { if (!gtSystemInfo.SliceInfo[x].DSSInfo[dss].Enabled) { @@ -221,6 +221,20 @@ bool Wddm::translateTopologyInfo(TopologyMapping &mapping) { } } + if (subSliceCount == 0) { + for (uint32_t sss = 0; sss < GT_MAX_SUBSLICE_PER_SLICE; sss++) { + subSliceIndex++; + if (!gtSystemInfo.SliceInfo[x].SubSliceInfo[sss].Enabled) { + continue; + } + + subSliceCount++; + subSliceIndices.push_back(subSliceIndex); + + euCount += gtSystemInfo.SliceInfo[x].SubSliceInfo[sss].EuEnabledCount; + } + } + // single slice available if (sliceCount == 1) { mapping.subsliceIndices = std::move(subSliceIndices); diff --git a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp index 4bc4ad5641..776d72faff 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -416,6 +416,84 @@ TEST_F(WddmTests, GivenNoSliceEnabledWhenQueryingTopologyThenExpectFalse) { EXPECT_FALSE(wddm->buildTopologyMapping()); } +TEST_F(WddmTests, GivenOnlySubsliceEnabledWhenQueryingTopologyThenExpectTrue) { + HardwareInfo hwInfo = *defaultHwInfo.get(); + hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 1; + hwInfo.gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE; + hwInfo.gtSystemInfo.IsDynamicallyPopulated = true; + hwInfo.gtSystemInfo.SliceCount = 1; // Only one slice enabled + + for (auto &sliceInfo : hwInfo.gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + } + + hwInfo.gtSystemInfo.SliceInfo[0].Enabled = true; + hwInfo.gtSystemInfo.SliceInfo[0].DualSubSliceEnabledCount = 0; + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceEnabledCount = 2; + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[0].Enabled = false; // SS[0] disabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[1].Enabled = true; // SS[1] enabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[1].EuEnabledCount = 4; + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[2].Enabled = false; // SS[2] disabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[3].Enabled = true; // SS[3] enabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[3].EuEnabledCount = 4; + + wddm->rootDeviceEnvironment.setHwInfoAndInitHelpers(&hwInfo); + EXPECT_TRUE(wddm->buildTopologyMapping()); + const auto &topologyMap = wddm->getTopologyMap(); + EXPECT_EQ(topologyMap.size(), 1u); + EXPECT_EQ(topologyMap.at(0).sliceIndices.size(), 1u); + EXPECT_EQ(topologyMap.at(0).sliceIndices[0], 0); + EXPECT_EQ(topologyMap.at(0).subsliceIndices.size(), 2u); + const auto base = 2 * GT_MAX_DUALSUBSLICE_PER_SLICE; + EXPECT_EQ(topologyMap.at(0).subsliceIndices[0], base + 1); + EXPECT_EQ(topologyMap.at(0).subsliceIndices[1], base + 3); +} + +TEST_F(WddmTests, GivenBothSublicesAndDualSubslicesEnabledWhenQueryingTopologyThenOnlyDSSInfoCounted) { + HardwareInfo hwInfo = *defaultHwInfo.get(); + hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 1; + hwInfo.gtSystemInfo.MaxSlicesSupported = GT_MAX_SLICE; + hwInfo.gtSystemInfo.IsDynamicallyPopulated = true; + hwInfo.gtSystemInfo.SliceCount = 1; // Only one slice enabled + + for (auto &sliceInfo : hwInfo.gtSystemInfo.SliceInfo) { + sliceInfo.Enabled = false; + } + + hwInfo.gtSystemInfo.SliceInfo[0].Enabled = true; + hwInfo.gtSystemInfo.SliceInfo[0].DualSubSliceEnabledCount = 2; + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[0].Enabled = false; // DSS[0] disabled + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[1].Enabled = true; // DSS[1] enabled + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[1].SubSlice[0].Enabled = false; + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[1].SubSlice[1].Enabled = true; + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[1].SubSlice[1].EuEnabledCount = 4; + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[2].Enabled = false; // DSS[2] disabled + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[3].Enabled = true; // DSS[3] enabled + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[3].SubSlice[0].Enabled = true; + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[3].SubSlice[1].Enabled = true; + hwInfo.gtSystemInfo.SliceInfo[0].DSSInfo[3].SubSlice[1].EuEnabledCount = 4; + + hwInfo.gtSystemInfo.SliceInfo[0].DualSubSliceEnabledCount = 2; + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceEnabledCount = 2; + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[0].Enabled = false; // SS[0] disabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[1].Enabled = true; // SS[1] enabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[1].EuEnabledCount = 4; + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[2].Enabled = true; // SS[2] enabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[3].Enabled = true; // SS[3] enabled + hwInfo.gtSystemInfo.SliceInfo[0].SubSliceInfo[3].EuEnabledCount = 4; + + wddm->rootDeviceEnvironment.setHwInfoAndInitHelpers(&hwInfo); + EXPECT_TRUE(wddm->buildTopologyMapping()); + const auto &topologyMap = wddm->getTopologyMap(); + EXPECT_EQ(topologyMap.size(), 1u); + EXPECT_EQ(topologyMap.at(0).sliceIndices.size(), 1u); + EXPECT_EQ(topologyMap.at(0).sliceIndices[0], 0); + EXPECT_EQ(topologyMap.at(0).subsliceIndices.size(), 3u); + EXPECT_EQ(topologyMap.at(0).subsliceIndices[0], 3); + EXPECT_EQ(topologyMap.at(0).subsliceIndices[1], 6); + EXPECT_EQ(topologyMap.at(0).subsliceIndices[2], 7); +} + TEST_F(WddmTests, GivenPlatformSupportsEvictIfNecessaryWhenAdjustingEvictNeededTrueThenExpectTrue) { wddm->platformSupportsEvictIfNecessary = true; bool value = wddm->adjustEvictNeededParameter(true);