mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
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:

committed by
Compute-Runtime-Automation

parent
1a1bd04d4a
commit
a2bc1d82e4
@ -2469,13 +2469,8 @@ TEST(OfflineCompilerTest, GivenUnknownIsaConfigValueWhenInitHardwareInfoThenInva
|
|||||||
auto deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
|
auto deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
|
||||||
std::stringstream resString;
|
std::stringstream resString;
|
||||||
|
|
||||||
testing::internal::CaptureStdout();
|
|
||||||
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
||||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
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) {
|
TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
|
||||||
@ -2484,9 +2479,19 @@ TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenIn
|
|||||||
auto deviceName = "00.01.02";
|
auto deviceName = "00.01.02";
|
||||||
std::stringstream resString;
|
std::stringstream resString;
|
||||||
|
|
||||||
testing::internal::CaptureStdout();
|
|
||||||
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
||||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
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();
|
auto output = testing::internal::GetCapturedStdout();
|
||||||
resString << "Could not determine device target: " << deviceName << ".\n";
|
resString << "Could not determine device target: " << deviceName << ".\n";
|
||||||
|
@ -473,7 +473,6 @@ int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) {
|
|||||||
productConfig = argHelper->productConfigHelper->getProductConfigFromDeviceName(deviceName);
|
productConfig = argHelper->productConfigHelper->getProductConfigFromDeviceName(deviceName);
|
||||||
}
|
}
|
||||||
if (productConfig == AOT::UNKNOWN_ISA) {
|
if (productConfig == AOT::UNKNOWN_ISA) {
|
||||||
argHelper->printf("Could not determine device target: %s.\n", deviceName.c_str());
|
|
||||||
return INVALID_DEVICE;
|
return INVALID_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +498,9 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName, std::move(compilerProductHelper));
|
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName, std::move(compilerProductHelper));
|
||||||
|
if (retVal != SUCCESS) {
|
||||||
|
argHelper->printf("Could not determine device target: %s.\n", deviceName.c_str());
|
||||||
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user