Revert "refactor: remove redundant querying topology info"

This reverts commit 9aa7ad0fd7.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-07-18 03:18:40 +02:00
committed by Compute-Runtime-Automation
parent 4fa6711025
commit d7777ef163
20 changed files with 754 additions and 14 deletions

View File

@@ -43,7 +43,6 @@
#include "shared/source/os_interface/os_environment.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/utilities/api_intercept.h"
#include "shared/source/utilities/directory.h"
#include "shared/source/utilities/io_functions.h"
@@ -511,11 +510,6 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
hwInfo->gtSystemInfo.SubSliceCount = static_cast<uint32_t>(topologyData.subSliceCount);
hwInfo->gtSystemInfo.DualSubSliceCount = static_cast<uint32_t>(topologyData.subSliceCount);
hwInfo->gtSystemInfo.EUCount = static_cast<uint32_t>(topologyData.euCount);
auto releaseHelper = rootDeviceEnvironment.getReleaseHelper();
auto numThreadsPerEu = releaseHelper ? releaseHelper->getNumThreadsPerEu() : 7u;
hwInfo->gtSystemInfo.ThreadCount = numThreadsPerEu * hwInfo->gtSystemInfo.EUCount;
if (topologyData.maxSubSliceCount > 0) {
hwInfo->gtSystemInfo.MaxSubSlicesSupported = static_cast<uint32_t>(topologyData.maxSubSliceCount);
hwInfo->gtSystemInfo.MaxDualSubSlicesSupported = static_cast<uint32_t>(topologyData.maxSubSliceCount);
@@ -532,6 +526,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
}
status = querySystemInfo();
auto releaseHelper = rootDeviceEnvironment.getReleaseHelper();
device->setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable, releaseHelper);
rootDeviceEnvironment.setRcsExposure();

View File

@@ -12,6 +12,7 @@
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/utilities/cpu_info.h"
#include <cstring>
@@ -70,6 +71,49 @@ int ProductHelper::configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo
auto gtSystemInfo = &outHwInfo->gtSystemInfo;
auto featureTable = &outHwInfo->featureTable;
DrmQueryTopologyData topologyData = {};
bool status = drm->queryTopology(*outHwInfo, topologyData);
if (!status) {
PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Topology query failed!\n");
topologyData.sliceCount = gtSystemInfo->SliceCount;
ret = drm->getEuTotal(topologyData.euCount);
if (ret != 0) {
PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query EU total parameter!\n");
*outHwInfo = {};
return ret;
}
ret = drm->getSubsliceTotal(topologyData.subSliceCount);
if (ret != 0) {
PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query subslice total parameter!\n");
*outHwInfo = {};
return ret;
}
topologyData.maxEuPerSubSlice = topologyData.subSliceCount > 0 ? topologyData.euCount / topologyData.subSliceCount : 0;
topologyData.maxSliceCount = topologyData.sliceCount;
topologyData.maxSubSliceCount = topologyData.sliceCount > 0 ? topologyData.subSliceCount / topologyData.sliceCount : 0;
}
auto releaseHelper = rootDeviceEnvironment.getReleaseHelper();
auto numThreadsPerEu = releaseHelper ? releaseHelper->getNumThreadsPerEu() : 7u;
gtSystemInfo->SliceCount = static_cast<uint32_t>(topologyData.sliceCount);
gtSystemInfo->SubSliceCount = static_cast<uint32_t>(topologyData.subSliceCount);
gtSystemInfo->DualSubSliceCount = static_cast<uint32_t>(topologyData.subSliceCount);
gtSystemInfo->EUCount = static_cast<uint32_t>(topologyData.euCount);
gtSystemInfo->ThreadCount = numThreadsPerEu * gtSystemInfo->EUCount;
gtSystemInfo->MaxEuPerSubSlice = gtSystemInfo->MaxEuPerSubSlice != 0 ? gtSystemInfo->MaxEuPerSubSlice : topologyData.maxEuPerSubSlice;
gtSystemInfo->MaxSubSlicesSupported = std::max(static_cast<uint32_t>(topologyData.maxSubSliceCount * topologyData.maxSliceCount), gtSystemInfo->MaxSubSlicesSupported);
gtSystemInfo->MaxSlicesSupported = topologyData.maxSliceCount;
gtSystemInfo->MaxDualSubSlicesSupported = gtSystemInfo->MaxSubSlicesSupported;
gtSystemInfo->IsDynamicallyPopulated = true;
for (uint32_t slice = 0; slice < GT_MAX_SLICE; slice++) {
gtSystemInfo->SliceInfo[slice].Enabled = slice < gtSystemInfo->SliceCount;