Set correct MaxSlicesSupported in gtSystemInfo

- calculate maxSubsliceCount in translateTopologyInfo
based on enabled bits

Related-To: LOCI-2080

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-05-17 15:04:01 +00:00
committed by Compute-Runtime-Automation
parent 35acadaf78
commit 4407bf9c49
4 changed files with 39 additions and 4 deletions

View File

@ -668,3 +668,26 @@ TEST(DrmQueryTest, GivenDrmWhenSetupHardwareInfoCalledThenCorrectMaxValuesInGtSy
EXPECT_EQ(NEO::defaultHwInfo->gtSystemInfo.MaxSubSlicesSupported, hwInfo->gtSystemInfo.MaxSubSlicesSupported);
EXPECT_EQ(NEO::defaultHwInfo->gtSystemInfo.MaxEuPerSubSlice, hwInfo->gtSystemInfo.MaxEuPerSubSlice);
}
TEST(DrmQueryTest, GivenLessAvailableSubSlicesThanMaxSubSlicesWhenQueryingTopologyInfoThenCorrectMaxSubSliceCountIsSet) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
*executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo() = *NEO::defaultHwInfo.get();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.disableSomeTopology = true;
Drm::QueryTopologyData topologyData = {};
drm.StoredSVal = 2;
drm.StoredSSVal = 6;
drm.StoredEUVal = 16;
EXPECT_TRUE(drm.queryTopology(*executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(), topologyData));
EXPECT_EQ(1, topologyData.sliceCount);
EXPECT_EQ(1, topologyData.subSliceCount);
EXPECT_EQ(1, topologyData.euCount);
EXPECT_EQ(drm.StoredSVal, topologyData.maxSliceCount);
EXPECT_EQ(2, topologyData.maxSubSliceCount);
}

View File

@ -555,7 +555,7 @@ TEST(HwInfoConfigLinuxTest, whenAdjustPlatformForProductFamilyCalledThenDoNothin
using HwConfigLinux = ::testing::Test;
HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwInfoThenMaxSlicesSupportedSetInGtSystemInfo, MatchAny) {
HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwInfoThenMaxSlicesSupportedSetToAvailableCountInGtSystemInfo, MatchAny) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
@ -581,7 +581,7 @@ HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwI
EXPECT_EQ(static_cast<uint32_t>(drm->StoredSSVal * 2), outHwInfo.gtSystemInfo.MaxSubSlicesSupported);
EXPECT_EQ(static_cast<uint32_t>(drm->StoredSSVal * 2), outHwInfo.gtSystemInfo.MaxDualSubSlicesSupported);
EXPECT_EQ(16u, outHwInfo.gtSystemInfo.MaxEuPerSubSlice);
EXPECT_EQ(static_cast<uint32_t>(drm->StoredSVal * 4), outHwInfo.gtSystemInfo.MaxSlicesSupported);
EXPECT_EQ(static_cast<uint32_t>(drm->StoredSVal), outHwInfo.gtSystemInfo.MaxSlicesSupported);
drm->StoredSVal = 3;
drm->StoredSSVal = 12;

View File

@ -639,7 +639,8 @@ bool Drm::translateTopologyInfo(const drm_i915_query_topology_info *queryTopolog
int sliceCount = 0;
int subSliceCount = 0;
int euCount = 0;
int maxSliceCount = queryTopologyInfo->max_slices;
int maxSliceCount = 0;
int maxSubSliceCountPerSlice = 0;
std::vector<int> sliceIndices;
sliceIndices.reserve(maxSliceCount);
@ -650,6 +651,10 @@ bool Drm::translateTopologyInfo(const drm_i915_query_topology_info *queryTopolog
}
sliceIndices.push_back(x);
sliceCount++;
std::vector<int> subSliceIndices;
subSliceIndices.reserve(queryTopologyInfo->max_subslices);
for (int y = 0; y < queryTopologyInfo->max_subslices; y++) {
size_t yOffset = (queryTopologyInfo->subslice_offset + x * queryTopologyInfo->subslice_stride + y / 8);
bool isSubSliceEnabled = (queryTopologyInfo->data[yOffset] >> (y % 8)) & 1;
@ -657,6 +662,8 @@ bool Drm::translateTopologyInfo(const drm_i915_query_topology_info *queryTopolog
continue;
}
subSliceCount++;
subSliceIndices.push_back(y);
for (int z = 0; z < queryTopologyInfo->max_eus_per_subslice; z++) {
size_t zOffset = (queryTopologyInfo->eu_offset + (x * queryTopologyInfo->max_subslices + y) * queryTopologyInfo->eu_stride + z / 8);
bool isEUEnabled = (queryTopologyInfo->data[zOffset] >> (z % 8)) & 1;
@ -666,6 +673,10 @@ bool Drm::translateTopologyInfo(const drm_i915_query_topology_info *queryTopolog
euCount++;
}
}
if (subSliceIndices.size()) {
maxSubSliceCountPerSlice = std::max(maxSubSliceCountPerSlice, subSliceIndices[subSliceIndices.size() - 1] + 1);
}
}
if (sliceIndices.size()) {
@ -677,6 +688,7 @@ bool Drm::translateTopologyInfo(const drm_i915_query_topology_info *queryTopolog
data.subSliceCount = subSliceCount;
data.euCount = euCount;
data.maxSliceCount = maxSliceCount;
data.maxSubSliceCount = maxSubSliceCountPerSlice;
return (data.sliceCount && data.subSliceCount && data.euCount);
}

View File

@ -124,7 +124,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
gtSystemInfo->ThreadCount = this->threadsPerEu * gtSystemInfo->EUCount;
gtSystemInfo->MaxSubSlicesSupported = std::max(static_cast<uint32_t>(topologyData.maxSubSliceCount * topologyData.maxSliceCount), gtSystemInfo->MaxSubSlicesSupported);
gtSystemInfo->MaxSlicesSupported = std::max(static_cast<uint32_t>(topologyData.maxSliceCount), gtSystemInfo->MaxSlicesSupported);
gtSystemInfo->MaxSlicesSupported = topologyData.maxSliceCount;
uint64_t gttSizeQuery = 0;
featureTable->ftrSVM = true;