Encode PRODUCT_CONFIG value into fatbinary

Change modifies the encoding entry in fatbinary for platforms.
If numbering in -device is used, the value PRODUCT_CONFIG will be encoded.
The functionality that returns the correct product config values has
also been added.

Related-To: NEO-6744
Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:
Daria Hinz
2022-03-10 17:27:38 +00:00
committed by Compute-Runtime-Automation
parent fbb5137f3e
commit ce645f13b7
87 changed files with 980 additions and 180 deletions

View File

@ -246,16 +246,6 @@ std::vector<DeviceMapping> &OclocArgHelper::getAllSupportedDeviceConfigs() {
return deviceMap;
}
const std::string OclocArgHelper::parseProductConfigFromValue(PRODUCT_CONFIG config) {
auto configValue = static_cast<uint32_t>(config);
std::stringstream stringConfig;
uint32_t major = (configValue & 0xff0000) >> 16;
uint32_t minor = (configValue & 0x00ff00) >> 8;
uint32_t revision = configValue & 0x0000ff;
stringConfig << major << "." << minor << "." << revision;
return stringConfig.str();
}
std::vector<PRODUCT_CONFIG> OclocArgHelper::getAllSupportedProductConfigs() {
std::vector<PRODUCT_CONFIG> allConfigs;
for (auto &deviceConfig : deviceMap) {

View File

@ -105,7 +105,6 @@ class OclocArgHelper {
};
MOCKABLE_VIRTUAL bool fileExists(const std::string &filename) const;
int parseProductConfigFromString(const std::string &device, size_t begin, size_t end);
const std::string parseProductConfigFromValue(PRODUCT_CONFIG config);
bool getHwInfoForProductConfig(uint32_t config, NEO::HardwareInfo &hwInfo);
void getProductConfigsForGfxCoreFamily(GFXCORE_FAMILY core, std::vector<DeviceMapping> &out);
void setDeviceInfoForFatbinaryTarget(const DeviceMapping &device);

View File

@ -14,6 +14,7 @@
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "igfxfmid.h"
@ -311,8 +312,6 @@ std::vector<DeviceMapping> getTargetConfigsForFatbinary(ConstStringRef deviceArg
int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy, std::string pointerSize, Ar::ArEncoder &fatbinary,
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &deviceConfig) {
std::string product = hardwarePrefix[pCompiler->getHardwareInfo().platform.eProductFamily];
auto stepping = pCompiler->getHardwareInfo().platform.usRevId;
if (retVal == 0) {
retVal = buildWithSafetyGuard(pCompiler);
@ -334,7 +333,7 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
if (retVal) {
return retVal;
}
fatbinary.appendFileEntry(pointerSize + "." + product + "." + std::to_string(stepping), pCompiler->getPackedDeviceBinaryOutput());
fatbinary.appendFileEntry(pointerSize + "." + deviceConfig, pCompiler->getPackedDeviceBinaryOutput());
return retVal;
}
@ -426,7 +425,7 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
return retVal;
}
auto targetConfigStr = argHelper->parseProductConfigFromValue(targetConfig.config);
auto targetConfigStr = ProductConfigHelper::parseMajorMinorRevisionValue(targetConfig.config);
retVal = buildFatBinaryForTarget(retVal, argsCopy, pointerSizeInBits, fatbinary, pCompiler.get(), argHelper, targetConfigStr);
if (retVal) {
return retVal;

View File

@ -21,6 +21,7 @@
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/helpers/string.h"
#include "shared/source/helpers/validators.h"
#include "shared/source/os_interface/os_inc_base.h"
@ -881,16 +882,11 @@ std::string OfflineCompiler::getDevicesConfigs() {
std::list<std::string> configNum;
auto allSupportedConfigs = argHelper->getAllSupportedProductConfigs();
for (auto &config : allSupportedConfigs) {
auto numeration = argHelper->parseProductConfigFromValue(config);
configNum.push_back(numeration);
}
std::ostringstream os;
for (auto it = configNum.begin(); it != configNum.end(); it++) {
if (it != configNum.begin())
for (auto it = allSupportedConfigs.begin(); it != allSupportedConfigs.end(); it++) {
if (it != allSupportedConfigs.begin())
os << ", ";
os << *it;
os << ProductConfigHelper::parseMajorMinorRevisionValue(*it);
}
return os.str();