Support the uppercase device deprecated acronyms

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:
Daria Hinz
2022-06-27 11:24:30 +02:00
committed by Compute-Runtime-Automation
parent 0c523b412f
commit 74bca7f12e
2 changed files with 47 additions and 0 deletions

View File

@ -590,6 +590,51 @@ TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithRevisionWhenInitHwIn
} }
} }
TEST_F(MockOfflineCompilerTests, givenAcronymWithUppercaseWhenInitHwInfoThenSuccessIsReturned) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
if (!deviceMapConfig.acronyms.empty()) {
mockOfflineCompiler.deviceName = deviceMapConfig.acronyms.front().str();
break;
}
}
}
if (mockOfflineCompiler.deviceName.empty()) {
GTEST_SKIP();
}
std::transform(mockOfflineCompiler.deviceName.begin(), mockOfflineCompiler.deviceName.end(), mockOfflineCompiler.deviceName.begin(), ::toupper);
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
}
TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithUppercaseWhenInitHwInfoThenSuccessIsReturned) {
MockOfflineCompiler mockOfflineCompiler;
auto deprecatedAcronyms = mockOfflineCompiler.getDeprecatedDevicesTypes();
if (deprecatedAcronyms.empty()) {
GTEST_SKIP();
}
auto acronyms = CompilerOptions::tokenize(deprecatedAcronyms, ',');
for (const auto &deprecatedAcronym : acronyms) {
if (deprecatedAcronym.contains(" ")) {
auto name = deprecatedAcronym.str();
auto space = name.find(" ");
mockOfflineCompiler.deviceName = name.substr(++space, name.size());
} else {
mockOfflineCompiler.deviceName = deprecatedAcronym.str();
}
std::transform(mockOfflineCompiler.deviceName.begin(), mockOfflineCompiler.deviceName.end(), mockOfflineCompiler.deviceName.begin(), ::toupper);
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
}
}
HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMaxDualSubSlicesSupportedIsSet, IsAtLeastGen12lp) { HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMaxDualSubSlicesSupportedIsSet, IsAtLeastGen12lp) {
MockOfflineCompiler mockOfflineCompiler; MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs(); auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();

View File

@ -329,6 +329,8 @@ void OfflineCompiler::setFamilyType() {
int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId) { int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId) {
std::vector<PRODUCT_FAMILY> allSupportedProduct{ALL_SUPPORTED_PRODUCT_FAMILIES}; std::vector<PRODUCT_FAMILY> allSupportedProduct{ALL_SUPPORTED_PRODUCT_FAMILIES};
std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower);
for (const auto &product : allSupportedProduct) { for (const auto &product : allSupportedProduct) {
if (0 == strcmp(deviceName.c_str(), hardwarePrefix[product])) { if (0 == strcmp(deviceName.c_str(), hardwarePrefix[product])) {
hwInfo = *hardwareInfoTable[product]; hwInfo = *hardwareInfoTable[product];