mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Revert "Use device ID from ProductConfigHelper"
This reverts commit 60a8bcb3d7
.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
cb3f7234f0
commit
4d2948d312
@ -19,6 +19,7 @@
|
||||
|
||||
class MockOclocArgHelper : public OclocArgHelper {
|
||||
public:
|
||||
using OclocArgHelper::deviceProductTable;
|
||||
using OclocArgHelper::hasOutput;
|
||||
using OclocArgHelper::headers;
|
||||
using OclocArgHelper::inputs;
|
||||
|
@ -103,3 +103,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());
|
||||
}
|
||||
}
|
@ -1031,14 +1031,13 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenOfflineCompilerIsCreatedThenSuccessIsR
|
||||
}
|
||||
|
||||
TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrectlySetValues) {
|
||||
auto deviceAotInfo = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
|
||||
if (deviceAotInfo.empty()) {
|
||||
auto deviceId = oclocArgHelperWithoutInput->deviceProductTable[0].deviceId;
|
||||
if (oclocArgHelperWithoutInput->deviceProductTable.size() == 1 && deviceId == 0) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
MockOfflineCompiler mockOfflineCompiler;
|
||||
std::stringstream deviceString, productString;
|
||||
auto deviceId = deviceAotInfo[0].deviceIds->front();
|
||||
deviceString << "0x" << std::hex << deviceId;
|
||||
|
||||
mockOfflineCompiler.argHelper->getPrinterRef() = MessagePrinter{true};
|
||||
@ -1047,17 +1046,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 = static_cast<AOT::PRODUCT_CONFIG>(deviceAotInfo[0].aotConfig.ProductConfig);
|
||||
auto deviceId = deviceAotInfo[0].deviceIds->front();
|
||||
|
||||
productString << oclocArgHelperWithoutInput->productConfigHelper->getAcronymForProductConfig(config);
|
||||
deviceString << "0x" << std::hex << deviceId;
|
||||
productString << oclocArgHelperWithoutInput->deviceProductTable[0].product;
|
||||
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
@ -1095,7 +1092,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);
|
||||
}
|
||||
|
||||
@ -2309,7 +2306,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());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user