2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-02-17 14:27:19 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2022-03-25 21:04:08 +00:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2021-01-13 09:30:01 +01:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2020-07-30 15:02:11 +02:00
|
|
|
|
|
|
|
#include "hw_cmds.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-07-18 11:58:30 +02:00
|
|
|
#include <algorithm>
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2019-05-08 16:00:24 +02:00
|
|
|
HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable,
|
|
|
|
const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable)
|
|
|
|
: platform(*platform), featureTable(*featureTable), workaroundTable(*workaroundTable), gtSystemInfo(*gtSystemInfo), capabilityTable(capabilityTable) {
|
2018-06-12 09:42:47 +02:00
|
|
|
}
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-08-26 15:36:24 +02:00
|
|
|
// Global table of hardware prefixes
|
|
|
|
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = {
|
|
|
|
nullptr,
|
|
|
|
};
|
2019-10-18 10:15:09 +02:00
|
|
|
|
|
|
|
// Global table of default hardware info configs
|
2020-01-24 17:19:06 +01:00
|
|
|
uint64_t defaultHardwareInfoConfigTable[IGFX_MAX_PRODUCT] = {
|
|
|
|
0x0,
|
2019-10-18 10:15:09 +02:00
|
|
|
};
|
|
|
|
|
2019-08-26 15:36:24 +02:00
|
|
|
// Global table of family names
|
|
|
|
const char *familyName[IGFX_MAX_CORE] = {
|
|
|
|
nullptr,
|
|
|
|
};
|
|
|
|
// Global table of family names
|
|
|
|
bool familyEnabled[IGFX_MAX_CORE] = {
|
|
|
|
false,
|
|
|
|
};
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {};
|
2020-01-24 17:19:06 +01:00
|
|
|
void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, uint64_t) = {
|
|
|
|
0x0,
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
|
|
|
|
2022-05-10 12:52:14 +00:00
|
|
|
void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool) = {
|
|
|
|
0x0,
|
|
|
|
};
|
|
|
|
|
2019-07-18 11:58:30 +02:00
|
|
|
bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwInfoIn) {
|
|
|
|
std::transform(platform.begin(), platform.end(), platform.begin(), ::tolower);
|
|
|
|
|
2022-02-18 10:11:36 +01:00
|
|
|
overridePlatformName(platform);
|
|
|
|
|
2018-06-07 16:18:53 +02:00
|
|
|
bool ret = false;
|
|
|
|
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
|
|
|
if (hardwarePrefix[j] == nullptr)
|
|
|
|
continue;
|
2019-07-18 11:58:30 +02:00
|
|
|
if (hardwarePrefix[j] == platform) {
|
2018-06-07 16:18:53 +02:00
|
|
|
hwInfoIn = hardwareInfoTable[j];
|
|
|
|
ret = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-01-13 09:30:01 +01:00
|
|
|
|
2018-06-07 16:18:53 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2018-10-01 13:36:15 -07:00
|
|
|
|
2020-01-24 17:19:06 +01: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 13:07:41 +00:00
|
|
|
hwInfoIn.gtSystemInfo.DualSubSliceCount = subSlicePerSliceCount * sliceCount;
|
2020-01-24 17:19:06 +01:00
|
|
|
hwInfoIn.gtSystemInfo.EUCount = euPerSubSliceCount * subSlicePerSliceCount * sliceCount;
|
2021-12-06 19:25:14 +00:00
|
|
|
for (uint32_t slice = 0; slice < hwInfoIn.gtSystemInfo.SliceCount; slice++) {
|
|
|
|
hwInfoIn.gtSystemInfo.SliceInfo[slice].Enabled = true;
|
|
|
|
}
|
2020-01-24 17:19:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool parseHwInfoConfigString(const std::string &hwInfoConfigStr, uint64_t &hwInfoConfig) {
|
|
|
|
hwInfoConfig = 0u;
|
|
|
|
|
|
|
|
size_t currPos = hwInfoConfigStr.find('x', 0);
|
2019-10-18 10:15:09 +02:00
|
|
|
if (currPos == std::string::npos) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-24 17:19:06 +01:00
|
|
|
uint32_t sliceCount = static_cast<uint32_t>(std::stoul(hwInfoConfigStr.substr(0, currPos)));
|
2019-11-21 12:43:58 +01:00
|
|
|
if (sliceCount > std::numeric_limits<uint16_t>::max()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-10-18 10:15:09 +02:00
|
|
|
size_t prevPos = currPos + 1;
|
|
|
|
|
2020-01-24 17:19:06 +01:00
|
|
|
currPos = hwInfoConfigStr.find('x', prevPos);
|
2019-10-18 10:15:09 +02:00
|
|
|
if (currPos == std::string::npos) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-24 17:19:06 +01:00
|
|
|
uint32_t subSlicePerSliceCount = static_cast<uint32_t>(std::stoul(hwInfoConfigStr.substr(prevPos, currPos)));
|
2019-11-21 12:43:58 +01: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 10:15:09 +02:00
|
|
|
prevPos = currPos + 1;
|
|
|
|
|
2020-01-24 17:19:06 +01:00
|
|
|
uint32_t euPerSubSliceCount = static_cast<uint32_t>(std::stoul(hwInfoConfigStr.substr(prevPos, std::string::npos)));
|
2019-11-21 12:43:58 +01: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 10:15:09 +02:00
|
|
|
|
2020-01-24 17:19:06 +01: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 10:15:09 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-03-27 10:06:29 +01:00
|
|
|
aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo) {
|
2018-10-01 13:36:15 -07:00
|
|
|
return DebugManager.flags.NodeOrdinal.get() == -1
|
|
|
|
? hwInfo.capabilityTable.defaultEngineType
|
2019-03-27 10:06:29 +01:00
|
|
|
: static_cast<aub_stream::EngineType>(DebugManager.flags.NodeOrdinal.get());
|
2018-10-01 13:36:15 -07:00
|
|
|
}
|
2019-08-26 15:36:24 +02:00
|
|
|
|
|
|
|
const std::string getFamilyNameWithType(const HardwareInfo &hwInfo) {
|
|
|
|
std::string platformName = familyName[hwInfo.platform.eRenderCoreFamily];
|
|
|
|
platformName.append(hwInfo.capabilityTable.platformType);
|
|
|
|
return platformName;
|
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|