Revert "Ocloc: New AOT approach implementation"

This reverts commit a44f1b43aa.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-06-12 20:46:42 +02:00
committed by Compute-Runtime-Automation
parent 51726dc32c
commit cca1dbecbc
76 changed files with 1850 additions and 1950 deletions

View File

@@ -61,7 +61,6 @@ set(IGDRCL_SRCS_offline_compiler_tests
${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_iga_dll.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_iga_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_api_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_arg_helper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fatbinary_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fatbinary_tests.h
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fcl_facade_tests.cpp

View File

@@ -23,7 +23,6 @@ class MockOfflineCompiler : public OfflineCompiler {
using OfflineCompiler::appendExtraInternalOptions;
using OfflineCompiler::argHelper;
using OfflineCompiler::buildIrBinary;
using OfflineCompiler::deviceConfig;
using OfflineCompiler::deviceName;
using OfflineCompiler::elfBinary;
using OfflineCompiler::excludeIr;
@@ -37,7 +36,6 @@ class MockOfflineCompiler : public OfflineCompiler {
using OfflineCompiler::hwInfo;
using OfflineCompiler::igcFacade;
using OfflineCompiler::initHardwareInfo;
using OfflineCompiler::initHardwareInfoForProductConfig;
using OfflineCompiler::inputFile;
using OfflineCompiler::inputFileLlvm;
using OfflineCompiler::inputFileSpirV;
@@ -51,7 +49,6 @@ class MockOfflineCompiler : public OfflineCompiler {
using OfflineCompiler::outputNoSuffix;
using OfflineCompiler::parseCommandLine;
using OfflineCompiler::parseDebugSettings;
using OfflineCompiler::revisionId;
using OfflineCompiler::setStatelessToStatefullBufferOffsetFlag;
using OfflineCompiler::sourceCode;
using OfflineCompiler::storeBinary;

View File

@@ -178,29 +178,12 @@ TEST(OclocApiTests, GivenInvalidQueryWhenQueryingThenErrorIsReturned) {
TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
std::string clFileName(clFiles + "copybuffer.cl");
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
auto allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
if (allSupportedDeviceConfigs.empty()) {
GTEST_SKIP();
}
std::string family("");
for (const auto &config : allSupportedDeviceConfigs) {
if (config.hwInfo->platform.eProductFamily == NEO::DEFAULT_PLATFORM::hwInfo.platform.eProductFamily) {
family = ProductConfigHelper::getAcronymForAFamily(config.family).str();
break;
}
}
if (family.empty()) {
GTEST_SKIP();
}
const char *argv[] = {
"ocloc",
"-file",
clFileName.c_str(),
"-device",
family.c_str()};
NEO::familyName[NEO::DEFAULT_PLATFORM::hwInfo.platform.eRenderCoreFamily]};
unsigned int argc = sizeof(argv) / sizeof(const char *);
testing::internal::CaptureStdout();
@@ -211,7 +194,7 @@ TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
std::string output = testing::internal::GetCapturedStdout();
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file " + clFileName + " -device " + family));
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file test_files/copybuffer.cl -device "s + argv[4]));
}
TEST(OclocApiTests, WhenArgsWithMissingFileAreGivenThenErrorMessageIsProduced) {

View File

@@ -1,137 +0,0 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
#include "shared/test/common/test_macros/test.h"
struct OclocArgHelperTests : public ::testing::Test {
OclocArgHelperTests() {
argHelper = std::make_unique<OclocArgHelper>();
}
std::unique_ptr<OclocArgHelper> argHelper;
};
template <typename EqComparableT>
auto findAcronym(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs; };
}
TEST_F(OclocArgHelperTests, givenProductOrAotConfigWhenParseMajorMinorRevisionValueThenCorrectStringIsReturned) {
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
if (enabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
for (const auto &device : enabledDeviceConfigs) {
auto productConfig = static_cast<AOT::PRODUCT_CONFIG>(device.aotConfig.ProductConfig);
auto configStr0 = ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
auto configStr1 = ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig);
EXPECT_STREQ(configStr0.c_str(), configStr1.c_str());
auto gotCofig = argHelper->getMajorMinorRevision(configStr0);
EXPECT_EQ(gotCofig.ProductConfig, productConfig);
}
}
TEST_F(OclocArgHelperTests, givenProductConfigAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
if (enabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
std::string acronym("");
for (auto &device : enabledDeviceConfigs) {
if (!device.acronyms.empty()) {
acronym = device.acronyms.front().str();
auto enabledAcronyms = argHelper->getEnabledProductAcronyms();
auto acronymFound = std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findAcronym(acronym));
EXPECT_TRUE(acronymFound);
device.acronyms.clear();
device.aotConfig.ProductConfig = AOT::UNKNOWN_ISA;
enabledAcronyms = argHelper->getEnabledProductAcronyms();
acronymFound = std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findAcronym(acronym));
EXPECT_FALSE(acronymFound);
EXPECT_FALSE(argHelper->isProductConfig(acronym));
}
}
}
TEST_F(OclocArgHelperTests, givenReleaseAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
if (enabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
std::string acronym("");
auto enabledRelease = enabledDeviceConfigs[0].release;
for (const auto &[name, value] : AOT::releaseAcronyms) {
if (value == enabledRelease) {
acronym = name;
}
}
auto enabledReleases = argHelper->getEnabledReleasesAcronyms();
auto releaseFound = std::any_of(enabledReleases.begin(), enabledReleases.end(), findAcronym(acronym));
EXPECT_TRUE(releaseFound);
for (auto &device : enabledDeviceConfigs) {
if (enabledRelease == device.release) {
device.release = AOT::UNKNOWN_RELEASE;
}
}
enabledReleases = argHelper->getEnabledReleasesAcronyms();
releaseFound = std::any_of(enabledReleases.begin(), enabledReleases.end(), findAcronym(acronym));
EXPECT_FALSE(releaseFound);
EXPECT_FALSE(argHelper->isRelease(acronym));
}
TEST_F(OclocArgHelperTests, givenFamilyAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
if (enabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
std::string acronym("");
auto enabledFamily = enabledDeviceConfigs[0].family;
for (const auto &[name, value] : AOT::familyAcronyms) {
if (value == enabledFamily) {
acronym = name;
}
}
auto enabledFamilies = argHelper->getEnabledFamiliesAcronyms();
auto familyFound = std::any_of(enabledFamilies.begin(), enabledFamilies.end(), findAcronym(acronym));
EXPECT_TRUE(familyFound);
for (auto &device : enabledDeviceConfigs) {
if (enabledFamily == device.family) {
device.family = AOT::UNKNOWN_FAMILY;
}
}
enabledFamilies = argHelper->getEnabledFamiliesAcronyms();
familyFound = std::any_of(enabledFamilies.begin(), enabledFamilies.end(), findAcronym(acronym));
EXPECT_FALSE(familyFound);
EXPECT_FALSE(argHelper->isFamily(acronym));
}
TEST_F(OclocArgHelperTests, givenHwInfoForProductConfigWhenUnknownIsaIsPassedThenFalseIsReturned) {
NEO::HardwareInfo hwInfo;
EXPECT_FALSE(argHelper->getHwInfoForProductConfig(AOT::UNKNOWN_ISA, hwInfo));
}

View File

@@ -16,39 +16,21 @@
#include <memory>
namespace NEO {
class OclocEnabledAcronyms : public ::testing::Test {
public:
std::vector<DeviceMapping> enabledProducts{};
std::vector<ConstStringRef> enabledProductsAcronyms{};
std::vector<ConstStringRef> enabledFamiliesAcronyms{};
std::vector<ConstStringRef> enabledReleasesAcronyms{};
};
class OclocFatBinaryProductAcronymsTests : public OclocEnabledAcronyms {
class OclocFatBinaryGetTargetConfigsForFatbinary : public ::testing::Test {
public:
OclocFatBinaryProductAcronymsTests() {
OclocFatBinaryGetTargetConfigsForFatbinary() {
oclocArgHelperWithoutInput = std::make_unique<OclocArgHelper>();
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{true};
enabledProducts = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
enabledProductsAcronyms = oclocArgHelperWithoutInput->getEnabledProductAcronyms();
enabledFamiliesAcronyms = oclocArgHelperWithoutInput->getEnabledFamiliesAcronyms();
enabledReleasesAcronyms = oclocArgHelperWithoutInput->getEnabledReleasesAcronyms();
}
std::unique_ptr<OclocArgHelper> oclocArgHelperWithoutInput;
};
class OclocFatBinaryTest : public OclocEnabledAcronyms {
class OclocFatBinaryTest : public ::testing::Test {
public:
OclocFatBinaryTest() {
mockArgHelperFilesMap[spirvFilename] = spirvFileContent;
mockArgHelper.interceptOutput = true;
enabledProducts = mockArgHelper.getAllSupportedDeviceConfigs();
enabledProductsAcronyms = mockArgHelper.getEnabledProductAcronyms();
enabledFamiliesAcronyms = mockArgHelper.getEnabledFamiliesAcronyms();
enabledReleasesAcronyms = mockArgHelper.getEnabledReleasesAcronyms();
}
protected:

View File

@@ -16,16 +16,16 @@ TEST_P(OclocProductConfigTests, GivenProductConfigValuesWhenInitHardwareInfoThen
auto allSupportedDeviceConfigs = mockOfflineCompiler->argHelper->getAllSupportedDeviceConfigs();
for (const auto &deviceConfig : allSupportedDeviceConfigs) {
if (aotConfig.ProductConfig == deviceConfig.aotConfig.ProductConfig) {
if (productConfig == deviceConfig.config) {
if (deviceConfig.deviceIds) {
deviceId = deviceConfig.deviceIds->front();
}
revId = deviceConfig.aotConfig.ProductConfigID.Revision;
revId = deviceConfig.revId;
break;
}
}
mockOfflineCompiler->deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
mockOfflineCompiler->deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
mockOfflineCompiler->initHardwareInfo(mockOfflineCompiler->deviceName);
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.eProductFamily, productFamily);

View File

@@ -12,13 +12,13 @@
#include "opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h"
namespace NEO {
struct OclocProductConfigTests : public ::testing::TestWithParam<std::tuple<AOT::PRODUCT_CONFIG, PRODUCT_FAMILY>> {
struct OclocProductConfigTests : public ::testing::TestWithParam<std::tuple<PRODUCT_CONFIG, PRODUCT_FAMILY>> {
void SetUp() override {
std::tie(aotConfig.ProductConfig, productFamily) = GetParam();
std::tie(productConfig, productFamily) = GetParam();
mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
}
AheadOfTimeConfig aotConfig;
PRODUCT_CONFIG productConfig;
PRODUCT_FAMILY productFamily;
std::unique_ptr<MockOfflineCompiler> mockOfflineCompiler;
};

View File

@@ -194,7 +194,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
std::string configStr;
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
break;
}
}
@@ -521,30 +521,6 @@ TEST(MultiCommandWhiteboxTest, GivenInvalidArgsWhenInitializingThenErrorIsReturn
}
using MockOfflineCompilerTests = ::testing::Test;
TEST_F(MockOfflineCompilerTests, givenProductConfigValueAndRevisionIdWhenInitHwInfoThenTheseValuesAreSet) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
auto config = AOT::UNKNOWN_ISA;
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
config = static_cast<AOT::PRODUCT_CONFIG>(deviceMapConfig.aotConfig.ProductConfig);
break;
}
}
mockOfflineCompiler.revisionId = 0x3;
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(config);
EXPECT_FALSE(mockOfflineCompiler.deviceName.empty());
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usRevId, mockOfflineCompiler.revisionId);
EXPECT_EQ(mockOfflineCompiler.deviceConfig, config);
}
TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHardwareInfoValuesAreSet) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
@@ -553,10 +529,10 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHa
}
auto expectedRevId = 0u;
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
expectedRevId = deviceMapConfig.aotConfig.ProductConfigID.Revision;
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
expectedRevId = deviceMapConfig.revId;
break;
}
}
@@ -564,6 +540,7 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHa
EXPECT_FALSE(mockOfflineCompiler.deviceName.empty());
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usRevId, expectedRevId);
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.eProductFamily, productFamily);
EXPECT_NE(mockOfflineCompiler.hwInfo.gtSystemInfo.MaxEuPerSubSlice, 0u);
@@ -578,9 +555,9 @@ HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMax
GTEST_SKIP();
}
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
break;
}
}
@@ -764,7 +741,6 @@ TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrect
std::stringstream deviceString, productString;
deviceString << "0x" << std::hex << deviceId;
mockOfflineCompiler.argHelper->getPrinterRef() = MessagePrinter{true};
mockOfflineCompiler.initHardwareInfo(deviceString.str());
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usDeviceID, deviceId);
}
@@ -785,7 +761,6 @@ TEST_F(OfflineCompilerTests, givenProperDeviceIdHexAsDeviceArgumentThenSuccessIs
"-device",
deviceString.str()};
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
EXPECT_EQ(pOfflineCompiler->getHardwareInfo().platform.usDeviceID, deviceId);
@@ -829,7 +804,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithMissingRevisionValueWhenIn
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.1.\nError: Cannot get HW Info for device 9.1..\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.1.\nError: Cannot get HW Info for device 9.1..\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -844,7 +819,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithInvalidPatternThenInvalidD
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.1..\nError: Cannot get HW Info for device 9.1...\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.1..\nError: Cannot get HW Info for device 9.1...\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -859,7 +834,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithMissingMajorValueWhenInval
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: .1.2\nError: Cannot get HW Info for device .1.2.\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: .1.2\nError: Cannot get HW Info for device .1.2.\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -874,7 +849,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenInvalidRevisionValueIsPass
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.0.a\nError: Cannot get HW Info for device 9.0.a.\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.0.a\nError: Cannot get HW Info for device 9.0.a.\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -889,7 +864,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenInvalidMinorValueIsPassedT
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.a\nError: Cannot get HW Info for device 9.a.\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.a\nError: Cannot get HW Info for device 9.a.\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -904,7 +879,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenPassedValuesAreOutOfRangeT
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine device target: 256.350\nError: Cannot get HW Info for device 256.350.\n");
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 256.350\nError: Cannot get HW Info for device 256.350.\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -919,7 +894,7 @@ TEST_F(OfflineCompilerTests, givenInitHardwareInfowhenDeviceConfigContainsDevice
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
deviceMapConfig.deviceIds = &deviceIdsForTests;
break;
}
@@ -1358,7 +1333,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
std::string configStr;
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
break;
}
}
@@ -1664,36 +1639,6 @@ TEST(OfflineCompilerTest, WhenParsingCmdLineThenOptionsAreReadCorrectly) {
delete mockOfflineCompiler;
}
TEST(OfflineCompilerTest, GivenUnknownIsaConfigValueWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
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) {
auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
auto deviceName = "00.01.02";
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 target based on product config: " << deviceName << "\n";
EXPECT_STREQ(output.c_str(), resString.str().c_str());
}
TEST(OfflineCompilerTest, givenStatelessToStatefullOptimizationEnabledWhenDebugSettingsAreParsedThenOptimizationStringIsPresent) {
DebugManagerStateRestore stateRestore;
MockOfflineCompiler mockOfflineCompiler;
@@ -1775,6 +1720,23 @@ TEST(OfflineCompilerTest, GivenValidParamWhenGettingHardwareInfoThenSuccessIsRet
EXPECT_NE(PRODUCT_FAMILY::IGFX_UNKNOWN, mockOfflineCompiler->getHardwareInfo().platform.eProductFamily);
}
TEST(OfflineCompilerTest, GivenConfigValueWhichIsOutOfRangeWhenGettingHardwareInfoThenInvalidDeviceIsReturned) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler);
uint32_t value = 0xffffff + 1;
std::stringstream inproperValue, resString;
inproperValue << value;
testing::internal::CaptureStdout();
EXPECT_EQ(CL_INVALID_DEVICE, mockOfflineCompiler->initHardwareInfo(inproperValue.str()));
resString << "Could not determine target based on product config: " << inproperValue.str() << "\n";
auto output = testing::internal::GetCapturedStdout();
EXPECT_STREQ(output.c_str(), resString.str().c_str());
}
TEST(OfflineCompilerTest, WhenStoringBinaryThenStoredCorrectly) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler);
@@ -3021,35 +2983,37 @@ TEST(OclocArgHelperTest, GivenNoOutputPrintMessages) {
EXPECT_STREQ(printMsg.data(), capturedStdout.c_str());
}
TEST(OclocArgHelperTest, GivenDifferentAotConfigsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
TEST(OclocArgHelperTest, GivenDifferentRevisionIdsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
DeviceMapping lhs{};
DeviceMapping rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.aotConfig = {AOT::CONFIG_MAX_PLATFORM};
rhs.aotConfig = {AOT::UNKNOWN_ISA};
lhs.revId = 1;
rhs.revId = 2;
EXPECT_FALSE(lhs == rhs);
}
TEST(OclocArgHelperTest, GivenDifferentHwInfosInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
DeviceMapping lhs{};
DeviceMapping rhs{};
ASSERT_TRUE(lhs == rhs);
HardwareInfo firstHwInfo{};
lhs.hwInfo = &firstHwInfo;
HardwareInfo secondHwInfo{};
rhs.hwInfo = &secondHwInfo;
EXPECT_FALSE(lhs == rhs);
}
TEST(OclocArgHelperTest, GivenDifferentFamiliesInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
TEST(OclocArgHelperTest, GivenDifferentConfigsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
DeviceMapping lhs{};
DeviceMapping rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.family = AOT::FAMILY_MAX;
rhs.family = AOT::UNKNOWN_FAMILY;
EXPECT_FALSE(lhs == rhs);
}
TEST(OclocArgHelperTest, GivenDifferentReleasesInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
DeviceMapping lhs{};
DeviceMapping rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.release = AOT::RELEASE_MAX;
rhs.release = AOT::UNKNOWN_RELEASE;
lhs.config = CONFIG_MAX_PLATFORM;
rhs.config = UNKNOWN_ISA;
EXPECT_FALSE(lhs == rhs);
}

View File

@@ -5,16 +5,22 @@
*
*/
#include "shared/test/common/xe_hpc_core/pvc/product_configs_pvc.h"
#include "opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.h"
namespace NEO {
static PRODUCT_CONFIG pvcProductConfig[] = {
PVC_XL_A0,
PVC_XL_A0P,
PVC_XT_A0,
PVC_XT_B0,
PVC_XT_B1,
PVC_XT_C0};
INSTANTIATE_TEST_CASE_P(
OclocProductConfigPvcTestsValues,
OclocProductConfigTests,
::testing::Combine(
::testing::ValuesIn(AOT_PVC::productConfigs),
::testing::ValuesIn(pvcProductConfig),
::testing::Values(IGFX_PVC)));
} // namespace NEO

View File

@@ -5,16 +5,19 @@
*
*/
#include "shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h"
#include "opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.h"
namespace NEO {
static PRODUCT_CONFIG dg2ProductConfig[] = {
DG2_G10_A0,
DG2_G11,
DG2_G10_B0};
INSTANTIATE_TEST_CASE_P(
OclocProductConfigDg2TestsValues,
OclocProductConfigTests,
::testing::Combine(
::testing::ValuesIn(AOT_DG2::productConfigs),
::testing::ValuesIn(dg2ProductConfig),
::testing::Values(IGFX_DG2)));
} // namespace NEO