Files
compute-runtime/shared/source/helpers/product_config_helper.cpp
Daria Hinz a44f1b43aa Ocloc: New AOT approach implementation
Ocloc will handle any new values that may be
passed to the -device argument.

Supported acronyms are available under cmd:
ocloc compile --help

Supported patterns:
- device acronym
- release acronym
- family acronym
- version (major.minor.revision)

Fatbinary will no longer handle major.minor.revision variances,
only acronyms allowed.

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
2022-06-10 09:24:13 +02:00

51 lines
1.6 KiB
C++

/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/product_config_helper.h"
AOT::RELEASE ProductConfigHelper::returnReleaseForAcronym(const std::string &device) {
auto it = AOT::releaseAcronyms.find(device);
if (it == AOT::releaseAcronyms.end())
return AOT::UNKNOWN_RELEASE;
return it->second;
}
AOT::FAMILY ProductConfigHelper::returnFamilyForAcronym(const std::string &device) {
auto it = AOT::familyAcronyms.find(device);
if (it == AOT::familyAcronyms.end())
return AOT::UNKNOWN_FAMILY;
return it->second;
}
AOT::PRODUCT_CONFIG ProductConfigHelper::returnProductConfigForAcronym(const std::string &device) {
auto it = AOT::productConfigAcronyms.find(device);
if (it == AOT::productConfigAcronyms.end())
return AOT::UNKNOWN_ISA;
return it->second;
}
NEO::ConstStringRef ProductConfigHelper::getAcronymForAFamily(AOT::FAMILY family) {
for (const auto &[acronym, value] : AOT::familyAcronyms) {
if (value == family) {
return NEO::ConstStringRef(acronym);
}
}
return {};
}
std::string ProductConfigHelper::parseMajorMinorRevisionValue(AheadOfTimeConfig config) {
std::stringstream stringConfig;
stringConfig << config.ProductConfigID.Major << "." << config.ProductConfigID.Minor << "." << config.ProductConfigID.Revision;
return stringConfig.str();
}
std::string ProductConfigHelper::parseMajorMinorValue(AheadOfTimeConfig config) {
std::stringstream stringConfig;
stringConfig << config.ProductConfigID.Major << "." << config.ProductConfigID.Minor;
return stringConfig.str();
}