fix: Improved reporting of incorrect device

We want to report unrecognized device only after verifying
all possible variants, including deprecated ones.

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
Related-To: NEO-7903
This commit is contained in:
Daria Hinz
2023-04-21 10:58:23 +00:00
committed by Compute-Runtime-Automation
parent 1a1bd04d4a
commit a2bc1d82e4
2 changed files with 14 additions and 8 deletions

View File

@ -2469,13 +2469,8 @@ TEST(OfflineCompilerTest, GivenUnknownIsaConfigValueWhenInitHardwareInfoThenInva
auto deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
std::stringstream resString;
testing::internal::CaptureStdout();
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
auto output = testing::internal::GetCapturedStdout();
resString << "Could not determine device target: " << deviceName << ".\n";
EXPECT_STREQ(output.c_str(), resString.str().c_str());
}
TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
@ -2484,9 +2479,19 @@ TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenIn
auto deviceName = "00.01.02";
std::stringstream resString;
testing::internal::CaptureStdout();
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
}
TEST(OfflineCompilerTest, GivenUnsupportedDeviceWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
auto deviceName = "unk";
std::stringstream resString;
testing::internal::CaptureStdout();
auto retVal = mockOfflineCompiler->initHardwareInfo(deviceName);
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
auto output = testing::internal::GetCapturedStdout();
resString << "Could not determine device target: " << deviceName << ".\n";

View File

@ -473,7 +473,6 @@ int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) {
productConfig = argHelper->productConfigHelper->getProductConfigFromDeviceName(deviceName);
}
if (productConfig == AOT::UNKNOWN_ISA) {
argHelper->printf("Could not determine device target: %s.\n", deviceName.c_str());
return INVALID_DEVICE;
}
@ -499,7 +498,9 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
}
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName, std::move(compilerProductHelper));
if (retVal != SUCCESS) {
argHelper->printf("Could not determine device target: %s.\n", deviceName.c_str());
}
return retVal;
}