Base hwInfo values setup for AOT

In most cases, there was code redundancy, which was minimized in this change.
The setupHardwareInfoBase extraction will also be used for ocloc.

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
Related-To: NEO-6910
This commit is contained in:
Daria Hinz
2022-05-10 12:52:14 +00:00
committed by Compute-Runtime-Automation
parent ee4a177296
commit de74becdb8
46 changed files with 527 additions and 525 deletions

View File

@@ -63,9 +63,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::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},
#define DEVICE_CONFIG_IDS_AND_REVISION(product, productConfig, deviceIds, revision_id) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, revision_id},
#define DEVICE_CONFIG_IDS(product, productConfig, deviceIds) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, NEO::productConfig::hwInfo.platform.usRevId},
#define DEVICE_CONFIG(product, productConfig) {product, &NEO::productConfig::hwInfo, nullptr, NEO::productConfig::hwInfo.platform.usRevId},
#include "product_config.inl"
#undef DEVICE_CONFIG
#undef DEVICE_CONFIG_IDS
@@ -171,14 +171,13 @@ std::unique_ptr<char[]> OclocArgHelper::loadDataFromFile(const std::string &file
void OclocArgHelper::setDeviceInfoForFatbinaryTarget(const DeviceMapping &device) {
deviceForFatbinary.hwInfo = device.hwInfo;
deviceForFatbinary.setupFeatureAndWorkaroundTable = device.setupFeatureAndWorkaroundTable;
deviceForFatbinary.revId = device.revId;
deviceForFatbinary.deviceIds = device.deviceIds;
}
void OclocArgHelper::setHwInfoForFatbinaryTarget(NEO::HardwareInfo &hwInfo) {
hwInfo = *deviceForFatbinary.hwInfo;
deviceForFatbinary.setupFeatureAndWorkaroundTable(&hwInfo);
NEO::hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
hwInfo.platform.usRevId = deviceForFatbinary.revId;
if (deviceForFatbinary.deviceIds) {
hwInfo.platform.usDeviceID = deviceForFatbinary.deviceIds->front();
@@ -193,7 +192,7 @@ bool OclocArgHelper::getHwInfoForProductConfig(uint32_t config, NEO::HardwareInf
for (auto &deviceConfig : deviceMap) {
if (deviceConfig.config == config) {
hwInfo = *deviceConfig.hwInfo;
deviceConfig.setupFeatureAndWorkaroundTable(&hwInfo);
NEO::hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
hwInfo.platform.usRevId = deviceConfig.revId;
if (deviceConfig.deviceIds) {
hwInfo.platform.usDeviceID = deviceConfig.deviceIds->front();

View File

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

View File

@@ -389,7 +389,7 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
auto hwInfoConfig = defaultHardwareInfoConfigTable[hwInfo.platform.eProductFamily];
setHwInfoValuesFromConfig(hwInfoConfig, hwInfo);
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, hwInfoConfig);
hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
setFamilyType();
retVal = SUCCESS;
break;