mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Ocloc: Support for various variants of acronyms
In addition to supporting the official -device acronyms (e.g. xe-hpg), support for shorter and deprecated acronyms has also been added. An example of supported variances: - xehpg - xe_hpg - xe_hpg_core Signed-off-by: Daria Hinz <daria.hinz@intel.com> Related-To: NEO-6910
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
9996228281
commit
2637ae5816
@ -135,3 +135,63 @@ TEST_F(OclocArgHelperTests, givenHwInfoForProductConfigWhenUnknownIsaIsPassedThe
|
||||
NEO::HardwareInfo hwInfo;
|
||||
EXPECT_FALSE(argHelper->getHwInfoForProductConfig(AOT::UNKNOWN_ISA, hwInfo));
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenEnabledFamilyAcronymsWhenCheckIfIsFamilyThenTrueIsReturned) {
|
||||
auto enabledFamiliesAcronyms = argHelper->getEnabledFamiliesAcronyms();
|
||||
for (const auto &acronym : enabledFamiliesAcronyms) {
|
||||
EXPECT_TRUE(argHelper->isFamily(acronym.str()));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenEnabledReleaseAcronymsWhenCheckIfIsReleaseThenTrueIsReturned) {
|
||||
auto enabledReleasesAcronyms = argHelper->getEnabledReleasesAcronyms();
|
||||
for (const auto &acronym : enabledReleasesAcronyms) {
|
||||
EXPECT_TRUE(argHelper->isRelease(acronym.str()));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenDisabledFamilyOrReleaseNameThenReturnsEmptyList) {
|
||||
EXPECT_FALSE(argHelper->isFamily(NEO::ConstStringRef("gen0").str()));
|
||||
EXPECT_FALSE(argHelper->isFamily(NEO::ConstStringRef("genX").str()));
|
||||
EXPECT_FALSE(argHelper->isRelease(NEO::ConstStringRef("gen0").str()));
|
||||
EXPECT_FALSE(argHelper->isRelease(NEO::ConstStringRef("genX").str()));
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenEnabledFamilyAcronymsWithoutDashesWhenCheckIfIsFamilyThenTrueIsReturned) {
|
||||
auto enabledFamiliesAcronyms = argHelper->getEnabledFamiliesAcronyms();
|
||||
for (const auto &acronym : enabledFamiliesAcronyms) {
|
||||
std::string acronymCopy = acronym.str();
|
||||
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash != std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
EXPECT_TRUE(argHelper->isFamily(acronymCopy));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenEnabledReleaseAcronymsWithoutDashesWhenCheckIfIsReleaseThenTrueIsReturned) {
|
||||
auto enabledReleasesAcronyms = argHelper->getEnabledReleasesAcronyms();
|
||||
for (const auto &acronym : enabledReleasesAcronyms) {
|
||||
std::string acronymCopy = acronym.str();
|
||||
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash != std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
EXPECT_TRUE(argHelper->isRelease(acronymCopy));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenEnabledProductAcronymsWithoutDashesWhenCheckIfIsReleaseThenTrueIsReturned) {
|
||||
auto enabledProductsAcronyms = argHelper->getEnabledProductAcronyms();
|
||||
for (const auto &acronym : enabledProductsAcronyms) {
|
||||
std::string acronymCopy = acronym.str();
|
||||
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash != std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
EXPECT_TRUE(argHelper->isProductConfig(acronymCopy));
|
||||
}
|
||||
}
|
@ -78,6 +78,59 @@ std::string prepareTwoDevices(MockOclocArgHelper *argHelper) {
|
||||
return cfg1 + "," + cfg2;
|
||||
}
|
||||
|
||||
void appendAcronymWithoutDashes(std::vector<std::string> &out, ConstStringRef acronym) {
|
||||
if (acronym.contains("-")) {
|
||||
auto acronymCopy = acronym.str();
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash == std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
out.push_back(acronymCopy);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> prepareProductsWithoutDashes(OclocArgHelper *argHelper) {
|
||||
auto enabledProductsAcronyms = argHelper->getEnabledProductAcronyms();
|
||||
if (enabledProductsAcronyms.size() < 2) {
|
||||
return {};
|
||||
}
|
||||
std::vector<std::string> acronyms{};
|
||||
for (const auto &acronym : enabledProductsAcronyms) {
|
||||
appendAcronymWithoutDashes(acronyms, acronym);
|
||||
if (acronyms.size() > 1)
|
||||
break;
|
||||
}
|
||||
return acronyms;
|
||||
}
|
||||
|
||||
std::vector<std::string> prepareReleasesWithoutDashes(OclocArgHelper *argHelper) {
|
||||
auto enabledReleasesAcronyms = argHelper->getEnabledReleasesAcronyms();
|
||||
if (enabledReleasesAcronyms.size() < 2) {
|
||||
return {};
|
||||
}
|
||||
std::vector<std::string> acronyms{};
|
||||
for (const auto &acronym : enabledReleasesAcronyms) {
|
||||
appendAcronymWithoutDashes(acronyms, acronym);
|
||||
if (acronyms.size() > 1)
|
||||
break;
|
||||
}
|
||||
return acronyms;
|
||||
}
|
||||
|
||||
std::vector<std::string> prepareFamiliesWithoutDashes(OclocArgHelper *argHelper) {
|
||||
auto enabledFamiliesAcronyms = argHelper->getEnabledFamiliesAcronyms();
|
||||
if (enabledFamiliesAcronyms.size() < 2) {
|
||||
return {};
|
||||
}
|
||||
std::vector<std::string> acronyms{};
|
||||
for (const auto &acronym : enabledFamiliesAcronyms) {
|
||||
appendAcronymWithoutDashes(acronyms, acronym);
|
||||
if (acronyms.size() > 1)
|
||||
break;
|
||||
}
|
||||
return acronyms;
|
||||
}
|
||||
|
||||
TEST(OclocFatBinaryRequestedFatBinary, WhenDeviceArgMissingThenReturnsFalse) {
|
||||
const char *args[] = {"ocloc", "-aaa", "*", "-device", "*"};
|
||||
|
||||
@ -199,6 +252,16 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceArgProvidedWhenUnknownFami
|
||||
EXPECT_FALSE(NEO::requestedFatBinary(3, unknownFamily, oclocArgHelperWithoutInput.get()));
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceArgProvidedWhenKnownNameIsPassedWithCoreSuffixThenRequestedFatBinaryReturnsTrue) {
|
||||
for (const auto &acronyms : {enabledFamiliesAcronyms, enabledReleasesAcronyms}) {
|
||||
for (const auto &acronym : acronyms) {
|
||||
auto acronymStr = acronym.str() + "_core";
|
||||
const char *name[] = {"ocloc", "-device", acronymStr.c_str()};
|
||||
EXPECT_TRUE(NEO::requestedFatBinary(3, name, oclocArgHelperWithoutInput.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceArgProvidedWhenKnownNameIsPassedThenRequestedFatBinaryReturnsTrue) {
|
||||
for (const auto &acronyms : {enabledFamiliesAcronyms, enabledReleasesAcronyms}) {
|
||||
for (const auto &acronym : acronyms) {
|
||||
@ -209,25 +272,6 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceArgProvidedWhenKnownNameIs
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenEnabledFamilyAcronymsWhenCheckIfIsFamilyThenTrueIsReturned) {
|
||||
for (const auto &acronym : enabledFamiliesAcronyms) {
|
||||
EXPECT_TRUE(oclocArgHelperWithoutInput->isFamily(acronym.str()));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenEnabledReleaseAcronymsWhenCheckIfIsReleaseThenTrueIsReturned) {
|
||||
for (const auto &acronym : enabledReleasesAcronyms) {
|
||||
EXPECT_TRUE(oclocArgHelperWithoutInput->isRelease(acronym.str()));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenDisabledFamilyOrReleaseNameThenReturnsEmptyList) {
|
||||
EXPECT_FALSE(oclocArgHelperWithoutInput->isFamily(ConstStringRef("gen0").str()));
|
||||
EXPECT_FALSE(oclocArgHelperWithoutInput->isFamily(ConstStringRef("genX").str()));
|
||||
EXPECT_FALSE(oclocArgHelperWithoutInput->isRelease(ConstStringRef("gen0").str()));
|
||||
EXPECT_FALSE(oclocArgHelperWithoutInput->isRelease(ConstStringRef("genX").str()));
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenUnkownArchitectureThenReturnEmptyList) {
|
||||
auto got = NEO::getTargetProductsForFatbinary("gen0", oclocArgHelperWithoutInput.get());
|
||||
EXPECT_TRUE(got.empty());
|
||||
@ -323,6 +367,39 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfProductsWhenFatBinar
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsAcronymsWithoutDashesWhenBuildFatBinaryThenSuccessIsReturned) {
|
||||
auto acronyms = prepareProductsWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
std::string acronymsTarget = acronyms[0] + "," + acronyms[1];
|
||||
std::vector<ConstStringRef> expected{ConstStringRef(acronyms[0]), ConstStringRef(acronyms[1])};
|
||||
|
||||
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
|
||||
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
|
||||
std::stringstream resString;
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
clFiles + "copybuffer.cl",
|
||||
"-device",
|
||||
acronymsTarget};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
}
|
||||
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoSameReleaseTargetsWhenGetProductsAcronymsThenDuplicatesAreNotFound) {
|
||||
if (enabledReleasesAcronyms.empty()) {
|
||||
GTEST_SKIP();
|
||||
@ -354,6 +431,40 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoSameFamilyTargetsWhenGetProdu
|
||||
EXPECT_EQ(acronyms.size(), expectedSize);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenReleasesAcronymsWithoutDashesWhenGetProductsForFatBinaryThenCorrectAcronymsAreReturned) {
|
||||
auto acronyms = prepareReleasesWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> expected{};
|
||||
auto release0 = ProductConfigHelper::returnReleaseForAcronym(acronyms[0]);
|
||||
auto release1 = ProductConfigHelper::returnReleaseForAcronym(acronyms[1]);
|
||||
getProductsAcronymsForTarget(expected, release0, oclocArgHelperWithoutInput.get());
|
||||
getProductsAcronymsForTarget(expected, release1, oclocArgHelperWithoutInput.get());
|
||||
|
||||
std::string releasesTarget = acronyms[0] + "," + acronyms[1];
|
||||
auto got = NEO::getTargetProductsForFatbinary(releasesTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesAcronymsWithoutDashesWhenGetProductsForFatBinaryThenCorrectAcronymsAreReturned) {
|
||||
auto acronyms = prepareFamiliesWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> expected{};
|
||||
auto family0 = ProductConfigHelper::returnFamilyForAcronym(acronyms[0]);
|
||||
auto family1 = ProductConfigHelper::returnFamilyForAcronym(acronyms[1]);
|
||||
getProductsAcronymsForTarget(expected, family0, oclocArgHelperWithoutInput.get());
|
||||
getProductsAcronymsForTarget(expected, family1, oclocArgHelperWithoutInput.get());
|
||||
|
||||
std::string familiesTarget = acronyms[0] + "," + acronyms[1];
|
||||
auto got = NEO::getTargetProductsForFatbinary(familiesTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfReleasesWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
if (enabledReleasesAcronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
@ -480,30 +591,20 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsClosedRangeWhenFatBinary
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenReleasesClosedRangeWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
if (enabledReleasesAcronyms.size() < 3) {
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsClosedRangeWithoutDashesWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
auto acronyms = prepareProductsWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
for (unsigned int release = 0; release < enabledReleasesAcronyms.size() - 1; release++) {
|
||||
if (release == enabledReleasesAcronyms.size() / 2) {
|
||||
continue;
|
||||
auto prodFromIt = std::find_if(enabledProductsAcronyms.begin(), enabledProductsAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronyms[0]));
|
||||
auto prodToIt = std::find_if(enabledProductsAcronyms.begin(), enabledProductsAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronyms[1]));
|
||||
if (prodFromIt > prodToIt) {
|
||||
std::swap(prodFromIt, prodToIt);
|
||||
}
|
||||
std::vector<ConstStringRef> expected{};
|
||||
auto acronymFrom = enabledReleasesAcronyms.at(release);
|
||||
auto acronymTo = enabledReleasesAcronyms.at(enabledReleasesAcronyms.size() / 2);
|
||||
expected.insert(expected.end(), prodFromIt, ++prodToIt);
|
||||
|
||||
auto releaseFromIt = ProductConfigHelper::returnReleaseForAcronym(acronymFrom.str());
|
||||
auto releaseToIt = ProductConfigHelper::returnReleaseForAcronym(acronymTo.str());
|
||||
|
||||
if (releaseFromIt > releaseToIt) {
|
||||
std::swap(releaseFromIt, releaseToIt);
|
||||
}
|
||||
while (releaseFromIt <= releaseToIt) {
|
||||
getProductsAcronymsForTarget(expected, releaseFromIt, oclocArgHelperWithoutInput.get());
|
||||
releaseFromIt = static_cast<AOT::RELEASE>(static_cast<unsigned int>(releaseFromIt) + 1);
|
||||
}
|
||||
|
||||
std::string acronymsTarget = acronymFrom.str() + ":" + acronymTo.str();
|
||||
std::string acronymsTarget = acronyms[0] + ":" + acronyms[1];
|
||||
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
|
||||
@ -527,6 +628,50 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenReleasesClosedRangeWhenFatBinary
|
||||
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenReleasesClosedRangeWithoutDashesWhenGetProductsForFatBinaryThenCorrectAcronymsAreReturned) {
|
||||
auto acronyms = prepareReleasesWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto releaseFromIt = ProductConfigHelper::returnReleaseForAcronym(acronyms[0]);
|
||||
auto releaseToIt = ProductConfigHelper::returnReleaseForAcronym(acronyms[1]);
|
||||
|
||||
if (releaseFromIt > releaseToIt) {
|
||||
std::swap(releaseFromIt, releaseToIt);
|
||||
}
|
||||
std::vector<ConstStringRef> expected{};
|
||||
while (releaseFromIt <= releaseToIt) {
|
||||
getProductsAcronymsForTarget(expected, releaseFromIt, oclocArgHelperWithoutInput.get());
|
||||
releaseFromIt = static_cast<AOT::RELEASE>(static_cast<unsigned int>(releaseFromIt) + 1);
|
||||
}
|
||||
|
||||
std::string acronymsTarget = acronyms[0] + ":" + acronyms[1];
|
||||
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesClosedRangeWithoutDashesWhenGetProductsForFatBinaryThenCorrectAcronymsAreReturned) {
|
||||
auto acronyms = prepareFamiliesWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto familyFromIt = ProductConfigHelper::returnFamilyForAcronym(acronyms[0]);
|
||||
auto familyToIt = ProductConfigHelper::returnFamilyForAcronym(acronyms[1]);
|
||||
|
||||
if (familyFromIt > familyToIt) {
|
||||
std::swap(familyFromIt, familyToIt);
|
||||
}
|
||||
std::vector<ConstStringRef> expected{};
|
||||
while (familyFromIt <= familyToIt) {
|
||||
getProductsAcronymsForTarget(expected, familyFromIt, oclocArgHelperWithoutInput.get());
|
||||
familyFromIt = static_cast<AOT::FAMILY>(static_cast<unsigned int>(familyFromIt) + 1);
|
||||
}
|
||||
|
||||
std::string acronymsTarget = acronyms[0] + ":" + acronyms[1];
|
||||
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesClosedRangeWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
@ -612,6 +757,41 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromProductWhenFatBinar
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromProductWithoutDashesWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
auto acronyms = prepareProductsWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
std::string acronymsTarget = acronyms[0] + ":";
|
||||
std::vector<ConstStringRef> expected{};
|
||||
|
||||
auto acronymIt = std::find_if(enabledProductsAcronyms.begin(), enabledProductsAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronyms[0]));
|
||||
expected.insert(expected.end(), acronymIt, enabledProductsAcronyms.end());
|
||||
|
||||
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
|
||||
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
|
||||
std::stringstream resString;
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
clFiles + "copybuffer.cl",
|
||||
"-device",
|
||||
acronymsTarget};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = buildFatBinary(argv, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
|
||||
for (const auto &product : expected) {
|
||||
resString << "Build succeeded for : " << product.str() + ".\n";
|
||||
}
|
||||
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToProductWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
if (enabledProductsAcronyms.size() < 2) {
|
||||
GTEST_SKIP();
|
||||
@ -646,6 +826,25 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToProductWhenFatBinaryB
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWithoutDashesWhenGetProductsForFatBinaryThenCorrectAcronymsAreReturned) {
|
||||
auto acronyms = prepareReleasesWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
std::vector<ConstStringRef> expected{};
|
||||
|
||||
auto releaseFromId = ProductConfigHelper::returnReleaseForAcronym(acronyms[0]);
|
||||
auto releaseToId = AOT::RELEASE_MAX;
|
||||
while (releaseFromId < releaseToId) {
|
||||
getProductsAcronymsForTarget(expected, releaseFromId, oclocArgHelperWithoutInput.get());
|
||||
releaseFromId = static_cast<AOT::RELEASE>(static_cast<unsigned int>(releaseFromId) + 1);
|
||||
}
|
||||
|
||||
std::string releasesTarget = acronyms[0] + ":";
|
||||
auto got = NEO::getTargetProductsForFatbinary(releasesTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
if (enabledReleasesAcronyms.size() < 3) {
|
||||
GTEST_SKIP();
|
||||
@ -729,6 +928,25 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToReleaseWhenFatBinaryB
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromFamilyWithoutDashesWhenGetProductsForFatBinaryThenCorrectAcronymsAreReturned) {
|
||||
auto acronyms = prepareFamiliesWithoutDashes(oclocArgHelperWithoutInput.get());
|
||||
if (acronyms.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
std::vector<ConstStringRef> expected{};
|
||||
|
||||
auto familyFromId = ProductConfigHelper::returnFamilyForAcronym(acronyms[0]);
|
||||
auto familyToId = AOT::FAMILY_MAX;
|
||||
while (familyFromId < familyToId) {
|
||||
getProductsAcronymsForTarget(expected, familyFromId, oclocArgHelperWithoutInput.get());
|
||||
familyFromId = static_cast<AOT::FAMILY>(static_cast<unsigned int>(familyFromId) + 1);
|
||||
}
|
||||
|
||||
std::string familiesTarget = acronyms[0] + ":";
|
||||
auto got = NEO::getTargetProductsForFatbinary(familiesTarget, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(got, expected);
|
||||
}
|
||||
|
||||
TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromFamilyWhenFatBinaryBuildIsInvokedThenSuccessIsReturned) {
|
||||
if (enabledFamiliesAcronyms.size() < 3) {
|
||||
GTEST_SKIP();
|
||||
|
@ -568,6 +568,28 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHa
|
||||
EXPECT_NE(mockOfflineCompiler.hwInfo.gtSystemInfo.MaxSubSlicesSupported, 0u);
|
||||
}
|
||||
|
||||
TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithRevisionWhenInitHwInfoThenValuesAreSetAndSuccessIsReturned) {
|
||||
MockOfflineCompiler mockOfflineCompiler;
|
||||
auto deprecatedAcronyms = mockOfflineCompiler.getDeprecatedDevicesTypes();
|
||||
if (deprecatedAcronyms.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto acronyms = CompilerOptions::tokenize(deprecatedAcronyms, ',');
|
||||
|
||||
for (const auto &deprecatedAcronym : acronyms) {
|
||||
if (deprecatedAcronym.contains(" ")) {
|
||||
auto name = deprecatedAcronym.str();
|
||||
auto space = name.find(" ");
|
||||
mockOfflineCompiler.deviceName = name.substr(++space, name.size());
|
||||
} else {
|
||||
mockOfflineCompiler.deviceName = deprecatedAcronym.str();
|
||||
}
|
||||
mockOfflineCompiler.revisionId = 0x3;
|
||||
EXPECT_EQ(mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName), OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usRevId, mockOfflineCompiler.revisionId);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMaxDualSubSlicesSupportedIsSet, IsAtLeastGen12lp) {
|
||||
MockOfflineCompiler mockOfflineCompiler;
|
||||
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
|
||||
|
@ -29,11 +29,14 @@ bool requestedFatBinary(const std::vector<std::string> &args, OclocArgHelper *he
|
||||
const bool hasMoreArgs = (argIndex + 1 < args.size());
|
||||
if ((ConstStringRef("-device") == currArg) && hasMoreArgs) {
|
||||
ConstStringRef deviceArg(args[argIndex + 1]);
|
||||
auto deviceName = deviceArg.str();
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
|
||||
auto retVal = deviceArg.contains("*");
|
||||
retVal |= deviceArg.contains(":");
|
||||
retVal |= deviceArg.contains(",");
|
||||
retVal |= helper->isFamily(deviceArg.str());
|
||||
retVal |= helper->isRelease(deviceArg.str());
|
||||
retVal |= helper->isFamily(deviceName);
|
||||
retVal |= helper->isRelease(deviceName);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
@ -93,8 +96,11 @@ void getProductsForRange(unsigned int productFrom, unsigned int productTo, std::
|
||||
|
||||
std::vector<ConstStringRef> getProductForClosedRange(ConstStringRef rangeFrom, ConstStringRef rangeTo, OclocArgHelper *argHelper) {
|
||||
std::vector<ConstStringRef> requestedProducts = {};
|
||||
auto rangeFromStr = rangeFrom.str();
|
||||
auto rangeToStr = rangeTo.str();
|
||||
auto rangeFromStr = rangeFrom.str();
|
||||
|
||||
ProductConfigHelper::adjustDeviceName(rangeToStr);
|
||||
ProductConfigHelper::adjustDeviceName(rangeFromStr);
|
||||
|
||||
if (argHelper->isFamily(rangeFromStr) && argHelper->isFamily(rangeToStr)) {
|
||||
auto familyFrom = ProductConfigHelper::returnFamilyForAcronym(rangeFromStr);
|
||||
@ -125,6 +131,7 @@ std::vector<ConstStringRef> getProductForClosedRange(ConstStringRef rangeFrom, C
|
||||
std::vector<ConstStringRef> getProductForOpenRange(ConstStringRef openRange, OclocArgHelper *argHelper, bool rangeTo) {
|
||||
std::vector<ConstStringRef> requestedProducts = {};
|
||||
auto openRangeStr = openRange.str();
|
||||
ProductConfigHelper::adjustDeviceName(openRangeStr);
|
||||
|
||||
if (argHelper->isFamily(openRangeStr)) {
|
||||
auto family = ProductConfigHelper::returnFamilyForAcronym(openRangeStr);
|
||||
@ -167,6 +174,8 @@ std::vector<ConstStringRef> getProductForSpecificTarget(CompilerOptions::Tokeniz
|
||||
std::vector<ConstStringRef> requestedConfigs;
|
||||
for (const auto &target : targets) {
|
||||
auto targetStr = target.str();
|
||||
ProductConfigHelper::adjustDeviceName(targetStr);
|
||||
|
||||
if (argHelper->isFamily(targetStr)) {
|
||||
auto family = ProductConfigHelper::returnFamilyForAcronym(targetStr);
|
||||
getProductsAcronymsForTarget(requestedConfigs, family, argHelper);
|
||||
@ -176,7 +185,7 @@ std::vector<ConstStringRef> getProductForSpecificTarget(CompilerOptions::Tokeniz
|
||||
} else if (argHelper->isProductConfig(targetStr)) {
|
||||
requestedConfigs.push_back(target);
|
||||
} else {
|
||||
argHelper->printf("Failed to parse target : %s - invalid device:\n", targetStr.c_str());
|
||||
argHelper->printf("Failed to parse target : %s - invalid device:\n", target.str().c_str());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -350,6 +350,8 @@ int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceNam
|
||||
|
||||
int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) {
|
||||
AheadOfTimeConfig aotConfig{AOT::UNKNOWN_ISA};
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
|
||||
if (deviceName.find(".") != std::string::npos) {
|
||||
aotConfig = argHelper->getMajorMinorRevision(deviceName);
|
||||
if (aotConfig.ProductConfig == AOT::UNKNOWN_ISA) {
|
||||
@ -380,7 +382,7 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
}
|
||||
|
||||
overridePlatformName(deviceName);
|
||||
std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower);
|
||||
|
||||
const char hexPrefix = 2;
|
||||
int deviceId = -1;
|
||||
|
||||
@ -777,7 +779,7 @@ std::string OfflineCompiler::getDeprecatedDevicesTypes() {
|
||||
|
||||
std::ostringstream os;
|
||||
for (const auto &prefix : prefixes) {
|
||||
if (std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findDuplicate(prefix)))
|
||||
if (std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(prefix)))
|
||||
continue;
|
||||
if (os.tellp())
|
||||
os << ", ";
|
||||
|
@ -7,22 +7,38 @@
|
||||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
void ProductConfigHelper::adjustDeviceName(std::string &device) {
|
||||
std::transform(device.begin(), device.end(), device.begin(), ::tolower);
|
||||
|
||||
auto findCore = device.find("_core");
|
||||
if (findCore != std::string::npos) {
|
||||
device = device.substr(0, findCore);
|
||||
}
|
||||
|
||||
auto findUnderscore = device.find("_");
|
||||
if (findUnderscore != std::string::npos) {
|
||||
device.erase(std::remove(device.begin(), device.end(), '_'), device.end());
|
||||
}
|
||||
}
|
||||
|
||||
AOT::RELEASE ProductConfigHelper::returnReleaseForAcronym(const std::string &device) {
|
||||
auto it = AOT::releaseAcronyms.find(device);
|
||||
auto it = std::find_if(AOT::releaseAcronyms.begin(), AOT::releaseAcronyms.end(), findMapAcronymWithoutDash(device));
|
||||
if (it == AOT::releaseAcronyms.end())
|
||||
return AOT::UNKNOWN_RELEASE;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
AOT::FAMILY ProductConfigHelper::returnFamilyForAcronym(const std::string &device) {
|
||||
auto it = AOT::familyAcronyms.find(device);
|
||||
auto it = std::find_if(AOT::familyAcronyms.begin(), AOT::familyAcronyms.end(), findMapAcronymWithoutDash(device));
|
||||
if (it == AOT::familyAcronyms.end())
|
||||
return AOT::UNKNOWN_FAMILY;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
AOT::PRODUCT_CONFIG ProductConfigHelper::returnProductConfigForAcronym(const std::string &device) {
|
||||
auto it = AOT::productConfigAcronyms.find(device);
|
||||
auto it = std::find_if(AOT::productConfigAcronyms.begin(), AOT::productConfigAcronyms.end(), findMapAcronymWithoutDash(device));
|
||||
if (it == AOT::productConfigAcronyms.end())
|
||||
return AOT::UNKNOWN_ISA;
|
||||
return it->second;
|
||||
|
@ -27,6 +27,21 @@ struct AheadOfTimeConfig {
|
||||
};
|
||||
|
||||
struct ProductConfigHelper {
|
||||
template <typename EqComparableT>
|
||||
static auto findAcronymWithoutDash(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) {
|
||||
return lhs == rhs || rhs.isEqualWithoutSeparator('-', lhs.c_str());
|
||||
};
|
||||
}
|
||||
|
||||
template <typename EqComparableT>
|
||||
static auto findMapAcronymWithoutDash(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) {
|
||||
NEO::ConstStringRef ptrStr(rhs.first);
|
||||
return lhs == ptrStr || ptrStr.isEqualWithoutSeparator('-', lhs.c_str());
|
||||
};
|
||||
}
|
||||
static void adjustDeviceName(std::string &device);
|
||||
static std::string parseMajorMinorValue(AheadOfTimeConfig config);
|
||||
static std::string parseMajorMinorRevisionValue(AheadOfTimeConfig config);
|
||||
inline static std::string parseMajorMinorRevisionValue(AOT::PRODUCT_CONFIG config) {
|
||||
|
@ -168,6 +168,22 @@ class ConstStringRef {
|
||||
return ('\0' == *rhs);
|
||||
}
|
||||
|
||||
constexpr bool isEqualWithoutSeparator(const char separator, const char *subString) const noexcept {
|
||||
const char *end = ptr + len;
|
||||
const char *lhs = ptr;
|
||||
const char *rhs = subString;
|
||||
|
||||
for (auto i = lhs; i != end; i++) {
|
||||
if (*i == separator) {
|
||||
continue;
|
||||
}
|
||||
if (*i != *rhs)
|
||||
return false;
|
||||
++rhs;
|
||||
}
|
||||
return ('\0' == *rhs);
|
||||
}
|
||||
|
||||
protected:
|
||||
ConstStringRef(std::nullptr_t) = delete;
|
||||
|
||||
|
@ -11,20 +11,20 @@
|
||||
using ProductConfigHelperTests = ::testing::Test;
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenProductAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
|
||||
for (const auto &product : AOT::productConfigAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym(product.first), product.second);
|
||||
for (const auto &[acronym, value] : AOT::productConfigAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym(acronym), value);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenReleaseAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
|
||||
for (const auto &release : AOT::releaseAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym(release.first), release.second);
|
||||
for (const auto &[acronym, value] : AOT::releaseAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym(acronym), value);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenFamilyAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
|
||||
for (const auto &family : AOT::familyAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym(family.first), family.second);
|
||||
for (const auto &[acronym, value] : AOT::familyAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym(acronym), value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@ TEST_F(ProductConfigHelperTests, givenUnknownAcronymWhenHelperSearchForAMatchThe
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenFamilyEnumWhenHelperSearchForAMatchThenCorrespondingAcronymIsReturned) {
|
||||
for (const auto &family : AOT::familyAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::getAcronymForAFamily(family.second), family.first);
|
||||
for (const auto &[acronym, value] : AOT::familyAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::getAcronymForAFamily(value), acronym);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,3 +49,120 @@ TEST_F(ProductConfigHelperTests, givenUnknownIsaEnumWhenParseMajorMinorRevisionV
|
||||
auto unknownIsa = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
|
||||
EXPECT_STREQ(unknownIsa.c_str(), "0.0.0");
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenDeviceStringWithCoreWhenAdjustDeviceNameThenCorrectStringIsReturned) {
|
||||
std::string deviceName = "gen0_core";
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
EXPECT_STREQ(deviceName.c_str(), "gen0");
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenDeviceStringWithUnderscoreWhenAdjustDeviceNameThenCorrectStringIsReturned) {
|
||||
std::string deviceName = "ab_cd_ef";
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
EXPECT_STREQ(deviceName.c_str(), "abcdef");
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenDeviceStringWithUnderscoreAndCoreWhenAdjustDeviceNameThenCorrectStringIsReturned) {
|
||||
std::string deviceName = "ab_cd_ef_core";
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
EXPECT_STREQ(deviceName.c_str(), "abcdef");
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenDeviceStringWitDashesWhenAdjustDeviceNameThenTheSameStringIsReturned) {
|
||||
std::string deviceName = "ab-cd-ef";
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
EXPECT_STREQ(deviceName.c_str(), "ab-cd-ef");
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenDeviceStringWithUnderscoreAndCapitalLetterWhenAdjustDeviceNameThenCorrectStringIsReturned) {
|
||||
std::string deviceName = "AB_cd_core";
|
||||
ProductConfigHelper::adjustDeviceName(deviceName);
|
||||
EXPECT_STREQ(deviceName.c_str(), "abcd");
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenProductAcronymWhenAdjustDeviceNameThenNothingIsChangedAndSameStringIsPreserved) {
|
||||
for (const auto &product : AOT::productConfigAcronyms) {
|
||||
std::string acronymCopy = product.first;
|
||||
ProductConfigHelper::adjustDeviceName(acronymCopy);
|
||||
EXPECT_STREQ(acronymCopy.c_str(), product.first.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenReleaseAcronymWhenAdjustDeviceNameThenNothingIsChangedAndSameStringIsPreserved) {
|
||||
for (const auto &release : AOT::releaseAcronyms) {
|
||||
std::string acronymCopy = release.first;
|
||||
ProductConfigHelper::adjustDeviceName(acronymCopy);
|
||||
EXPECT_STREQ(acronymCopy.c_str(), release.first.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenFamilyAcronymWhenAdjustDeviceNameThenNothingIsChangedAndSameStringIsPreserved) {
|
||||
for (const auto &family : AOT::familyAcronyms) {
|
||||
std::string acronymCopy = family.first;
|
||||
ProductConfigHelper::adjustDeviceName(acronymCopy);
|
||||
EXPECT_STREQ(acronymCopy.c_str(), family.first.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenProductAcronymWhenRemoveDashesFromTheNameThenStillCorrectValueIsReturned) {
|
||||
for (const auto &[acronym, value] : AOT::productConfigAcronyms) {
|
||||
std::string acronymCopy = acronym;
|
||||
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash != std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
|
||||
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym(acronymCopy), value);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenReleaseAcronymWhenRemoveDashesFromTheNameThenStillCorrectValueIsReturned) {
|
||||
for (const auto &[acronym, value] : AOT::releaseAcronyms) {
|
||||
std::string acronymCopy = acronym;
|
||||
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash != std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
|
||||
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym(acronymCopy), value);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenFamilyAcronymWhenRemoveDashesFromTheNameThenStillCorrectValueIsReturned) {
|
||||
for (const auto &[acronym, value] : AOT::familyAcronyms) {
|
||||
std::string acronymCopy = acronym;
|
||||
|
||||
auto findDash = acronymCopy.find("-");
|
||||
if (findDash != std::string::npos) {
|
||||
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
|
||||
}
|
||||
|
||||
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym(acronymCopy), value);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenAcronymWithoutDashesWhenSearchMatchInSampleVectorThenCorrectValueIsReturned) {
|
||||
std::vector<NEO::ConstStringRef> sampleAcronyms = {"ab-cd", "abc-p", "abc"};
|
||||
|
||||
std::string acronym = "ab-cd";
|
||||
auto ret = std::find_if(sampleAcronyms.begin(), sampleAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronym));
|
||||
EXPECT_NE(ret, sampleAcronyms.end());
|
||||
|
||||
acronym = "abcd";
|
||||
ret = std::find_if(sampleAcronyms.begin(), sampleAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronym));
|
||||
EXPECT_NE(ret, sampleAcronyms.end());
|
||||
|
||||
acronym = "ab";
|
||||
ret = std::find_if(sampleAcronyms.begin(), sampleAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronym));
|
||||
EXPECT_EQ(ret, sampleAcronyms.end());
|
||||
|
||||
acronym = "abdc";
|
||||
ret = std::find_if(sampleAcronyms.begin(), sampleAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronym));
|
||||
EXPECT_EQ(ret, sampleAcronyms.end());
|
||||
|
||||
acronym = "abcp";
|
||||
ret = std::find_if(sampleAcronyms.begin(), sampleAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronym));
|
||||
EXPECT_NE(ret, sampleAcronyms.end());
|
||||
}
|
@ -11,6 +11,7 @@ if(TESTS_XE_HP_CORE)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds_xe_hp_core_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_xe_hp_core_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_config_tests_xe_hp_core.cpp
|
||||
)
|
||||
|
||||
if(DEFINED AUB_STREAM_PROJECT_NAME)
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using ProductConfigHelperXeHpCoreTests = ::testing::Test;
|
||||
|
||||
XE_HP_CORE_TEST_F(ProductConfigHelperXeHpCoreTests, givenVariousVariantsOfXeHpAcronymsWhenGetReleaseThenCorrectValueIsReturned) {
|
||||
std::vector<std::string> acronymsVariants = {"xe_hp_core", "xe_hp", "xehp", "XeHp"};
|
||||
for (auto &acronym : acronymsVariants) {
|
||||
ProductConfigHelper::adjustDeviceName(acronym);
|
||||
auto ret = ProductConfigHelper::returnReleaseForAcronym(acronym);
|
||||
EXPECT_EQ(ret, AOT::XE_HP_RELEASE);
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ if(TESTS_XE_HPC_CORE)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds_xe_hpc_core_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_xe_hpc_core_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_config_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xe_hpc_core.cpp
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using ProductConfigHelperXeHpgCoreTests = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(ProductConfigHelperXeHpgCoreTests, givenVariousVariantsOfXeHpcAcronymsWhenGetReleaseThenCorrectValueIsReturned) {
|
||||
std::vector<std::string> acronymsVariants = {"xe_hpc_core", "xe_hpc", "xehpc", "XeHpc"};
|
||||
for (auto &acronym : acronymsVariants) {
|
||||
ProductConfigHelper::adjustDeviceName(acronym);
|
||||
auto ret = ProductConfigHelper::returnReleaseForAcronym(acronym);
|
||||
EXPECT_EQ(ret, AOT::XE_HPC_RELEASE);
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ if(TESTS_XE_HPG_CORE)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds_xe_hpg_core_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xe_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_config_tests_xe_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_xe_hpg_core.cpp
|
||||
)
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using ProductConfigHelperXeHpgCoreTests = ::testing::Test;
|
||||
|
||||
XE_HPG_CORETEST_F(ProductConfigHelperXeHpgCoreTests, givenVariousVariantsOfAcronymsWhenGetReleaseThenCorrectValueIsReturned) {
|
||||
std::vector<std::string> acronymsVariants = {"xe_hpg_core", "xe_hpg", "xehpg", "XeHpg"};
|
||||
for (auto &acronym : acronymsVariants) {
|
||||
ProductConfigHelper::adjustDeviceName(acronym);
|
||||
auto ret = ProductConfigHelper::returnReleaseForAcronym(acronym);
|
||||
EXPECT_EQ(ret, AOT::XE_HPG_RELEASE);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user