2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-06-25 17:37:08 +08:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2022-03-26 05:04:08 +08:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2023-02-02 00:23:01 +08:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2024-06-25 17:37:08 +08:00
|
|
|
#include "shared/source/release_helper/release_helper.h"
|
2020-07-30 21:02:11 +08:00
|
|
|
|
2019-07-18 17:58:30 +08:00
|
|
|
#include <algorithm>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-05-08 22:00:24 +08:00
|
|
|
HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable,
|
2023-07-31 20:48:31 +08:00
|
|
|
const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable)
|
|
|
|
: platform(*platform), featureTable(*featureTable), workaroundTable(*workaroundTable), gtSystemInfo(*gtSystemInfo), capabilityTable(capabilityTable) {
|
2018-06-12 15:42:47 +08:00
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-08-26 21:36:24 +08:00
|
|
|
// Global table of hardware prefixes
|
|
|
|
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = {
|
|
|
|
nullptr,
|
|
|
|
};
|
2019-10-18 16:15:09 +08:00
|
|
|
|
2019-08-26 21:36:24 +08:00
|
|
|
// Global table of family names
|
|
|
|
bool familyEnabled[IGFX_MAX_CORE] = {
|
|
|
|
false,
|
|
|
|
};
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {};
|
2023-11-16 22:24:12 +08:00
|
|
|
void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, uint64_t, const ReleaseHelper *) = {
|
2020-01-25 00:19:06 +08:00
|
|
|
0x0,
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
2023-11-16 22:24:12 +08:00
|
|
|
void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, const ReleaseHelper *) = {
|
2022-05-10 20:52:14 +08:00
|
|
|
0x0,
|
|
|
|
};
|
|
|
|
|
2019-07-18 17:58:30 +08:00
|
|
|
bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwInfoIn) {
|
|
|
|
std::transform(platform.begin(), platform.end(), platform.begin(), ::tolower);
|
|
|
|
|
2018-06-07 22:18:53 +08:00
|
|
|
bool ret = false;
|
|
|
|
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
|
|
|
if (hardwarePrefix[j] == nullptr)
|
|
|
|
continue;
|
2019-07-18 17:58:30 +08:00
|
|
|
if (hardwarePrefix[j] == platform) {
|
2018-06-07 22:18:53 +08:00
|
|
|
hwInfoIn = hardwareInfoTable[j];
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-01-13 16:30:01 +08:00
|
|
|
|
2018-06-07 22:18:53 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2018-10-02 04:36:15 +08:00
|
|
|
|
2020-01-25 00:19:06 +08:00
|
|
|
void setHwInfoValuesFromConfig(const uint64_t hwInfoConfig, HardwareInfo &hwInfoIn) {
|
|
|
|
uint32_t sliceCount = static_cast<uint16_t>(hwInfoConfig >> 32);
|
|
|
|
uint32_t subSlicePerSliceCount = static_cast<uint16_t>(hwInfoConfig >> 16);
|
|
|
|
uint32_t euPerSubSliceCount = static_cast<uint16_t>(hwInfoConfig);
|
|
|
|
|
|
|
|
hwInfoIn.gtSystemInfo.SliceCount = sliceCount;
|
|
|
|
hwInfoIn.gtSystemInfo.SubSliceCount = subSlicePerSliceCount * sliceCount;
|
2021-06-01 21:07:41 +08:00
|
|
|
hwInfoIn.gtSystemInfo.DualSubSliceCount = subSlicePerSliceCount * sliceCount;
|
2020-01-25 00:19:06 +08:00
|
|
|
hwInfoIn.gtSystemInfo.EUCount = euPerSubSliceCount * subSlicePerSliceCount * sliceCount;
|
2022-09-23 08:29:32 +08:00
|
|
|
hwInfoIn.gtSystemInfo.IsDynamicallyPopulated = true;
|
2021-12-07 03:25:14 +08:00
|
|
|
for (uint32_t slice = 0; slice < hwInfoIn.gtSystemInfo.SliceCount; slice++) {
|
|
|
|
hwInfoIn.gtSystemInfo.SliceInfo[slice].Enabled = true;
|
|
|
|
}
|
2023-11-15 18:05:30 +08:00
|
|
|
|
|
|
|
if (hwInfoIn.gtSystemInfo.MaxSlicesSupported == 0) {
|
|
|
|
hwInfoIn.gtSystemInfo.MaxSlicesSupported = sliceCount;
|
|
|
|
}
|
|
|
|
if (hwInfoIn.gtSystemInfo.MaxSubSlicesSupported == 0) {
|
|
|
|
hwInfoIn.gtSystemInfo.MaxSubSlicesSupported = hwInfoIn.gtSystemInfo.SubSliceCount;
|
|
|
|
}
|
|
|
|
if (hwInfoIn.gtSystemInfo.MaxDualSubSlicesSupported == 0) {
|
|
|
|
hwInfoIn.gtSystemInfo.MaxDualSubSlicesSupported = hwInfoIn.gtSystemInfo.SubSliceCount;
|
|
|
|
}
|
|
|
|
if (hwInfoIn.gtSystemInfo.MaxEuPerSubSlice == 0) {
|
|
|
|
hwInfoIn.gtSystemInfo.MaxEuPerSubSlice = euPerSubSliceCount;
|
|
|
|
}
|
2020-01-25 00:19:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool parseHwInfoConfigString(const std::string &hwInfoConfigStr, uint64_t &hwInfoConfig) {
|
|
|
|
hwInfoConfig = 0u;
|
|
|
|
|
|
|
|
size_t currPos = hwInfoConfigStr.find('x', 0);
|
2019-10-18 16:15:09 +08:00
|
|
|
if (currPos == std::string::npos) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-25 00:19:06 +08:00
|
|
|
uint32_t sliceCount = static_cast<uint32_t>(std::stoul(hwInfoConfigStr.substr(0, currPos)));
|
2019-11-21 19:43:58 +08:00
|
|
|
if (sliceCount > std::numeric_limits<uint16_t>::max()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-10-18 16:15:09 +08:00
|
|
|
size_t prevPos = currPos + 1;
|
|
|
|
|
2020-01-25 00:19:06 +08:00
|
|
|
currPos = hwInfoConfigStr.find('x', prevPos);
|
2019-10-18 16:15:09 +08:00
|
|
|
if (currPos == std::string::npos) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-25 00:19:06 +08:00
|
|
|
uint32_t subSlicePerSliceCount = static_cast<uint32_t>(std::stoul(hwInfoConfigStr.substr(prevPos, currPos)));
|
2019-11-21 19:43:58 +08:00
|
|
|
if (subSlicePerSliceCount > std::numeric_limits<uint16_t>::max()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
uint32_t subSliceCount = subSlicePerSliceCount * sliceCount;
|
|
|
|
if (subSliceCount > std::numeric_limits<uint16_t>::max()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-10-18 16:15:09 +08:00
|
|
|
prevPos = currPos + 1;
|
|
|
|
|
2020-01-25 00:19:06 +08:00
|
|
|
uint32_t euPerSubSliceCount = static_cast<uint32_t>(std::stoul(hwInfoConfigStr.substr(prevPos, std::string::npos)));
|
2019-11-21 19:43:58 +08:00
|
|
|
if (euPerSubSliceCount > std::numeric_limits<uint16_t>::max()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
uint32_t euCount = euPerSubSliceCount * subSliceCount;
|
|
|
|
if (euCount > std::numeric_limits<uint16_t>::max()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-10-18 16:15:09 +08:00
|
|
|
|
2020-01-25 00:19:06 +08:00
|
|
|
hwInfoConfig = static_cast<uint64_t>(sliceCount & 0xffff) << 32 | static_cast<uint64_t>(subSlicePerSliceCount & 0xffff) << 16 | static_cast<uint64_t>(euPerSubSliceCount & 0xffff);
|
2019-10-18 16:15:09 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-03-27 17:06:29 +08:00
|
|
|
aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo) {
|
2023-11-30 16:32:25 +08:00
|
|
|
return debugManager.flags.NodeOrdinal.get() == -1
|
2018-10-02 04:36:15 +08:00
|
|
|
? hwInfo.capabilityTable.defaultEngineType
|
2023-11-30 16:32:25 +08:00
|
|
|
: static_cast<aub_stream::EngineType>(debugManager.flags.NodeOrdinal.get());
|
2018-10-02 04:36:15 +08:00
|
|
|
}
|
2024-06-25 17:37:08 +08:00
|
|
|
void setupDefaultGtSysInfo(HardwareInfo *hwInfo, const ReleaseHelper *releaseHelper) {
|
|
|
|
GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo;
|
|
|
|
gtSysInfo->L3CacheSizeInKb = 1;
|
|
|
|
gtSysInfo->CCSInfo.IsValid = 1;
|
|
|
|
gtSysInfo->CCSInfo.NumberOfCCSEnabled = 1;
|
|
|
|
gtSysInfo->CCSInfo.Instances.CCSEnableMask = 0b1;
|
|
|
|
// non-zero values for unit tests
|
|
|
|
if (gtSysInfo->SliceCount == 0) {
|
|
|
|
gtSysInfo->SliceCount = 2;
|
|
|
|
gtSysInfo->SubSliceCount = 8;
|
|
|
|
gtSysInfo->DualSubSliceCount = gtSysInfo->SubSliceCount;
|
|
|
|
gtSysInfo->EUCount = 64;
|
|
|
|
|
|
|
|
gtSysInfo->MaxEuPerSubSlice = gtSysInfo->EUCount / gtSysInfo->SubSliceCount;
|
|
|
|
gtSysInfo->MaxSlicesSupported = gtSysInfo->SliceCount;
|
|
|
|
gtSysInfo->MaxSubSlicesSupported = gtSysInfo->SubSliceCount;
|
|
|
|
gtSysInfo->MaxDualSubSlicesSupported = gtSysInfo->DualSubSliceCount;
|
|
|
|
}
|
2024-06-26 23:54:09 +08:00
|
|
|
|
|
|
|
if (releaseHelper->getL3BankCount() > 0) {
|
|
|
|
gtSysInfo->L3BankCount = releaseHelper->getL3BankCount();
|
|
|
|
}
|
|
|
|
if (releaseHelper->getL3CacheBankSizeInKb() > 0) {
|
|
|
|
gtSysInfo->L3CacheSizeInKb = gtSysInfo->L3BankCount * releaseHelper->getL3CacheBankSizeInKb();
|
|
|
|
}
|
|
|
|
|
2024-06-25 17:37:08 +08:00
|
|
|
gtSysInfo->ThreadCount = gtSysInfo->EUCount * releaseHelper->getNumThreadsPerEu();
|
|
|
|
}
|
2024-06-27 17:58:09 +08:00
|
|
|
|
|
|
|
void setupDefaultFeatureTableAndWorkaroundTable(HardwareInfo *hwInfo) {
|
|
|
|
FeatureTable *featureTable = &hwInfo->featureTable;
|
|
|
|
|
|
|
|
featureTable->flags.ftrAstcHdr2D = true;
|
|
|
|
featureTable->flags.ftrAstcLdr2D = true;
|
|
|
|
featureTable->flags.ftrCCSNode = true;
|
|
|
|
featureTable->flags.ftrCCSRing = true;
|
|
|
|
featureTable->flags.ftrFbc = true;
|
|
|
|
featureTable->flags.ftrGpGpuMidBatchPreempt = true;
|
|
|
|
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = true;
|
|
|
|
featureTable->flags.ftrIA32eGfxPTEs = true;
|
|
|
|
featureTable->flags.ftrL3IACoherency = true;
|
|
|
|
featureTable->flags.ftrLinearCCS = true;
|
|
|
|
featureTable->flags.ftrPPGTT = true;
|
|
|
|
featureTable->flags.ftrSVM = true;
|
|
|
|
featureTable->flags.ftrStandardMipTailFormat = true;
|
|
|
|
featureTable->flags.ftrTileMappedResource = true;
|
|
|
|
featureTable->flags.ftrTranslationTable = true;
|
|
|
|
featureTable->flags.ftrUserModeTranslationTable = true;
|
|
|
|
|
|
|
|
WorkaroundTable *workaroundTable = &hwInfo->workaroundTable;
|
|
|
|
|
|
|
|
workaroundTable->flags.wa4kAlignUVOffsetNV12LinearSurface = true;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|