Reset GT_SYSTEM_INFO values in ocloc

For AOT compilation, we don't want to set random/default values.
The uploaded structure to IGC will be reset.

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:
Daria Hinz 2022-03-23 15:37:39 +00:00 committed by Compute-Runtime-Automation
parent a230f267e1
commit efa57f734b
5 changed files with 51 additions and 25 deletions

View File

@ -314,6 +314,31 @@ TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuc
delete pMultiCommand;
}
TEST(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenResetGtSystemInfo) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
auto expectedRevId = 0u;
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
mockOfflineCompiler.deviceName = mockOfflineCompiler.argHelper->parseProductConfigFromValue(deviceMapConfig.config);
expectedRevId = deviceMapConfig.revId;
}
}
EXPECT_FALSE(mockOfflineCompiler.deviceName.empty());
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
GT_SYSTEM_INFO expectedGtSystemInfo = {0};
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usRevId, expectedRevId);
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.eProductFamily, productFamily);
EXPECT_EQ(memcmp(&mockOfflineCompiler.hwInfo.gtSystemInfo, &expectedGtSystemInfo, sizeof(GT_SYSTEM_INFO)), 0);
}
TEST_F(OfflineCompilerTests, GivenHelpOptionOnQueryThenSuccessIsReturned) {
std::vector<std::string> argv = {
"ocloc",

View File

@ -57,9 +57,9 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
#undef NAMEDDEVICE
{0u, std::string("")}}),
deviceMap({
#define DEVICE_CONFIG_IDS_AND_REVISION(product, productConfig, deviceIds, revision_id) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, NEO::productConfig::setupHardwareInfo, revision_id},
#define DEVICE_CONFIG_IDS(product, productConfig, deviceIds) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, NEO::productConfig::setupHardwareInfo, NEO::productConfig::hwInfo.platform.usRevId},
#define DEVICE_CONFIG(product, productConfig) {product, &NEO::productConfig::hwInfo, nullptr, NEO::productConfig::setupHardwareInfo, NEO::productConfig::hwInfo.platform.usRevId},
#define DEVICE_CONFIG_IDS_AND_REVISION(product, productConfig, deviceIds, revision_id) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, NEO::productConfig::setupFeatureAndWorkaroundTable, revision_id},
#define DEVICE_CONFIG_IDS(product, productConfig, deviceIds) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, NEO::productConfig::setupFeatureAndWorkaroundTable, NEO::productConfig::hwInfo.platform.usRevId},
#define DEVICE_CONFIG(product, productConfig) {product, &NEO::productConfig::hwInfo, nullptr, NEO::productConfig::setupFeatureAndWorkaroundTable, NEO::productConfig::hwInfo.platform.usRevId},
#include "product_config.inl"
#undef DEVICE_CONFIG
#undef DEVICE_CONFIG_IDS
@ -165,14 +165,14 @@ std::unique_ptr<char[]> OclocArgHelper::loadDataFromFile(const std::string &file
void OclocArgHelper::setDeviceInfoForFatbinaryTarget(const DeviceMapping &device) {
deviceForFatbinary.hwInfo = device.hwInfo;
deviceForFatbinary.setupHardwareInfo = device.setupHardwareInfo;
deviceForFatbinary.setupFeatureAndWorkaroundTable = device.setupFeatureAndWorkaroundTable;
deviceForFatbinary.revId = device.revId;
deviceForFatbinary.deviceIds = device.deviceIds;
}
void OclocArgHelper::setHwInfoForFatbinaryTarget(NEO::HardwareInfo &hwInfo) {
hwInfo = *deviceForFatbinary.hwInfo;
deviceForFatbinary.setupHardwareInfo(&hwInfo, true);
deviceForFatbinary.setupFeatureAndWorkaroundTable(&hwInfo);
hwInfo.platform.usRevId = deviceForFatbinary.revId;
if (deviceForFatbinary.deviceIds) {
hwInfo.platform.usDeviceID = deviceForFatbinary.deviceIds->front();
@ -187,7 +187,7 @@ bool OclocArgHelper::getHwInfoForProductConfig(uint32_t config, NEO::HardwareInf
for (auto &deviceConfig : deviceMap) {
if (deviceConfig.config == config) {
hwInfo = *deviceConfig.hwInfo;
deviceConfig.setupHardwareInfo(&hwInfo, true);
deviceConfig.setupFeatureAndWorkaroundTable(&hwInfo);
hwInfo.platform.usRevId = deviceConfig.revId;
if (deviceConfig.deviceIds) {
hwInfo.platform.usDeviceID = deviceConfig.deviceIds->front();

View File

@ -51,11 +51,11 @@ struct DeviceMapping {
PRODUCT_CONFIG config;
const NEO::HardwareInfo *hwInfo;
const std::vector<unsigned short> *deviceIds;
void (*setupHardwareInfo)(NEO::HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable);
void (*setupFeatureAndWorkaroundTable)(NEO::HardwareInfo *hwInfo);
unsigned int revId;
bool operator==(const DeviceMapping &rhs) {
return config == rhs.config && hwInfo == rhs.hwInfo && setupHardwareInfo == rhs.setupHardwareInfo && revId == rhs.revId;
return config == rhs.config && hwInfo == rhs.hwInfo && setupFeatureAndWorkaroundTable == rhs.setupFeatureAndWorkaroundTable && revId == rhs.revId;
}
};

View File

@ -6,19 +6,3 @@
*/
#include "shared/source/dll/devices/product_config_base.inl"
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
DEVICE_CONFIG_IDS_AND_REVISION(DG2_G10_A0, DG2_CONFIG, DG2_G10_IDS, 0x00)
DEVICE_CONFIG_IDS_AND_REVISION(DG2_G10_B0, DG2_CONFIG, DG2_G10_IDS, 0x04)
#endif
#endif
#if SUPPORT_XE_HPC_CORE
#ifdef SUPPORT_PVC
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_A0, PVC_CONFIG, PVC_XT_IDS, 0x03)
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_B0, PVC_CONFIG, PVC_XT_IDS, 0x1E)
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XL_A0, PVC_CONFIG, PVC_XL_IDS, 0x00)
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XL_B0, PVC_CONFIG, PVC_XL_IDS, 0x01)
#endif
#endif

View File

@ -1,10 +1,27 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#if SUPPORT_XE_HPC_CORE
#ifdef SUPPORT_PVC
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_A0, PVC_CONFIG, PVC_XT_IDS, 0x03)
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_B0, PVC_CONFIG, PVC_XT_IDS, 0x1E)
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XL_A0, PVC_CONFIG, PVC_XL_IDS, 0x00)
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XL_B0, PVC_CONFIG, PVC_XL_IDS, 0x01)
#endif
#endif
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
DEVICE_CONFIG_IDS_AND_REVISION(DG2_G10_A0, DG2_CONFIG, DG2_G10_IDS, 0x00)
DEVICE_CONFIG_IDS_AND_REVISION(DG2_G10_B0, DG2_CONFIG, DG2_G10_IDS, 0x04)
DEVICE_CONFIG_IDS(DG2_G11, DG2_CONFIG, DG2_G11_IDS)
#endif
#endif
#ifdef SUPPORT_XE_HP_CORE
#ifdef SUPPORT_XE_HP_SDV
DEVICE_CONFIG(XEHP_SDV, XE_HP_SDV_CONFIG)