Restore old device id design in ocloc

This change removes some of the logic related to
passing device id as an argument in ocloc introduced in
"Setting default device id for acronym".

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:
Daria Hinz
2022-07-19 10:28:41 +02:00
committed by Compute-Runtime-Automation
parent fd9a63f49f
commit 91a97dfaea
10 changed files with 96 additions and 98 deletions

View File

@ -19,6 +19,7 @@
class MockOclocArgHelper : public OclocArgHelper {
public:
using OclocArgHelper::deviceProductTable;
using OclocArgHelper::hasOutput;
using OclocArgHelper::headers;
using OclocArgHelper::inputs;

View File

@ -91,3 +91,26 @@ TEST(OclocValidate, WhenErrorsEmitedThenRedirectsThemToStdout) {
EXPECT_EQ(static_cast<int>(NEO::DecodeError::InvalidBinary), res) << oclocStdout;
EXPECT_NE(nullptr, strstr(oclocStdout.c_str(), "Validator detected errors :\nNEO::Yaml : Could not parse line : [1] : [kernels ] <-- parser position on error. Reason : Vector data type expects to have at least one value starting with -")) << oclocStdout;
}
TEST(OclocValidate, givenDeviceProductTableEveryProductMatchesProperPattern) {
MockOclocArgHelper::FilesMap files{{"src.gen", "01234567"}};
MockOclocArgHelper argHelper{files};
ASSERT_GE(argHelper.deviceProductTable.size(), 1u);
std::vector<std::string> genPatterns;
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
if (NEO::hardwarePrefix[j] == nullptr)
continue;
genPatterns.push_back(NEO::hardwarePrefix[j]);
}
ASSERT_GE(genPatterns.size(), 1u);
if (argHelper.deviceProductTable.size() == 1 && argHelper.deviceProductTable[0].deviceId == 0) {
auto &deviceProductTable = const_cast<std::vector<DeviceProduct> &>(argHelper.deviceProductTable);
deviceProductTable[0].product = genPatterns[0];
deviceProductTable[0].deviceId = 0x123;
deviceProductTable.push_back(DeviceProduct{0, ""});
}
for (int i = 0; argHelper.deviceProductTable[i].deviceId != 0; i++) {
auto res = std::find(genPatterns.begin(), genPatterns.end(), argHelper.returnProductNameForDevice(argHelper.deviceProductTable[i].deviceId));
EXPECT_NE(res, genPatterns.end());
}
}

View File

@ -1028,11 +1028,10 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenOfflineCompilerIsCreatedThenSuccessIsR
}
TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrectlySetValues) {
auto deviceAot = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
if (deviceAot.empty()) {
auto deviceId = oclocArgHelperWithoutInput->deviceProductTable[0].deviceId;
if (oclocArgHelperWithoutInput->deviceProductTable.size() == 1 && deviceId == 0) {
GTEST_SKIP();
}
auto deviceId = deviceAot[0].deviceIds->front();
MockOfflineCompiler mockOfflineCompiler;
std::stringstream deviceString, productString;
@ -1044,17 +1043,15 @@ TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrect
}
TEST_F(OfflineCompilerTests, givenProperDeviceIdHexAsDeviceArgumentThenSuccessIsReturned) {
auto deviceAotInfo = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
if (deviceAotInfo.empty()) {
auto deviceId = oclocArgHelperWithoutInput->deviceProductTable[0].deviceId;
if (oclocArgHelperWithoutInput->deviceProductTable.size() == 1 && deviceId == 0) {
GTEST_SKIP();
}
std::stringstream deviceString, productString;
AOT::PRODUCT_CONFIG config;
auto deviceId = deviceAotInfo[0].deviceIds->front();
deviceString << "0x" << std::hex << deviceId;
config = static_cast<AOT::PRODUCT_CONFIG>(deviceAotInfo[0].aotConfig.ProductConfig);
productString << oclocArgHelperWithoutInput->productConfigHelper->getAcronymForProductConfig(config);
productString << oclocArgHelperWithoutInput->deviceProductTable[0].product;
std::vector<std::string> argv = {
"ocloc",
@ -1092,7 +1089,7 @@ TEST_F(OfflineCompilerTests, givenIncorrectDeviceIdHexThenInvalidDeviceIsReturne
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: 0x0\nError: Cannot get HW Info for device 0x0.\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on device id: 0x0\nError: Cannot get HW Info for device 0x0.\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@ -1967,7 +1964,7 @@ TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenIn
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
auto output = testing::internal::GetCapturedStdout();
resString << "Could not determine device target: " << deviceName << "\n";
resString << "Could not determine target based on product config: " << deviceName << "\n";
EXPECT_STREQ(output.c_str(), resString.str().c_str());
}