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
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,4 +48,121 @@ TEST_F(ProductConfigHelperTests, givenUnknownFamilyEnumWhenHelperSearchForAMatch
|
||||
TEST_F(ProductConfigHelperTests, givenUnknownIsaEnumWhenParseMajorMinorRevisionValueThenCorrectStringIsReturned) {
|
||||
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