Setting default device id for acronym

This PR includes:
- Move product config implementation from
ocloc arg helper to product config helper.
- Add default device id setting for each platform configuration.
- Add & move hw info config tests from opencl to shared

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
Related-To: NEO-7112
This commit is contained in:
Daria Hinz
2022-07-08 11:29:59 +00:00
committed by Compute-Runtime-Automation
parent 05ad32704b
commit 01af53b63c
100 changed files with 1773 additions and 694 deletions

View File

@@ -22,7 +22,7 @@ using CommandListStatePrefetchPvcXt = Test<CommandListStatePrefetchXeHpcCore>;
PVCTEST_F(CommandListStatePrefetchPvcXt, givenCommandBufferIsExhaustedWhenPrefetchApiCalledAndIsPvcXtNotBaseDieA0ThenProgramStatePrefetch) {
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
hwInfo->platform.usDeviceID = PVC_XT_IDS.front();
hwInfo->platform.usDeviceID = pvcXtDeviceIds.front();
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0
checkIfCommandBufferIsExhaustedWhenPrefetchApiCalledThenStatePrefetchProgrammed(hwInfo);
}
@@ -31,7 +31,7 @@ PVCTEST_F(CommandListStatePrefetchPvcXt, givenDebugFlagSetWhenPrefetchApiCalledA
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.usDeviceID = PVC_XT_IDS.front();
hwInfo->platform.usDeviceID = pvcXtDeviceIds.front();
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0
checkIfDebugFlagSetWhenPrefetchApiCalledAThenStatePrefetchProgrammed(hwInfo);
}

View File

@@ -25,7 +25,7 @@ PVCTEST_F(DeviceTestPvcXt, whenCallingGetMemoryPropertiesWithNonNullPtrAndRevisi
auto &device = driverHandle->devices[0];
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
hwInfo->platform.usDeviceID = PVC_XT_IDS.front();
hwInfo->platform.usDeviceID = pvcXtDeviceIds.front();
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0
checkIfCallingGetMemoryPropertiesWithNonNullPtrThenMaxClockRateReturnZero(hwInfo);

View File

@@ -271,7 +271,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndUnsuppo
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
hwInfo->platform.usDeviceID = NEO::PVC_XL_IDS.front();
hwInfo->platform.usDeviceID = NEO::pvcXlDeviceIds.front();
EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable());
}
@@ -280,7 +280,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndSupport
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
for (auto deviceId : NEO::PVC_XT_IDS) {
for (const auto &deviceId : NEO::pvcXtDeviceIds) {
hwInfo->platform.usDeviceID = deviceId;
EXPECT_TRUE(metricIpSamplingOsInterface->isDependencyAvailable());
}
@@ -290,7 +290,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenDriverOpenFailsWhenIsDependencyA
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
hwInfo->platform.usDeviceID = NEO::PVC_XT_IDS.front();
hwInfo->platform.usDeviceID = NEO::pvcXtDeviceIds.front();
auto drm = static_cast<DrmPrelimMock *>(device->getOsInterface().getDriverModel()->as<NEO::Drm>());
VariableBackup<int> backupCsTimeStampFrequency(&drm->storedCsTimestampFrequency, 0);
@@ -303,7 +303,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenIoctlHelperFailsWhenIsDependency
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
hwInfo->platform.usDeviceID = NEO::PVC_XT_IDS.front();
hwInfo->platform.usDeviceID = NEO::pvcXtDeviceIds.front();
auto drm = static_cast<DrmPrelimMock *>(device->getOsInterface().getDriverModel()->as<NEO::Drm>());

View File

@@ -49,7 +49,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestUpstream, GivenSupportedProductFamilyAndSuppo
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
for (auto deviceId : NEO::PVC_XT_IDS) {
for (const auto &deviceId : NEO::pvcXtDeviceIds) {
hwInfo->platform.usDeviceID = deviceId;
EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable());
}

View File

@@ -13,6 +13,8 @@
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using TgllpHwInfoConfig = ::testing::Test;
@@ -197,3 +199,9 @@ TGLLPTEST_F(TgllpHwInfo, givenTgllpWhenObtainingBlitterPreferenceThenReturnFalse
EXPECT_FALSE(hwInfoConfig.obtainBlitterPreference(hardwareInfo));
}
TGLLPTEST_F(TgllpHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::TGL);
}

View File

@@ -9,7 +9,6 @@ if(TESTS_BXT)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/device_tests_bxt.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_bxt.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_bxt.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen9_bxt})
add_subdirectories()

View File

@@ -8,7 +8,6 @@ if(TESTS_CFL)
set(IGDRCL_SRCS_tests_gen9_cfl
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_cfl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_cfl.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen9_cfl})
add_subdirectories()

View File

@@ -8,7 +8,6 @@ if(TESTS_GLK)
set(IGDRCL_SRCS_tests_gen9_glk
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_glk.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_glk.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen9_glk})
add_subdirectories()

View File

@@ -8,7 +8,6 @@ if(TESTS_KBL)
set(IGDRCL_SRCS_tests_gen9_kbl
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_kbl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_kbl.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen9_kbl})
add_subdirectories()

View File

@@ -9,7 +9,6 @@ if(TESTS_SKL)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/device_tests_skl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_skl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_skl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_skl.cpp
)

View File

@@ -63,7 +63,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_concat_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fatbinary_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fatbinary_tests.h

View File

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

View File

@@ -215,7 +215,7 @@ TEST(OclocApiTests, givenUnknownAcronymWhenIdsCommandIsInvokeThenErrorIsReported
TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
std::string clFileName(clFiles + "copybuffer.cl");
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
auto allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
auto allSupportedDeviceConfigs = argHelper->productConfigHelper->getDeviceAotInfo();
if (allSupportedDeviceConfigs.empty()) {
GTEST_SKIP();
}

View File

@@ -20,6 +20,7 @@
#include "environment.h"
#include "mock/mock_argument_helper.h"
#include "mock/mock_offline_compiler.h"
#include "platforms.h"
#include <algorithm>
#include <unordered_set>
@@ -53,7 +54,7 @@ auto allFilesInArchiveExceptPaddingStartsWith(const Ar::Ar &archive, const Const
}
std::string getDeviceConfig(const OfflineCompiler &offlineCompiler, MockOclocArgHelper *argHelper) {
auto allEnabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
return {};
}
@@ -68,7 +69,7 @@ std::string getDeviceConfig(const OfflineCompiler &offlineCompiler, MockOclocArg
}
std::string prepareTwoDevices(MockOclocArgHelper *argHelper) {
auto enabledProductsAcronyms = argHelper->getEnabledProductAcronyms();
auto enabledProductsAcronyms = argHelper->productConfigHelper->getRepresentativeProductAcronyms();
if (enabledProductsAcronyms.size() < 2) {
return {};
}
@@ -90,7 +91,7 @@ void appendAcronymWithoutDashes(std::vector<std::string> &out, ConstStringRef ac
}
std::vector<std::string> prepareProductsWithoutDashes(OclocArgHelper *argHelper) {
auto enabledProductsAcronyms = argHelper->getEnabledProductAcronyms();
auto enabledProductsAcronyms = argHelper->productConfigHelper->getRepresentativeProductAcronyms();
if (enabledProductsAcronyms.size() < 2) {
return {};
}
@@ -104,7 +105,7 @@ std::vector<std::string> prepareProductsWithoutDashes(OclocArgHelper *argHelper)
}
std::vector<std::string> prepareReleasesWithoutDashes(OclocArgHelper *argHelper) {
auto enabledReleasesAcronyms = argHelper->getEnabledReleasesAcronyms();
auto enabledReleasesAcronyms = argHelper->productConfigHelper->getReleasesAcronyms();
if (enabledReleasesAcronyms.size() < 2) {
return {};
}
@@ -118,7 +119,7 @@ std::vector<std::string> prepareReleasesWithoutDashes(OclocArgHelper *argHelper)
}
std::vector<std::string> prepareFamiliesWithoutDashes(OclocArgHelper *argHelper) {
auto enabledFamiliesAcronyms = argHelper->getEnabledFamiliesAcronyms();
auto enabledFamiliesAcronyms = argHelper->productConfigHelper->getFamiliesAcronyms();
if (enabledFamiliesAcronyms.size() < 2) {
return {};
}
@@ -143,9 +144,15 @@ TEST(OclocFatBinaryRequestedFatBinary, WhenDeviceArgMissingThenReturnsFalse) {
EXPECT_FALSE(NEO::requestedFatBinary(4, args, argHelper.get()));
}
TEST(OclocFatBinaryRequestedFatBinary, givenHwInfoForProductConfigWhenUnknownIsaIsPassedThenFalseIsReturned) {
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
NEO::HardwareInfo hwInfo;
EXPECT_FALSE(argHelper->getHwInfoForProductConfig(AOT::UNKNOWN_ISA, hwInfo, 0u));
}
TEST(OclocFatBinaryRequestedFatBinary, givenReleaseOrFamilyAcronymWhenGetAcronymsForTargetThenCorrectValuesAreReturned) {
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
auto &enabledDeviceConfigs = argHelper->productConfigHelper->getDeviceAotInfo();
if (enabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -177,7 +184,7 @@ TEST(OclocFatBinaryRequestedFatBinary, givenReleaseOrFamilyAcronymWhenGetAcronym
TEST(OclocFatBinaryRequestedFatBinary, givenDeviceArgToFatBinaryWhenConfigIsNotFullThenFalseIsReturned) {
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
auto allEnabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -186,11 +193,12 @@ TEST(OclocFatBinaryRequestedFatBinary, givenDeviceArgToFatBinaryWhenConfigIsNotF
std::stringstream majorString;
majorString << aotConfig.ProductConfigID.Major;
auto major = majorString.str();
auto aotValue0 = argHelper->getProductConfigForVersionValue(major);
auto aotValue0 = argHelper->productConfigHelper->getProductConfigForVersionValue(major);
EXPECT_EQ(aotValue0, AOT::UNKNOWN_ISA);
auto majorMinor = ProductConfigHelper::parseMajorMinorValue(aotConfig);
auto aotValue1 = argHelper->getProductConfigForVersionValue(majorMinor);
auto aotValue1 = argHelper->productConfigHelper->getProductConfigForVersionValue(majorMinor);
EXPECT_EQ(aotValue1, AOT::UNKNOWN_ISA);
const char *cutRevision[] = {"ocloc", "-device", majorMinor.c_str()};
@@ -225,7 +233,7 @@ TEST(OclocFatBinaryRequestedFatBinary, givenDeviceArgProvidedWhenFatBinaryFormat
}
TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceArgAsSingleProductThenFatBinaryIsNotRequested) {
auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
for (const auto &deviceConfig : allEnabledDeviceConfigs) {
std::string configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceConfig.aotConfig);
@@ -241,7 +249,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenDeviceArgAsSingleProductThenFatB
}
TEST_F(OclocFatBinaryProductAcronymsTests, givenAsterixThenReturnAllEnabledAcronyms) {
auto expected = oclocArgHelperWithoutInput->getEnabledProductAcronyms();
auto expected = oclocArgHelperWithoutInput->productConfigHelper->getRepresentativeProductAcronyms();
auto got = NEO::getTargetProductsForFatbinary("*", oclocArgHelperWithoutInput.get());
EXPECT_EQ(got.size(), expected.size());
@@ -445,7 +453,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoSameReleaseTargetsWhenGetProd
auto acronym = enabledReleasesAcronyms[0];
std::vector<ConstStringRef> acronyms{};
auto release = ProductConfigHelper::returnReleaseForAcronym(acronym.str());
auto release = ProductConfigHelper::getReleaseForAcronym(acronym.str());
getProductsAcronymsForTarget(acronyms, release, oclocArgHelperWithoutInput.get());
auto expectedSize = acronyms.size();
getProductsAcronymsForTarget(acronyms, release, oclocArgHelperWithoutInput.get());
@@ -460,7 +468,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoSameFamilyTargetsWhenGetProdu
auto acronym = enabledFamiliesAcronyms[0];
std::vector<ConstStringRef> acronyms{};
auto family = ProductConfigHelper::returnFamilyForAcronym(acronym.str());
auto family = ProductConfigHelper::getFamilyForAcronym(acronym.str());
getProductsAcronymsForTarget(acronyms, family, oclocArgHelperWithoutInput.get());
auto expectedSize = acronyms.size();
getProductsAcronymsForTarget(acronyms, family, oclocArgHelperWithoutInput.get());
@@ -475,8 +483,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenReleasesAcronymsWithoutDashesWhe
}
std::vector<ConstStringRef> expected{};
auto release0 = ProductConfigHelper::returnReleaseForAcronym(acronyms[0]);
auto release1 = ProductConfigHelper::returnReleaseForAcronym(acronyms[1]);
auto release0 = ProductConfigHelper::getReleaseForAcronym(acronyms[0]);
auto release1 = ProductConfigHelper::getReleaseForAcronym(acronyms[1]);
getProductsAcronymsForTarget(expected, release0, oclocArgHelperWithoutInput.get());
getProductsAcronymsForTarget(expected, release1, oclocArgHelperWithoutInput.get());
@@ -492,8 +500,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesAcronymsWithoutDashesWhe
}
std::vector<ConstStringRef> expected{};
auto family0 = ProductConfigHelper::returnFamilyForAcronym(acronyms[0]);
auto family1 = ProductConfigHelper::returnFamilyForAcronym(acronyms[1]);
auto family0 = ProductConfigHelper::getFamilyForAcronym(acronyms[0]);
auto family1 = ProductConfigHelper::getFamilyForAcronym(acronyms[1]);
getProductsAcronymsForTarget(expected, family0, oclocArgHelperWithoutInput.get());
getProductsAcronymsForTarget(expected, family1, oclocArgHelperWithoutInput.get());
@@ -511,8 +519,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfReleasesWhenFatBinar
auto acronym1 = enabledReleasesAcronyms.at(product + 1);
std::vector<ConstStringRef> expected{};
auto release0 = ProductConfigHelper::returnReleaseForAcronym(acronym0.str());
auto release1 = ProductConfigHelper::returnReleaseForAcronym(acronym1.str());
auto release0 = ProductConfigHelper::getReleaseForAcronym(acronym0.str());
auto release1 = ProductConfigHelper::getReleaseForAcronym(acronym1.str());
getProductsAcronymsForTarget(expected, release0, oclocArgHelperWithoutInput.get());
getProductsAcronymsForTarget(expected, release1, oclocArgHelperWithoutInput.get());
@@ -552,8 +560,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfFamiliesWhenFatBinar
auto acronym1 = enabledFamiliesAcronyms.at(product + 1);
std::vector<ConstStringRef> expected{};
auto family0 = ProductConfigHelper::returnFamilyForAcronym(acronym0.str());
auto family1 = ProductConfigHelper::returnFamilyForAcronym(acronym1.str());
auto family0 = ProductConfigHelper::getFamilyForAcronym(acronym0.str());
auto family1 = ProductConfigHelper::getFamilyForAcronym(acronym1.str());
getProductsAcronymsForTarget(expected, family0, oclocArgHelperWithoutInput.get());
getProductsAcronymsForTarget(expected, family1, oclocArgHelperWithoutInput.get());
@@ -671,8 +679,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenReleasesClosedRangeWithoutDashes
if (acronyms.size() < 2) {
GTEST_SKIP();
}
auto releaseFromIt = ProductConfigHelper::returnReleaseForAcronym(acronyms[0]);
auto releaseToIt = ProductConfigHelper::returnReleaseForAcronym(acronyms[1]);
auto releaseFromIt = ProductConfigHelper::getReleaseForAcronym(acronyms[0]);
auto releaseToIt = ProductConfigHelper::getReleaseForAcronym(acronyms[1]);
if (releaseFromIt > releaseToIt) {
std::swap(releaseFromIt, releaseToIt);
@@ -694,8 +702,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesClosedRangeWithoutDashes
GTEST_SKIP();
}
auto familyFromIt = ProductConfigHelper::returnFamilyForAcronym(acronyms[0]);
auto familyToIt = ProductConfigHelper::returnFamilyForAcronym(acronyms[1]);
auto familyFromIt = ProductConfigHelper::getFamilyForAcronym(acronyms[0]);
auto familyToIt = ProductConfigHelper::getFamilyForAcronym(acronyms[1]);
if (familyFromIt > familyToIt) {
std::swap(familyFromIt, familyToIt);
@@ -723,8 +731,8 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesClosedRangeWhenFatBinary
auto acronymFrom = enabledFamiliesAcronyms.at(family);
auto acronymTo = enabledFamiliesAcronyms.at(enabledFamiliesAcronyms.size() / 2);
auto familyFromIt = ProductConfigHelper::returnFamilyForAcronym(acronymFrom.str());
auto familyToIt = ProductConfigHelper::returnFamilyForAcronym(acronymTo.str());
auto familyFromIt = ProductConfigHelper::getFamilyForAcronym(acronymFrom.str());
auto familyToIt = ProductConfigHelper::getFamilyForAcronym(acronymTo.str());
if (familyFromIt > familyToIt) {
std::swap(familyFromIt, familyToIt);
@@ -870,7 +878,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWithoutDashe
}
std::vector<ConstStringRef> expected{};
auto releaseFromId = ProductConfigHelper::returnReleaseForAcronym(acronyms[0]);
auto releaseFromId = ProductConfigHelper::getReleaseForAcronym(acronyms[0]);
auto releaseToId = AOT::RELEASE_MAX;
while (releaseFromId < releaseToId) {
getProductsAcronymsForTarget(expected, releaseFromId, oclocArgHelperWithoutInput.get());
@@ -890,7 +898,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWhenFatBinar
for (const auto &release : enabledReleasesAcronyms) {
std::vector<ConstStringRef> expected{};
auto releaseFromId = ProductConfigHelper::returnReleaseForAcronym(release.str());
auto releaseFromId = ProductConfigHelper::getReleaseForAcronym(release.str());
auto releaseToId = AOT::RELEASE_MAX;
while (releaseFromId < releaseToId) {
getProductsAcronymsForTarget(expected, releaseFromId, oclocArgHelperWithoutInput.get());
@@ -932,7 +940,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToReleaseWhenFatBinaryB
std::vector<ConstStringRef> expected{};
auto releaseFromId = static_cast<AOT::RELEASE>(static_cast<unsigned int>(AOT::UNKNOWN_RELEASE) + 1);
auto releaseToId = ProductConfigHelper::returnReleaseForAcronym(release.str());
auto releaseToId = ProductConfigHelper::getReleaseForAcronym(release.str());
while (releaseFromId <= releaseToId) {
getProductsAcronymsForTarget(expected, releaseFromId, oclocArgHelperWithoutInput.get());
@@ -972,7 +980,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromFamilyWithoutDashes
}
std::vector<ConstStringRef> expected{};
auto familyFromId = ProductConfigHelper::returnFamilyForAcronym(acronyms[0]);
auto familyFromId = ProductConfigHelper::getFamilyForAcronym(acronyms[0]);
auto familyToId = AOT::FAMILY_MAX;
while (familyFromId < familyToId) {
getProductsAcronymsForTarget(expected, familyFromId, oclocArgHelperWithoutInput.get());
@@ -992,7 +1000,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromFamilyWhenFatBinary
for (const auto &family : enabledFamiliesAcronyms) {
std::vector<ConstStringRef> expected{};
auto familyFromId = ProductConfigHelper::returnFamilyForAcronym(family.str());
auto familyFromId = ProductConfigHelper::getFamilyForAcronym(family.str());
auto familyToId = AOT::FAMILY_MAX;
while (familyFromId < familyToId) {
getProductsAcronymsForTarget(expected, familyFromId, oclocArgHelperWithoutInput.get());
@@ -1034,7 +1042,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToFamilyWhenFatBinaryBu
std::vector<ConstStringRef> expected{};
auto familyFromId = static_cast<AOT::FAMILY>(static_cast<unsigned int>(AOT::UNKNOWN_FAMILY) + 1);
auto familyToId = ProductConfigHelper::returnFamilyForAcronym(family.str());
auto familyToId = ProductConfigHelper::getFamilyForAcronym(family.str());
while (familyFromId <= familyToId) {
getProductsAcronymsForTarget(expected, familyFromId, oclocArgHelperWithoutInput.get());

View File

@@ -17,7 +17,7 @@
namespace NEO {
class OclocEnabledAcronyms : public ::testing::Test {
public:
std::vector<DeviceMapping> enabledProducts{};
std::vector<DeviceAotInfo> enabledProducts{};
std::vector<ConstStringRef> enabledProductsAcronyms{};
std::vector<ConstStringRef> enabledFamiliesAcronyms{};
std::vector<ConstStringRef> enabledReleasesAcronyms{};
@@ -29,10 +29,10 @@ class OclocFatBinaryProductAcronymsTests : public OclocEnabledAcronyms {
oclocArgHelperWithoutInput = std::make_unique<OclocArgHelper>();
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{true};
enabledProducts = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
enabledProductsAcronyms = oclocArgHelperWithoutInput->getEnabledProductAcronyms();
enabledFamiliesAcronyms = oclocArgHelperWithoutInput->getEnabledFamiliesAcronyms();
enabledReleasesAcronyms = oclocArgHelperWithoutInput->getEnabledReleasesAcronyms();
enabledProducts = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
enabledProductsAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getRepresentativeProductAcronyms();
enabledFamiliesAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getFamiliesAcronyms();
enabledReleasesAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getReleasesAcronyms();
}
std::unique_ptr<OclocArgHelper> oclocArgHelperWithoutInput;
@@ -44,10 +44,10 @@ class OclocFatBinaryTest : public OclocEnabledAcronyms {
mockArgHelperFilesMap[spirvFilename] = spirvFileContent;
mockArgHelper.interceptOutput = true;
enabledProducts = mockArgHelper.getAllSupportedDeviceConfigs();
enabledProductsAcronyms = mockArgHelper.getEnabledProductAcronyms();
enabledFamiliesAcronyms = mockArgHelper.getEnabledFamiliesAcronyms();
enabledReleasesAcronyms = mockArgHelper.getEnabledReleasesAcronyms();
enabledProducts = mockArgHelper.productConfigHelper->getDeviceAotInfo();
enabledProductsAcronyms = mockArgHelper.productConfigHelper->getRepresentativeProductAcronyms();
enabledFamiliesAcronyms = mockArgHelper.productConfigHelper->getFamiliesAcronyms();
enabledReleasesAcronyms = mockArgHelper.productConfigHelper->getReleasesAcronyms();
}
protected:

View File

@@ -13,13 +13,11 @@ namespace NEO {
TEST_P(OclocProductConfigTests, GivenProductConfigValuesWhenInitHardwareInfoThenCorrectValuesAreSet) {
auto deviceId = 0u;
auto revId = 0u;
auto allSupportedDeviceConfigs = mockOfflineCompiler->argHelper->getAllSupportedDeviceConfigs();
auto allSupportedConfigs = mockOfflineCompiler->argHelper->productConfigHelper->getDeviceAotInfo();
for (const auto &deviceConfig : allSupportedDeviceConfigs) {
for (const auto &deviceConfig : allSupportedConfigs) {
if (aotConfig.ProductConfig == deviceConfig.aotConfig.ProductConfig) {
if (deviceConfig.deviceIds) {
deviceId = deviceConfig.deviceIds->front();
}
deviceId = deviceConfig.deviceIds->front();
revId = deviceConfig.aotConfig.ProductConfigID.Revision;
break;
}

View File

@@ -91,32 +91,3 @@ 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

@@ -29,6 +29,7 @@
#include "mock/mock_argument_helper.h"
#include "mock/mock_multi_command.h"
#include "mock/mock_offline_compiler.h"
#include "platforms.h"
#include <algorithm>
#include <array>
@@ -185,7 +186,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuc
}
TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuildingMultiCommandThenSuccessIsReturned) {
auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -522,7 +523,7 @@ TEST(MultiCommandWhiteboxTest, GivenInvalidArgsWhenInitializingThenErrorIsReturn
using MockOfflineCompilerTests = ::testing::Test;
TEST_F(MockOfflineCompilerTests, givenProductConfigValueAndRevisionIdWhenInitHwInfoThenTheseValuesAreSet) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -546,7 +547,7 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueAndRevisionIdWhenInitHwI
TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHardwareInfoValuesAreSet) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -569,7 +570,7 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHa
TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithRevisionWhenInitHwInfoThenValuesAreSetAndSuccessIsReturned) {
MockOfflineCompiler mockOfflineCompiler;
auto deprecatedAcronyms = mockOfflineCompiler.argHelper->getDeprecatedAcronyms();
auto deprecatedAcronyms = mockOfflineCompiler.argHelper->productConfigHelper->getDeprecatedAcronyms();
if (deprecatedAcronyms.empty()) {
GTEST_SKIP();
}
@@ -584,7 +585,7 @@ TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithRevisionWhenInitHwIn
TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForProductConfigThenCorrectValuesAreSet) {
MockOfflineCompiler mockOfflineCompiler;
auto enabledProductAcronyms = mockOfflineCompiler.argHelper->getEnabledProductAcronyms();
auto enabledProductAcronyms = mockOfflineCompiler.argHelper->productConfigHelper->getRepresentativeProductAcronyms();
if (enabledProductAcronyms.empty()) {
GTEST_SKIP();
}
@@ -610,7 +611,7 @@ TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForProductConfigT
TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForDeprecatedAcronymsThenCorrectValuesAreSet) {
MockOfflineCompiler mockOfflineCompiler;
auto deprecatedAcronyms = mockOfflineCompiler.argHelper->getDeprecatedAcronyms();
auto deprecatedAcronyms = mockOfflineCompiler.argHelper->productConfigHelper->getDeprecatedAcronyms();
if (deprecatedAcronyms.empty()) {
GTEST_SKIP();
}
@@ -635,7 +636,7 @@ TEST_F(MockOfflineCompilerTests, givenHwInfoConfigWhenSetHwInfoForDeprecatedAcro
TEST_F(MockOfflineCompilerTests, givenAcronymWithUppercaseWhenInitHwInfoThenSuccessIsReturned) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -658,7 +659,7 @@ TEST_F(MockOfflineCompilerTests, givenAcronymWithUppercaseWhenInitHwInfoThenSucc
TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithUppercaseWhenInitHwInfoThenSuccessIsReturned) {
MockOfflineCompiler mockOfflineCompiler;
auto deprecatedAcronyms = mockOfflineCompiler.argHelper->getDeprecatedAcronyms();
auto deprecatedAcronyms = mockOfflineCompiler.argHelper->productConfigHelper->getDeprecatedAcronyms();
if (deprecatedAcronyms.empty()) {
GTEST_SKIP();
}
@@ -672,7 +673,7 @@ TEST_F(MockOfflineCompilerTests, givenDeprecatedAcronymsWithUppercaseWhenInitHwI
HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMaxDualSubSlicesSupportedIsSet, IsAtLeastGen12lp) {
MockOfflineCompiler mockOfflineCompiler;
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
@@ -728,14 +729,14 @@ All supported acronyms: )===";
}
TEST_F(OfflineCompilerTests, givenFamilyAcronymWhenIdsCommandIsInvokeThenSuccessAndCorrectIdsAreReturned) {
auto enabledFamilies = oclocArgHelperWithoutInput->getEnabledFamiliesAcronyms();
auto enabledFamilies = oclocArgHelperWithoutInput->productConfigHelper->getFamiliesAcronyms();
if (enabledFamilies.empty()) {
GTEST_SKIP();
}
auto supportedDevicesConfigs = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
auto supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
for (const auto &familyAcronym : enabledFamilies) {
std::vector<std::string> expected{};
auto family = ProductConfigHelper::returnFamilyForAcronym(familyAcronym.str());
auto family = ProductConfigHelper::getFamilyForAcronym(familyAcronym.str());
for (const auto &device : supportedDevicesConfigs) {
if (device.family == family) {
auto config = ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig);
@@ -762,14 +763,14 @@ TEST_F(OfflineCompilerTests, givenFamilyAcronymWhenIdsCommandIsInvokeThenSuccess
}
TEST_F(OfflineCompilerTests, givenReleaseAcronymWhenIdsCommandIsInvokeThenSuccessAndCorrectIdsAreReturned) {
auto enabledReleases = oclocArgHelperWithoutInput->getEnabledReleasesAcronyms();
auto enabledReleases = oclocArgHelperWithoutInput->productConfigHelper->getReleasesAcronyms();
if (enabledReleases.empty()) {
GTEST_SKIP();
}
auto supportedDevicesConfigs = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
auto supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
for (const auto &releaseAcronym : enabledReleases) {
std::vector<std::string> expected{};
auto release = ProductConfigHelper::returnReleaseForAcronym(releaseAcronym.str());
auto release = ProductConfigHelper::getReleaseForAcronym(releaseAcronym.str());
for (const auto &device : supportedDevicesConfigs) {
if (device.release == release) {
auto config = ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig);
@@ -796,14 +797,14 @@ TEST_F(OfflineCompilerTests, givenReleaseAcronymWhenIdsCommandIsInvokeThenSucces
}
TEST_F(OfflineCompilerTests, givenProductAcronymWhenIdsCommandIsInvokeThenSuccessAndCorrectIdsAreReturned) {
auto enabledProducts = oclocArgHelperWithoutInput->getEnabledProductAcronyms();
auto enabledProducts = oclocArgHelperWithoutInput->productConfigHelper->getAllProductAcronyms();
if (enabledProducts.empty()) {
GTEST_SKIP();
}
auto supportedDevicesConfigs = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
auto supportedDevicesConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
for (const auto &productAcronym : enabledProducts) {
std::vector<std::string> expected{};
auto product = ProductConfigHelper::returnProductConfigForAcronym(productAcronym.str());
auto product = ProductConfigHelper::getProductConfigForAcronym(productAcronym.str());
for (const auto &device : supportedDevicesConfigs) {
if (device.aotConfig.ProductConfig == product) {
auto config = ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig);
@@ -1027,10 +1028,11 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenOfflineCompilerIsCreatedThenSuccessIsR
}
TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrectlySetValues) {
auto deviceId = oclocArgHelperWithoutInput->deviceProductTable[0].deviceId;
if (oclocArgHelperWithoutInput->deviceProductTable.size() == 1 && deviceId == 0) {
auto deviceAot = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
if (deviceAot.empty()) {
GTEST_SKIP();
}
auto deviceId = deviceAot[0].deviceIds->front();
MockOfflineCompiler mockOfflineCompiler;
std::stringstream deviceString, productString;
@@ -1042,13 +1044,17 @@ TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrect
}
TEST_F(OfflineCompilerTests, givenProperDeviceIdHexAsDeviceArgumentThenSuccessIsReturned) {
auto deviceId = oclocArgHelperWithoutInput->deviceProductTable[0].deviceId;
if (oclocArgHelperWithoutInput->deviceProductTable.size() == 1 && deviceId == 0) {
auto deviceAotInfo = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
if (deviceAotInfo.empty()) {
GTEST_SKIP();
}
std::stringstream deviceString, productString;
AOT::PRODUCT_CONFIG config;
auto deviceId = deviceAotInfo[0].deviceIds->front();
deviceString << "0x" << std::hex << deviceId;
productString << oclocArgHelperWithoutInput->deviceProductTable[0].product;
config = static_cast<AOT::PRODUCT_CONFIG>(deviceAotInfo[0].aotConfig.ProductConfig);
productString << oclocArgHelperWithoutInput->productConfigHelper->getAcronymForProductConfig(config);
std::vector<std::string> argv = {
"ocloc",
@@ -1086,7 +1092,7 @@ TEST_F(OfflineCompilerTests, givenIncorrectDeviceIdHexThenInvalidDeviceIsReturne
auto output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STREQ(output.c_str(), "Could not determine target based on device id: 0x0\nError: Cannot get HW Info for device 0x0.\n");
EXPECT_STREQ(output.c_str(), "Could not determine device target: 0x0\nError: Cannot get HW Info for device 0x0.\n");
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -1182,11 +1188,10 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenPassedValuesAreOutOfRangeT
TEST_F(OfflineCompilerTests, givenInitHardwareInfowhenDeviceConfigContainsDeviceIdsThenSetFirstDeviceId) {
MockOfflineCompiler mockOfflineCompiler;
auto &allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
auto &allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
std::vector<unsigned short> deviceIdsForTests = {0xfffd, 0xfffe, 0xffff};
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
@@ -1622,7 +1627,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingThenBuildSucceeds) {
}
TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuildSucceeds) {
auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
auto allEnabledDeviceConfigs = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
return;
}
@@ -1962,7 +1967,7 @@ TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenIn
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
auto output = testing::internal::GetCapturedStdout();
resString << "Could not determine target based on product config: " << deviceName << "\n";
resString << "Could not determine device target: " << deviceName << "\n";
EXPECT_STREQ(output.c_str(), resString.str().c_str());
}
@@ -3293,39 +3298,6 @@ TEST(OclocArgHelperTest, GivenNoOutputPrintMessages) {
EXPECT_STREQ(printMsg.data(), capturedStdout.c_str());
}
TEST(OclocArgHelperTest, GivenDifferentAotConfigsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
DeviceMapping lhs{};
DeviceMapping rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.aotConfig = {AOT::CONFIG_MAX_PLATFORM};
rhs.aotConfig = {AOT::UNKNOWN_ISA};
EXPECT_FALSE(lhs == rhs);
}
TEST(OclocArgHelperTest, GivenDifferentFamiliesInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
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;
EXPECT_FALSE(lhs == rhs);
}
TEST(OclocArgHelperTest, GivenValidHeaderFileWhenRequestingHeadersAsVectorOfStringsThenLinesAreStored) {
const char input[] = "First\nSecond\nThird";
const auto inputLength{sizeof(input)};

View File

@@ -21,7 +21,7 @@ using HwHelperTestsPvcXt = Test<HwHelperTestsXeHpcCore>;
PVCTEST_F(HwHelperTestsPvcXt, givenSingleTileCsrOnPvcXtWhenAllocatingCsrSpecificAllocationsAndIsNotBaseDieA0ThenStoredInProperMemoryPool) {
auto hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
hwInfo.platform.usDeviceID = PVC_XT_IDS.front();
hwInfo.platform.usDeviceID = pvcXtDeviceIds.front();
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); // not BD A0
checkIfSingleTileCsrWhenAllocatingCsrSpecificAllocationsThenStoredInProperMemoryPool(&hwInfo);
}
@@ -29,7 +29,7 @@ PVCTEST_F(HwHelperTestsPvcXt, givenSingleTileCsrOnPvcXtWhenAllocatingCsrSpecific
PVCTEST_F(HwHelperTestsPvcXt, givenMultiTileCsrOnPvcWhenAllocatingCsrSpecificAllocationsAndIsNotBaseDieA0ThenStoredInLocalMemoryPool) {
auto hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
hwInfo.platform.usDeviceID = PVC_XT_IDS.front();
hwInfo.platform.usDeviceID = pvcXtDeviceIds.front();
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); // not BD A0
checkIfMultiTileCsrWhenAllocatingCsrSpecificAllocationsThenStoredInLocalMemoryPool(&hwInfo);
}

View File

@@ -1,11 +1,11 @@
#
# Copyright (C) 2021 Intel Corporation
# Copyright (C) 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(IGDRCL_SRCS_linux_dll_tests_xe_hpc_core_pvc
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/device_id_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_id_tests_pvc.cpp
)
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_xe_hpc_core_pvc})

View File

@@ -9,7 +9,7 @@
using namespace NEO;
TEST_F(DeviceIdTests, GivenPvcSupportedDeviceIdThenConfigIsCorrect) {
PVCTEST_F(DeviceIdTests, GivenPvcSupportedDeviceIdThenConfigIsCorrect) {
std::array<DeviceDescriptor, 8> expectedDescriptors = {{
{0x0BD0, &PvcHwConfig::hwInfo, &PvcHwConfig::setupHardwareInfo},
{0x0BD5, &PvcHwConfig::hwInfo, &PvcHwConfig::setupHardwareInfo},

View File

@@ -9,13 +9,13 @@
#include "shared/source/helpers/constants.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/xe_hpc_core/hw_cmds_pvc.h"
#include "shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/helpers/gtest_helpers.h"
#include "device_ids_configs_pvc.h"
#include "gtest/gtest.h"
using namespace NEO;
@@ -112,12 +112,12 @@ PVCTEST_F(PvcHwInfo, givenDeviceIdThenProperMaxThreadsForWorkgroupIsReturned) {
HardwareInfo hwInfo = *defaultHwInfo;
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
for (auto &deviceId : PVC_XL_IDS) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_EQ(64u, hwInfoConfig.getMaxThreadsForWorkgroupInDSSOrSS(hwInfo, 64u, 64u));
}
for (auto &deviceId : PVC_XT_IDS) {
for (const auto &deviceId : pvcXtDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
uint32_t numThreadsPerEU = hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
EXPECT_EQ(64u * numThreadsPerEU, hwInfoConfig.getMaxThreadsForWorkgroupInDSSOrSS(hwInfo, 64u, 64u));
@@ -128,31 +128,31 @@ PVCTEST_F(PvcHwInfo, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConve
auto hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
std::vector<unsigned short> deviceIds = PVC_XL_IDS;
deviceIds.insert(deviceIds.end(), PVC_XT_IDS.begin(), PVC_XT_IDS.end());
for (uint32_t testValue = 0; testValue < 0xFF; testValue++) {
for (auto deviceId : deviceIds) {
hwInfo.platform.usDeviceID = deviceId;
auto hwRevIdFromStepping = hwInfoConfig.getHwRevIdFromStepping(testValue, hwInfo);
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
hwInfo.platform.usRevId = hwRevIdFromStepping;
EXPECT_EQ(testValue, hwInfoConfig.getSteppingFromHwRevId(hwInfo));
for (const auto &pvc : {pvcXlDeviceIds, pvcXtDeviceIds}) {
for (const auto &deviceId : pvc) {
hwInfo.platform.usDeviceID = deviceId;
auto hwRevIdFromStepping = hwInfoConfig.getHwRevIdFromStepping(testValue, hwInfo);
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
hwInfo.platform.usRevId = hwRevIdFromStepping;
EXPECT_EQ(testValue, hwInfoConfig.getSteppingFromHwRevId(hwInfo));
}
}
}
hwInfo.platform.usRevId = testValue;
auto steppingFromHwRevId = hwInfoConfig.getSteppingFromHwRevId(hwInfo);
if (steppingFromHwRevId != CommonConstants::invalidStepping) {
bool anyMatchAfterConversionFromStepping = false;
for (auto deviceId : deviceIds) {
hwInfo.platform.usDeviceID = deviceId;
auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(steppingFromHwRevId, hwInfo);
EXPECT_NE(CommonConstants::invalidStepping, hwRevId);
// expect values to match. 0x1 and 0x0 translate to the same stepping so they are interpreted as a match too.
if (((testValue & PVC::pvcSteppingBits) == (hwRevId & PVC::pvcSteppingBits)) ||
(((testValue & PVC::pvcSteppingBits) == 0x1) && ((hwRevId & PVC::pvcSteppingBits) == 0x0))) {
anyMatchAfterConversionFromStepping = true;
for (const auto &pvc : {pvcXlDeviceIds, pvcXtDeviceIds}) {
for (const auto &deviceId : pvc) {
hwInfo.platform.usDeviceID = deviceId;
auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(steppingFromHwRevId, hwInfo);
EXPECT_NE(CommonConstants::invalidStepping, hwRevId);
// expect values to match. 0x1 and 0x0 translate to the same stepping so they are interpreted as a match too.
if (((testValue & PVC::pvcSteppingBits) == (hwRevId & PVC::pvcSteppingBits)) ||
(((testValue & PVC::pvcSteppingBits) == 0x1) && ((hwRevId & PVC::pvcSteppingBits) == 0x0))) {
anyMatchAfterConversionFromStepping = true;
}
}
}
EXPECT_TRUE(anyMatchAfterConversionFromStepping);
@@ -164,12 +164,12 @@ PVCTEST_F(PvcHwInfo, givenPvcHwInfoConfigWhenIsIpSamplingSupportedThenCorrectRes
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
auto hwInfo = *defaultHwInfo;
for (auto &deviceId : PVC_XL_IDS) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_FALSE(hwInfoConfig.isIpSamplingSupported(hwInfo));
}
for (auto &deviceId : PVC_XT_IDS) {
for (const auto &deviceId : pvcXtDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_TRUE(hwInfoConfig.isIpSamplingSupported(hwInfo));
}

View File

@@ -41,7 +41,7 @@ DG2TEST_F(Dg2UsDeviceIdTest, givenDeviceThatHasHighNumberOfExecutionUnitsA0Stepp
mySysInfo.DualSubSliceCount = 2;
mySysInfo.ThreadCount = 32 * 8;
myPlatform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hardwareInfo);
myPlatform.usDeviceID = DG2_G10_IDS[0];
myPlatform.usDeviceID = dg2G10DeviceIds[0];
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
EXPECT_EQ(512u, device->sharedDeviceInfo.maxWorkGroupSize);
@@ -59,7 +59,7 @@ DG2TEST_F(Dg2UsDeviceIdTest, givenEnabledFtrPooledEuA0SteppingAndG10DevIdWhenCal
mySysInfo.EuCountPerPoolMin = 99999;
mySkuTable.flags.ftrPooledEuEnabled = 1;
myPlatform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hardwareInfo);
myPlatform.usDeviceID = DG2_G10_IDS[0];
myPlatform.usDeviceID = dg2G10DeviceIds[0];
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
@@ -71,7 +71,7 @@ DG2TEST_F(Dg2UsDeviceIdTest, givenEnabledFtrPooledEuA0SteppingAndG10DevIdWhenCal
DG2TEST_F(Dg2UsDeviceIdTest, givenRevisionEnumThenProperMaxThreadsForWorkgroupIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
hardwareInfo.platform.usDeviceID = DG2_G10_IDS[0];
hardwareInfo.platform.usDeviceID = dg2G10DeviceIds[0];
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hardwareInfo);
EXPECT_EQ(64u, hwInfoConfig.getMaxThreadsForWorkgroupInDSSOrSS(hardwareInfo, 64u, 64u));

View File

@@ -336,7 +336,7 @@ Examples:
Disassemble Intel Compute GPU device binary
ocloc disasm -file source_file_Gen9core.bin
)===",
argHelper->createStringForArgs(argHelper->getAllSupportedProductAcronyms()).c_str());
argHelper->createStringForArgs(argHelper->productConfigHelper->getAllProductAcronyms()).c_str());
}
int BinaryDecoder::processBinary(const void *&ptr, std::ostream &ptmFile) {

View File

@@ -133,7 +133,7 @@ Examples:
Assemble to Intel Compute GPU device binary
ocloc asm -out reassembled.bin
)===",
argHelper->createStringForArgs(argHelper->getAllSupportedProductAcronyms()).c_str());
argHelper->createStringForArgs(argHelper->productConfigHelper->getAllProductAcronyms()).c_str());
}
int BinaryEncoder::encode() {

View File

@@ -13,6 +13,7 @@
#include "shared/source/helpers/string.h"
#include "hw_cmds.h"
#include "platforms.h"
#include <algorithm>
#include <cstring>
@@ -56,20 +57,7 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
uint64_t **lenOutputs, char ***nameOutputs)
: numOutputs(numOutputs), nameOutputs(nameOutputs),
dataOutputs(dataOutputs), lenOutputs(lenOutputs), hasOutput(numOutputs != nullptr),
messagePrinter(hasOutput), deviceProductTable({
#define NAMEDDEVICE(devId, product, ignored_devName) {devId, NEO::hardwarePrefix[NEO::product::hwInfo.platform.eProductFamily]},
#define DEVICE(devId, product) {devId, NEO::hardwarePrefix[NEO::product::hwInfo.platform.eProductFamily]},
#include "devices.inl"
#undef DEVICE
#undef NAMEDDEVICE
{0u, std::string("")}}),
deviceMap({
#define DEVICE_CONFIG_IDS(product, productConfig, deviceIds, family, release) {&NEO::productConfig::hwInfo, &NEO::deviceIds, AOT::family, AOT::release, {AOT::product}},
#define DEVICE_CONFIG(product, productConfig, family, release) {&NEO::productConfig::hwInfo, nullptr, AOT::family, AOT::release, {AOT::product}},
#include "product_config.inl"
#undef DEVICE_CONFIG
#undef DEVICE_CONFIG_IDS
}) {
messagePrinter(hasOutput) {
for (uint32_t i = 0; i < numSources; ++i) {
inputs.push_back(Source(dataSources[i], static_cast<size_t>(lenSources[i]), nameSources[i]));
}
@@ -77,14 +65,7 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
headers.push_back(Source(dataInputHeaders[i], static_cast<size_t>(lenInputHeaders[i]), nameInputHeaders[i]));
}
std::sort(deviceMap.begin(), deviceMap.end(), compareConfigs);
for (auto &device : deviceMap) {
for (const auto &[acronym, value] : AOT::productConfigAcronyms) {
if (value == device.aotConfig.ProductConfig) {
device.acronyms.push_back(NEO::ConstStringRef(acronym));
}
}
}
productConfigHelper = std::make_unique<ProductConfigHelper>();
}
OclocArgHelper::OclocArgHelper() : OclocArgHelper(0, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) {}
@@ -168,25 +149,25 @@ std::unique_ptr<char[]> OclocArgHelper::loadDataFromFile(const std::string &file
}
}
bool OclocArgHelper::getHwInfoForProductConfig(uint32_t config, NEO::HardwareInfo &hwInfo, uint64_t hwInfoConfig) {
bool OclocArgHelper::getHwInfoForProductConfig(uint32_t productConfig, NEO::HardwareInfo &hwInfo, uint64_t hwInfoConfig) {
bool retVal = false;
if (config == AOT::UNKNOWN_ISA) {
if (productConfig == AOT::UNKNOWN_ISA) {
return retVal;
}
for (auto &deviceConfig : deviceMap) {
if (deviceConfig.aotConfig.ProductConfig == config) {
auto deviceAotMap = productConfigHelper->getDeviceAotInfo();
for (auto &deviceConfig : deviceAotMap) {
if (deviceConfig.aotConfig.ProductConfig == productConfig) {
hwInfo = *deviceConfig.hwInfo;
const auto &compilerHwInfoConfig = *NEO::CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
compilerHwInfoConfig.setProductConfigForHwInfo(hwInfo, deviceConfig.aotConfig);
if (hwInfoConfig) {
setHwInfoValuesFromConfig(hwInfoConfig, hwInfo);
}
NEO::hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
if (deviceConfig.deviceIds) {
hwInfo.platform.usDeviceID = deviceConfig.deviceIds->front();
}
const auto &compilerHwInfoConfig = *NEO::CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
compilerHwInfoConfig.setProductConfigForHwInfo(hwInfo, deviceConfig.aotConfig);
hwInfo.platform.usDeviceID = deviceConfig.deviceIds->front();
retVal = true;
return retVal;
}
@@ -194,26 +175,6 @@ bool OclocArgHelper::getHwInfoForProductConfig(uint32_t config, NEO::HardwareInf
return retVal;
}
std::vector<NEO::ConstStringRef> OclocArgHelper::getDeprecatedAcronyms() {
std::vector<NEO::ConstStringRef> prefixes{}, deprecatedAcronyms{}, enabledAcronyms{};
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
if (NEO::hardwarePrefix[j] == nullptr)
continue;
prefixes.push_back(NEO::hardwarePrefix[j]);
}
for (const auto &device : deviceMap) {
enabledAcronyms.insert(enabledAcronyms.end(), device.acronyms.begin(), device.acronyms.end());
}
for (const auto &prefix : prefixes) {
if (std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(prefix.str())))
continue;
deprecatedAcronyms.push_back(prefix);
}
return deprecatedAcronyms;
}
void OclocArgHelper::saveOutput(const std::string &filename, const void *pData, const size_t &dataSize) {
if (outputEnabled()) {
addOutput(filename, pData, dataSize);
@@ -233,138 +194,6 @@ void OclocArgHelper::saveOutput(const std::string &filename, const std::ostream
}
}
std::vector<NEO::ConstStringRef> OclocArgHelper::getAllSupportedProductAcronyms() {
std::vector<NEO::ConstStringRef> allEnabledAcronyms{};
for (const auto &device : deviceMap) {
allEnabledAcronyms.insert(allEnabledAcronyms.end(), device.acronyms.begin(), device.acronyms.end());
}
return allEnabledAcronyms;
}
std::vector<NEO::ConstStringRef> OclocArgHelper::getEnabledProductAcronyms() {
std::vector<NEO::ConstStringRef> enabledAcronyms{};
for (const auto &device : deviceMap) {
if (!device.acronyms.empty()) {
enabledAcronyms.push_back(device.acronyms.front());
}
}
return enabledAcronyms;
}
std::vector<NEO::ConstStringRef> OclocArgHelper::getEnabledReleasesAcronyms() {
std::vector<NEO::ConstStringRef> ret;
for (const auto &[acronym, value] : AOT::releaseAcronyms) {
if (std::any_of(deviceMap.begin(), deviceMap.end(), findRelease(value))) {
ret.push_back(NEO::ConstStringRef(acronym));
}
}
return ret;
}
std::vector<NEO::ConstStringRef> OclocArgHelper::getEnabledFamiliesAcronyms() {
std::vector<NEO::ConstStringRef> enabledAcronyms;
for (const auto &[acronym, value] : AOT::familyAcronyms) {
if (std::any_of(deviceMap.begin(), deviceMap.end(), findFamily(value))) {
enabledAcronyms.push_back(NEO::ConstStringRef(acronym));
}
}
return enabledAcronyms;
}
bool OclocArgHelper::setAcronymForDeviceId(std::string &device) {
auto product = returnProductNameForDevice(std::stoi(device, 0, 16));
if (!product.empty()) {
printf("Auto-detected target based on %s device id: %s\n", device.c_str(), product.c_str());
} else {
printf("Could not determine target based on device id: %s\n", device.c_str());
return false;
}
device = std::move(product);
return true;
}
std::string OclocArgHelper::returnProductNameForDevice(unsigned short deviceId) {
std::string res = "";
for (int i = 0; deviceProductTable[i].deviceId != 0; i++) {
if (deviceProductTable[i].deviceId == deviceId) {
res = deviceProductTable[i].product;
}
}
return res;
}
std::vector<DeviceMapping> &OclocArgHelper::getAllSupportedDeviceConfigs() {
return deviceMap;
}
int OclocArgHelper::parseProductConfigFromString(const std::string &device, size_t begin, size_t end) {
if (begin == end) {
return CONFIG_STATUS::MISMATCHED_VALUE;
}
if (end == std::string::npos) {
if (!std::all_of(device.begin() + begin, device.end(), (::isdigit))) {
return CONFIG_STATUS::MISMATCHED_VALUE;
}
return std::stoi(device.substr(begin, device.size() - begin));
} else {
if (!std::all_of(device.begin() + begin, device.begin() + end, (::isdigit))) {
return CONFIG_STATUS::MISMATCHED_VALUE;
}
return std::stoi(device.substr(begin, end - begin));
}
}
AOT::PRODUCT_CONFIG OclocArgHelper::getProductConfigForVersionValue(const std::string &device) {
auto majorPos = device.find(".");
auto major = parseProductConfigFromString(device, 0, majorPos);
if (major == CONFIG_STATUS::MISMATCHED_VALUE || majorPos == std::string::npos) {
return AOT::UNKNOWN_ISA;
}
auto minorPos = device.find(".", ++majorPos);
auto minor = parseProductConfigFromString(device, majorPos, minorPos);
if (minor == CONFIG_STATUS::MISMATCHED_VALUE || minorPos == std::string::npos) {
return AOT::UNKNOWN_ISA;
}
auto revision = parseProductConfigFromString(device, minorPos + 1, device.size());
if (revision == CONFIG_STATUS::MISMATCHED_VALUE) {
return AOT::UNKNOWN_ISA;
}
AheadOfTimeConfig product = {0};
product.ProductConfigID.Major = major;
product.ProductConfigID.Minor = minor;
product.ProductConfigID.Revision = revision;
return static_cast<AOT::PRODUCT_CONFIG>(product.ProductConfig);
}
bool OclocArgHelper::isRelease(const std::string &device) {
auto release = ProductConfigHelper::returnReleaseForAcronym(device);
if (release == AOT::UNKNOWN_RELEASE) {
return false;
}
return std::any_of(deviceMap.begin(), deviceMap.end(), findRelease(release));
}
bool OclocArgHelper::isFamily(const std::string &device) {
auto family = ProductConfigHelper::returnFamilyForAcronym(device);
if (family == AOT::UNKNOWN_FAMILY) {
return false;
}
return std::any_of(deviceMap.begin(), deviceMap.end(), findFamily(family));
}
bool OclocArgHelper::isProductConfig(const std::string &device) {
auto config = AOT::UNKNOWN_ISA;
if (device.find(".") != std::string::npos) {
config = getProductConfigForVersionValue(device);
} else {
config = ProductConfigHelper::returnProductConfigForAcronym(device);
}
if (config == AOT::UNKNOWN_ISA) {
return false;
}
return std::any_of(deviceMap.begin(), deviceMap.end(), findProductConfig(config));
}
bool OclocArgHelper::areQuotesRequired(const std::string_view &argName) {
return argName == "-options" || argName == "-internal_options";
}

View File

@@ -12,9 +12,6 @@
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/utilities/const_stringref.h"
#include "device_ids_configs.h"
#include "platforms.h"
#include <algorithm>
#include <cctype>
#include <fstream>
@@ -44,24 +41,6 @@ struct Output {
Output(const std::string &name, const void *data, const size_t &size);
};
struct DeviceProduct {
unsigned short deviceId;
std::string product;
};
struct DeviceMapping {
const NEO::HardwareInfo *hwInfo = nullptr;
const std::vector<unsigned short> *deviceIds = nullptr;
AOT::FAMILY family = AOT::UNKNOWN_FAMILY;
AOT::RELEASE release = AOT::UNKNOWN_RELEASE;
AheadOfTimeConfig aotConfig = {0};
std::vector<NEO::ConstStringRef> acronyms{};
bool operator==(const DeviceMapping &rhs) {
return aotConfig.ProductConfig == rhs.aotConfig.ProductConfig && family == rhs.family && release == rhs.release;
}
};
class OclocArgHelper {
protected:
std::vector<Source> inputs, headers;
@@ -72,8 +51,6 @@ class OclocArgHelper {
uint64_t **lenOutputs = nullptr;
bool hasOutput = false;
MessagePrinter messagePrinter;
const std::vector<DeviceProduct> deviceProductTable;
std::vector<DeviceMapping> deviceMap;
void moveOutputs();
Source *findSourceFile(const std::string &filename);
bool sourceFileExists(const std::string &filename) const;
@@ -82,25 +59,6 @@ class OclocArgHelper {
outputs.push_back(new Output(filename, data, size));
}
static bool compareConfigs(DeviceMapping deviceMap0, DeviceMapping deviceMap1) {
return deviceMap0.aotConfig.ProductConfig < deviceMap1.aotConfig.ProductConfig;
}
template <typename EqComparableT>
auto findFamily(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs.family; };
}
template <typename EqComparableT>
auto findRelease(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs.release; };
}
template <typename EqComparableT>
auto findProductConfig(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs.aotConfig.ProductConfig; };
}
public:
OclocArgHelper();
OclocArgHelper(const uint32_t numSources, const uint8_t **dataSources,
@@ -111,21 +69,8 @@ class OclocArgHelper {
uint32_t *numOutputs, uint8_t ***dataOutputs,
uint64_t **lenOutputs, char ***nameOutputs);
virtual ~OclocArgHelper();
enum CONFIG_STATUS {
MISMATCHED_VALUE = -1,
};
MOCKABLE_VIRTUAL bool fileExists(const std::string &filename) const;
int parseProductConfigFromString(const std::string &device, size_t begin, size_t end);
bool getHwInfoForProductConfig(uint32_t config, NEO::HardwareInfo &hwInfo, uint64_t hwInfoConfig);
std::vector<DeviceMapping> &getAllSupportedDeviceConfigs();
std::vector<NEO::ConstStringRef> getEnabledProductAcronyms();
std::vector<NEO::ConstStringRef> getEnabledReleasesAcronyms();
std::vector<NEO::ConstStringRef> getEnabledFamiliesAcronyms();
std::vector<NEO::ConstStringRef> getDeprecatedAcronyms();
std::vector<NEO::ConstStringRef> getAllSupportedProductAcronyms();
std::string getAllSupportedAcronyms();
AOT::PRODUCT_CONFIG getProductConfigForVersionValue(const std::string &device);
bool setAcronymForDeviceId(std::string &device);
bool getHwInfoForProductConfig(uint32_t productConfig, NEO::HardwareInfo &hwInfo, uint64_t hwInfoConfig);
std::vector<std::string> headersToVectorOfStrings();
MOCKABLE_VIRTUAL void readFileToVectorOfStrings(const std::string &filename, std::vector<std::string> &lines);
MOCKABLE_VIRTUAL std::vector<char> readBinaryFile(const std::string &filename);
@@ -183,10 +128,6 @@ class OclocArgHelper {
return os.str();
}
bool isRelease(const std::string &device);
bool isFamily(const std::string &device);
bool isProductConfig(const std::string &device);
bool areQuotesRequired(const std::string_view &argName);
std::string returnProductNameForDevice(unsigned short deviceId);
std::unique_ptr<ProductConfigHelper> productConfigHelper;
};

View File

@@ -17,6 +17,7 @@
#include "shared/source/helpers/product_config_helper.h"
#include "igfxfmid.h"
#include "platforms.h"
#include <cstddef>
#include <cstdint>
@@ -35,8 +36,8 @@ bool requestedFatBinary(const std::vector<std::string> &args, OclocArgHelper *he
auto retVal = deviceArg.contains("*");
retVal |= deviceArg.contains(":");
retVal |= deviceArg.contains(",");
retVal |= helper->isFamily(deviceName);
retVal |= helper->isRelease(deviceName);
retVal |= helper->productConfigHelper->isFamily(deviceName);
retVal |= helper->productConfigHelper->isRelease(deviceName);
return retVal;
}
@@ -46,7 +47,7 @@ bool requestedFatBinary(const std::vector<std::string> &args, OclocArgHelper *he
template <>
void getProductsAcronymsForTarget<AOT::FAMILY>(std::vector<NEO::ConstStringRef> &out, AOT::FAMILY target, OclocArgHelper *argHelper) {
auto allSuppportedProducts = argHelper->getAllSupportedDeviceConfigs();
auto allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo();
for (const auto &device : allSuppportedProducts) {
if (device.family == target && !device.acronyms.empty()) {
if (std::find(out.begin(), out.end(), device.acronyms.front()) == out.end()) {
@@ -58,7 +59,7 @@ void getProductsAcronymsForTarget<AOT::FAMILY>(std::vector<NEO::ConstStringRef>
template <>
void getProductsAcronymsForTarget<AOT::RELEASE>(std::vector<NEO::ConstStringRef> &out, AOT::RELEASE target, OclocArgHelper *argHelper) {
auto allSuppportedProducts = argHelper->getAllSupportedDeviceConfigs();
auto allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo();
for (const auto &device : allSuppportedProducts) {
if (device.release == target && !device.acronyms.empty()) {
if (std::find(out.begin(), out.end(), device.acronyms.front()) == out.end()) {
@@ -82,7 +83,7 @@ void getProductsForTargetRange(T targetFrom, T targetTo, std::vector<ConstString
void getProductsForRange(unsigned int productFrom, unsigned int productTo, std::vector<ConstStringRef> &out,
OclocArgHelper *argHelper) {
auto allSuppportedProducts = argHelper->getAllSupportedDeviceConfigs();
auto allSuppportedProducts = argHelper->productConfigHelper->getDeviceAotInfo();
for (const auto &device : allSuppportedProducts) {
auto validAcronym = device.aotConfig.ProductConfig >= productFrom;
@@ -102,19 +103,19 @@ std::vector<ConstStringRef> getProductForClosedRange(ConstStringRef rangeFrom, C
ProductConfigHelper::adjustDeviceName(rangeToStr);
ProductConfigHelper::adjustDeviceName(rangeFromStr);
if (argHelper->isFamily(rangeFromStr) && argHelper->isFamily(rangeToStr)) {
auto familyFrom = ProductConfigHelper::returnFamilyForAcronym(rangeFromStr);
auto familyTo = ProductConfigHelper::returnFamilyForAcronym(rangeToStr);
if (argHelper->productConfigHelper->isFamily(rangeFromStr) && argHelper->productConfigHelper->isFamily(rangeToStr)) {
auto familyFrom = ProductConfigHelper::getFamilyForAcronym(rangeFromStr);
auto familyTo = ProductConfigHelper::getFamilyForAcronym(rangeToStr);
getProductsForTargetRange(familyFrom, familyTo, requestedProducts, argHelper);
} else if (argHelper->isRelease(rangeFromStr) && argHelper->isRelease(rangeToStr)) {
auto releaseFrom = ProductConfigHelper::returnReleaseForAcronym(rangeFromStr);
auto releaseTo = ProductConfigHelper::returnReleaseForAcronym(rangeToStr);
} else if (argHelper->productConfigHelper->isRelease(rangeFromStr) && argHelper->productConfigHelper->isRelease(rangeToStr)) {
auto releaseFrom = ProductConfigHelper::getReleaseForAcronym(rangeFromStr);
auto releaseTo = ProductConfigHelper::getReleaseForAcronym(rangeToStr);
getProductsForTargetRange(releaseFrom, releaseTo, requestedProducts, argHelper);
} else if (argHelper->isProductConfig(rangeFromStr) && argHelper->isProductConfig(rangeToStr)) {
unsigned int productConfigFrom = ProductConfigHelper::returnProductConfigForAcronym(rangeFromStr);
unsigned int productConfigTo = ProductConfigHelper::returnProductConfigForAcronym(rangeToStr);
} else if (argHelper->productConfigHelper->isProductConfig(rangeFromStr) && argHelper->productConfigHelper->isProductConfig(rangeToStr)) {
unsigned int productConfigFrom = ProductConfigHelper::getProductConfigForAcronym(rangeFromStr);
unsigned int productConfigTo = ProductConfigHelper::getProductConfigForAcronym(rangeToStr);
if (productConfigFrom > productConfigTo) {
std::swap(productConfigFrom, productConfigTo);
}
@@ -133,8 +134,8 @@ std::vector<ConstStringRef> getProductForOpenRange(ConstStringRef openRange, Ocl
auto openRangeStr = openRange.str();
ProductConfigHelper::adjustDeviceName(openRangeStr);
if (argHelper->isFamily(openRangeStr)) {
auto family = ProductConfigHelper::returnFamilyForAcronym(openRangeStr);
if (argHelper->productConfigHelper->isFamily(openRangeStr)) {
auto family = ProductConfigHelper::getFamilyForAcronym(openRangeStr);
if (rangeTo) {
unsigned int familyFrom = AOT::UNKNOWN_FAMILY;
++familyFrom;
@@ -144,8 +145,8 @@ std::vector<ConstStringRef> getProductForOpenRange(ConstStringRef openRange, Ocl
--familyTo;
getProductsForTargetRange(family, static_cast<AOT::FAMILY>(familyTo), requestedProducts, argHelper);
}
} else if (argHelper->isRelease(openRangeStr)) {
auto release = ProductConfigHelper::returnReleaseForAcronym(openRangeStr);
} else if (argHelper->productConfigHelper->isRelease(openRangeStr)) {
auto release = ProductConfigHelper::getReleaseForAcronym(openRangeStr);
if (rangeTo) {
unsigned int releaseFrom = AOT::UNKNOWN_FAMILY;
++releaseFrom;
@@ -155,8 +156,8 @@ std::vector<ConstStringRef> getProductForOpenRange(ConstStringRef openRange, Ocl
--releaseTo;
getProductsForTargetRange(release, static_cast<AOT::RELEASE>(releaseTo), requestedProducts, argHelper);
}
} else if (argHelper->isProductConfig(openRangeStr)) {
auto product = ProductConfigHelper::returnProductConfigForAcronym(openRangeStr);
} else if (argHelper->productConfigHelper->isProductConfig(openRangeStr)) {
auto product = ProductConfigHelper::getProductConfigForAcronym(openRangeStr);
if (rangeTo) {
unsigned int productFrom = AOT::UNKNOWN_ISA;
++productFrom;
@@ -176,13 +177,13 @@ std::vector<ConstStringRef> getProductForSpecificTarget(CompilerOptions::Tokeniz
auto targetStr = target.str();
ProductConfigHelper::adjustDeviceName(targetStr);
if (argHelper->isFamily(targetStr)) {
auto family = ProductConfigHelper::returnFamilyForAcronym(targetStr);
if (argHelper->productConfigHelper->isFamily(targetStr)) {
auto family = ProductConfigHelper::getFamilyForAcronym(targetStr);
getProductsAcronymsForTarget(requestedConfigs, family, argHelper);
} else if (argHelper->isRelease(targetStr)) {
auto release = ProductConfigHelper::returnReleaseForAcronym(targetStr);
} else if (argHelper->productConfigHelper->isRelease(targetStr)) {
auto release = ProductConfigHelper::getReleaseForAcronym(targetStr);
getProductsAcronymsForTarget(requestedConfigs, release, argHelper);
} else if (argHelper->isProductConfig(targetStr)) {
} else if (argHelper->productConfigHelper->isProductConfig(targetStr)) {
requestedConfigs.push_back(target);
} else {
argHelper->printf("Failed to parse target : %s - invalid device:\n", target.str().c_str());
@@ -195,7 +196,7 @@ std::vector<ConstStringRef> getProductForSpecificTarget(CompilerOptions::Tokeniz
std::vector<ConstStringRef> getTargetProductsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper) {
std::vector<ConstStringRef> retVal;
if (deviceArg == "*") {
return argHelper->getEnabledProductAcronyms();
return argHelper->productConfigHelper->getRepresentativeProductAcronyms();
} else {
auto sets = CompilerOptions::tokenize(deviceArg, ',');
if (sets[0].contains(":")) {
@@ -247,8 +248,9 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
if (product.find(".") != std::string::npos) {
productConfig = product;
} else {
productConfig = ProductConfigHelper::parseMajorMinorRevisionValue(ProductConfigHelper::returnProductConfigForAcronym(product));
productConfig = ProductConfigHelper::parseMajorMinorRevisionValue(ProductConfigHelper::getProductConfigForAcronym(product));
}
fatbinary.appendFileEntry(pointerSize + "." + productConfig, pCompiler->getPackedDeviceBinaryOutput());
return retVal;
}

View File

@@ -35,6 +35,7 @@
#include "ocl_igc_interface/fcl_ocl_device_ctx.h"
#include "ocl_igc_interface/igc_ocl_device_ctx.h"
#include "ocl_igc_interface/platform_helper.h"
#include "platforms.h"
#include <algorithm>
#include <iomanip>
@@ -73,14 +74,14 @@ std::string convertToPascalCase(const std::string &inString) {
}
std::string getDeprecatedDevices(OclocArgHelper *helper) {
auto acronyms = helper->getDeprecatedAcronyms();
auto acronyms = helper->productConfigHelper->getDeprecatedAcronyms();
return helper->createStringForArgs(acronyms);
}
std::string getSupportedDevices(OclocArgHelper *helper) {
auto devices = helper->getAllSupportedProductAcronyms();
auto families = helper->getEnabledFamiliesAcronyms();
auto releases = helper->getEnabledReleasesAcronyms();
auto devices = helper->productConfigHelper->getAllProductAcronyms();
auto families = helper->productConfigHelper->getFamiliesAcronyms();
auto releases = helper->productConfigHelper->getReleasesAcronyms();
auto familiesAndReleases = helper->getArgsWithoutDuplicate(families, releases);
return helper->createStringForArgs(devices, familiesAndReleases);
@@ -162,25 +163,25 @@ int OfflineCompiler::queryAcronymIds(size_t numArgs, const std::vector<std::stri
std::string queryAcronym = allArgs[2];
ProductConfigHelper::adjustDeviceName(queryAcronym);
auto enabledDevices = helper->getAllSupportedDeviceConfigs();
auto enabledDevices = helper->productConfigHelper->getDeviceAotInfo();
std::vector<std::string> matchedVersions{};
if (helper->isFamily(queryAcronym)) {
auto family = ProductConfigHelper::returnFamilyForAcronym(queryAcronym);
if (helper->productConfigHelper->isFamily(queryAcronym)) {
auto family = ProductConfigHelper::getFamilyForAcronym(queryAcronym);
for (const auto &device : enabledDevices) {
if (device.family == family) {
matchedVersions.push_back(ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig));
}
}
} else if (helper->isRelease(queryAcronym)) {
auto release = ProductConfigHelper::returnReleaseForAcronym(queryAcronym);
} else if (helper->productConfigHelper->isRelease(queryAcronym)) {
auto release = ProductConfigHelper::getReleaseForAcronym(queryAcronym);
for (const auto &device : enabledDevices) {
if (device.release == release) {
matchedVersions.push_back(ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig));
}
}
} else if (helper->isProductConfig(queryAcronym)) {
auto product = ProductConfigHelper::returnProductConfigForAcronym(queryAcronym);
} else if (helper->productConfigHelper->isProductConfig(queryAcronym)) {
auto product = ProductConfigHelper::getProductConfigForAcronym(queryAcronym);
for (const auto &device : enabledDevices) {
if (device.aotConfig.ProductConfig == product) {
matchedVersions.push_back(ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig));
@@ -402,7 +403,7 @@ void OfflineCompiler::setFamilyType() {
familyNameWithType.append(hwInfo.capabilityTable.platformType);
}
int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId) {
int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceName) {
std::vector<PRODUCT_FAMILY> allSupportedProduct{ALL_SUPPORTED_PRODUCT_FAMILIES};
std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower);
@@ -412,9 +413,7 @@ int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceNam
if (revisionId != -1) {
hwInfo.platform.usRevId = revisionId;
}
if (deviceId != -1) {
hwInfo.platform.usDeviceID = deviceId;
}
uint64_t config = hwInfoConfig ? hwInfoConfig : defaultHardwareInfoConfigTable[hwInfo.platform.eProductFamily];
setHwInfoValuesFromConfig(config, hwInfo);
hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
@@ -427,30 +426,39 @@ int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceNam
}
int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) {
AOT::PRODUCT_CONFIG config = AOT::UNKNOWN_ISA;
AOT::PRODUCT_CONFIG productConfig = AOT::UNKNOWN_ISA;
ProductConfigHelper::adjustDeviceName(deviceName);
const char hexPrefix = 2;
int deviceId = -1;
if (deviceName.find(".") != std::string::npos) {
config = argHelper->getProductConfigForVersionValue(deviceName);
if (config == AOT::UNKNOWN_ISA) {
argHelper->printf("Could not determine device target: %s\n", deviceName.c_str());
}
} else if (argHelper->isProductConfig(deviceName)) {
config = ProductConfigHelper::returnProductConfigForAcronym(deviceName);
productConfig = argHelper->productConfigHelper->getProductConfigForVersionValue(deviceName);
} else if (deviceName.substr(0, hexPrefix) == "0x" && std::all_of(deviceName.begin() + hexPrefix, deviceName.end(), (::isxdigit))) {
deviceId = std::stoi(deviceName, 0, 16);
productConfig = argHelper->productConfigHelper->getProductConfigForDeviceId(deviceId);
} else if (argHelper->productConfigHelper->isProductConfig(deviceName)) {
productConfig = ProductConfigHelper::getProductConfigForAcronym(deviceName);
} else {
return INVALID_DEVICE;
}
if (config != AOT::UNKNOWN_ISA) {
if (argHelper->getHwInfoForProductConfig(config, hwInfo, hwInfoConfig)) {
if (revisionId != -1) {
hwInfo.platform.usRevId = revisionId;
}
deviceConfig = config;
setFamilyType();
return SUCCESS;
if (argHelper->getHwInfoForProductConfig(productConfig, hwInfo, hwInfoConfig)) {
if (revisionId != -1) {
hwInfo.platform.usRevId = revisionId;
}
argHelper->printf("Could not determine target based on product config: %s\n", deviceName.c_str());
if (deviceId != -1) {
auto product = argHelper->productConfigHelper->getAcronymForProductConfig(productConfig);
argHelper->printf("Auto-detected target based on %s device id: %s\n", deviceName.c_str(), product.c_str());
hwInfo.platform.usDeviceID = deviceId;
}
deviceConfig = productConfig;
setFamilyType();
return SUCCESS;
} else {
argHelper->printf("Could not determine device target: %s\n", deviceName.c_str());
return INVALID_DEVICE;
}
return INVALID_DEVICE;
}
int OfflineCompiler::initHardwareInfo(std::string deviceName) {
@@ -461,21 +469,12 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
overridePlatformName(deviceName);
const char hexPrefix = 2;
int deviceId = -1;
retVal = initHardwareInfoForProductConfig(deviceName);
if (retVal == SUCCESS) {
return retVal;
}
if (deviceName.substr(0, hexPrefix) == "0x" && std::all_of(deviceName.begin() + hexPrefix, deviceName.end(), (::isxdigit))) {
deviceId = std::stoi(deviceName, 0, 16);
if (!argHelper->setAcronymForDeviceId(deviceName)) {
return retVal;
}
}
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName, deviceId);
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName);
return retVal;
}

View File

@@ -100,7 +100,7 @@ All supported acronyms: %s.
void setFamilyType();
int initHardwareInfo(std::string deviceName);
int initHardwareInfoForProductConfig(std::string deviceName);
int initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId);
int initHardwareInfoForDeprecatedAcronyms(std::string deviceName);
std::string getStringWithinDelimiters(const std::string &src);
int initialize(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles);
@@ -131,7 +131,7 @@ All supported acronyms: %s.
void enforceFormat(std::string &format);
HardwareInfo hwInfo;
AOT::PRODUCT_CONFIG deviceConfig = AOT::UNKNOWN_ISA;
AOT::PRODUCT_CONFIG deviceConfig = {};
std::string deviceName;
std::string familyNameWithType;
std::string inputFile;

View File

@@ -7,86 +7,90 @@
#if SUPPORT_XE_HPC_CORE
#ifdef SUPPORT_PVC
DEVICE_CONFIG_IDS(PVC_XL_A0, PvcHwConfig, PVC_XL_IDS, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG_IDS(PVC_XL_A0P, PvcHwConfig, PVC_XL_IDS, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG_IDS(PVC_XT_A0, PvcHwConfig, PVC_XT_IDS, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG_IDS(PVC_XT_B0, PvcHwConfig, PVC_XT_IDS, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG_IDS(PVC_XT_B1, PvcHwConfig, PVC_XT_IDS, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG_IDS(PVC_XT_C0, PvcHwConfig, PVC_XT_IDS, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG(PVC_XL_A0, PvcHwConfig, pvcXlDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG(PVC_XL_A0P, PvcHwConfig, pvcXlDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG(PVC_XT_A0, PvcHwConfig, pvcXtDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG(PVC_XT_B0, PvcHwConfig, pvcXtDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG(PVC_XT_B1, PvcHwConfig, pvcXtDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
DEVICE_CONFIG(PVC_XT_C0, PvcHwConfig, pvcXtDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
#endif
#endif
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
DEVICE_CONFIG_IDS(DG2_G10_A0, Dg2HwConfig, DG2_G10_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG_IDS(DG2_G10_A1, Dg2HwConfig, DG2_G10_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG_IDS(DG2_G10_B0, Dg2HwConfig, DG2_G10_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG_IDS(DG2_G10_C0, Dg2HwConfig, DG2_G10_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG_IDS(DG2_G11_A0, Dg2HwConfig, DG2_G11_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG_IDS(DG2_G11_B0, Dg2HwConfig, DG2_G11_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG_IDS(DG2_G11_B1, Dg2HwConfig, DG2_G11_IDS, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G10_A0, Dg2HwConfig, dg2G10DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G10_A1, Dg2HwConfig, dg2G10DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G10_B0, Dg2HwConfig, dg2G10DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G10_C0, Dg2HwConfig, dg2G10DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G11_A0, Dg2HwConfig, dg2G11DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G11_B0, Dg2HwConfig, dg2G11DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G11_B1, Dg2HwConfig, dg2G11DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G12_A0, Dg2HwConfig, dg2G12DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
#endif
#endif
#ifdef SUPPORT_XE_HP_CORE
#ifdef SUPPORT_XE_HP_SDV
DEVICE_CONFIG(XEHP_SDV, XehpSdvHwConfig, XE_FAMILY, XE_HP_RELEASE)
DEVICE_CONFIG(XEHP_SDV, XehpSdvHwConfig, xeHpSdvDeviceIds, XE_FAMILY, XE_HP_RELEASE)
#endif
#endif
#ifdef SUPPORT_GEN12LP
#ifdef SUPPORT_TGLLP
DEVICE_CONFIG(TGL, TgllpHw1x6x16, GEN12LP_FAMILY, GEN12LP_RELEASE)
DEVICE_CONFIG(TGL, TgllpHw1x6x16, tgllpDeviceIds, GEN12LP_FAMILY, GEN12LP_RELEASE)
#endif
#ifdef SUPPORT_DG1
DEVICE_CONFIG(DG1, Dg1HwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
DEVICE_CONFIG(DG1, Dg1HwConfig, dg1DeviceIds, GEN12LP_FAMILY, GEN12LP_RELEASE)
#endif
#ifdef SUPPORT_RKL
DEVICE_CONFIG(RKL, RklHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
DEVICE_CONFIG(RKL, RklHwConfig, rklDeviceIds, GEN12LP_FAMILY, GEN12LP_RELEASE)
#endif
#ifdef SUPPORT_ADLS
DEVICE_CONFIG(ADL_S, AdlsHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
DEVICE_CONFIG(ADL_S, AdlsHwConfig, adlsDeviceIds, GEN12LP_FAMILY, GEN12LP_RELEASE)
#endif
#ifdef SUPPORT_ADLP
DEVICE_CONFIG(ADL_P, AdlpHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
DEVICE_CONFIG(ADL_P, AdlpHwConfig, adlpDeviceIds, GEN12LP_FAMILY, GEN12LP_RELEASE)
#endif
#ifdef SUPPORT_ADLN
DEVICE_CONFIG(ADL_N, AdlnHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
DEVICE_CONFIG(ADL_N, AdlnHwConfig, adlnDeviceIds, GEN12LP_FAMILY, GEN12LP_RELEASE)
#endif
#endif
#ifdef SUPPORT_GEN11
#ifdef SUPPORT_ICLLP
DEVICE_CONFIG(ICL, IcllpHw1x8x8, GEN11_FAMILY, GEN11_RELEASE)
DEVICE_CONFIG(ICL, IcllpHw1x8x8, icllpDeviceIds, GEN11_FAMILY, GEN11_RELEASE)
#endif
#ifdef SUPPORT_EHL
DEVICE_CONFIG(EHL, EhlHwConfig, GEN11_FAMILY, GEN11_RELEASE)
DEVICE_CONFIG(EHL, EhlHwConfig, ehlDeviceIds, GEN11_FAMILY, GEN11_RELEASE)
#endif
#ifdef SUPPORT_LKF
DEVICE_CONFIG(LKF, LkfHw1x8x8, GEN11_FAMILY, GEN11_RELEASE)
DEVICE_CONFIG(LKF, LkfHw1x8x8, lkfDeviceIds, GEN11_FAMILY, GEN11_RELEASE)
#endif
#endif
#ifdef SUPPORT_GEN9
#ifdef SUPPORT_SKL
DEVICE_CONFIG(SKL, SklHw1x3x8, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(SKL, SklHw1x3x8, sklDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
#endif
#ifdef SUPPORT_KBL
DEVICE_CONFIG(KBL, KblHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(KBL, KblHw1x3x6, kblDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(AML, KblHw1x3x6, amlDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
#endif
#ifdef SUPPORT_CFL
DEVICE_CONFIG(CFL, CflHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(CFL, CflHw1x3x6, cflDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(CML, CflHw1x3x6, cmlDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(WHL, CflHw1x3x6, whlDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
#endif
#ifdef SUPPORT_GLK
DEVICE_CONFIG(GLK, GlkHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(GLK, GlkHw1x3x6, glkDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
#endif
#ifdef SUPPORT_BXT
DEVICE_CONFIG(APL, BxtHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
DEVICE_CONFIG(APL, BxtHw1x3x6, bxtDeviceIds, GEN9_FAMILY, GEN9_RELEASE)
#endif
#endif
#ifdef SUPPORT_GEN8
DEVICE_CONFIG(BDW, BdwHw1x3x8, GEN8_FAMILY, GEN8_RELEASE)
DEVICE_CONFIG(BDW, BdwHw1x3x8, bdwDeviceIds, GEN8_FAMILY, GEN8_RELEASE)
#endif

View File

@@ -121,6 +121,16 @@ macro(macro_for_each_platform)
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${PATH_TO_CORE}${PLATFORM_IT_LOWER}/device_ids_configs_${PLATFORM_IT_LOWER}.h)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${PATH_TO_CORE}${PLATFORM_IT_LOWER}/definitions/device_ids_configs_${PLATFORM_IT_LOWER}_base.h)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${PATH_TO_CORE}${PLATFORM_IT_LOWER}/definitions${BRANCH_DIR_SUFFIX}device_ids_configs_${PLATFORM_IT_LOWER}.h)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> ehlDeviceIds{
0x4500,
0x4541,
0x4551,
0x4571,
0x4555,
0x4E51,
0x4E61,
0x4E71,
0x4E55};
} // namespace NEO

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> icllpDeviceIds{
0xFF05,
0x8A56,
0x8A58,
0x8A5C,
0x8A5A,
0x8A50,
0x8A52,
0x8A51};
} // namespace NEO

View File

@@ -10,6 +10,5 @@
#include <vector>
namespace NEO {
static const std::vector<unsigned short> PVC_XT_IDS{0x0BD5, 0x0BD6, 0x0BD8};
static const std::vector<unsigned short> PVC_XL_IDS{0x0BD0};
static const std::vector<unsigned short> lkfDeviceIds{0x9840};
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> adlnDeviceIds{0x46D0};
} // namespace NEO

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> adlpDeviceIds{
0x46A0,
0x46B0,
0x46A1,
0x46A2,
0x46A3,
0x46A6,
0x46A8,
0x46AA,
0x462A,
0x4626,
0x4628,
0x46B1,
0x46B2,
0x46B3,
0x46C0,
0x46C1,
0x46C2,
0x46C3,
0xA7A0,
0xA720,
0xA7A8,
0xA7A1,
0xA721,
0xA7A9};
} // namespace NEO

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> adlsDeviceIds{
0x4680,
0x4682,
0x4688,
0x468A,
0x4690,
0x4692,
0x4693,
0xA780,
0xA781,
0xA782,
0xA783,
0xA788,
0xA789};
} // namespace NEO

View File

@@ -0,0 +1,18 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> dg1DeviceIds{
0x4905,
0x4906,
0x4907,
0x4908};
} // namespace NEO

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> rklDeviceIds{
0x4C80,
0x4C8A,
0x4C8B,
0x4C8C,
0x4C90,
0x4C9A};
} // namespace NEO

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> tgllpDeviceIds{
0xFF20,
0x9A49,
0x9A40,
0x9A59,
0x9A60,
0x9A68,
0x9A70,
0x9A78};
} // namespace NEO

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> bdwDeviceIds{
0x1602,
0x160A,
0x1606,
0x160E,
0x160D,
0x1612,
0x161A,
0x1616,
0x161E,
0x161D,
0x1622,
0x162A,
0x1626,
0x162B,
0x162E,
0x162D};
} // namespace NEO

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> bxtDeviceIds{
0x9906,
0x9907,
0x0A84,
0x5A84,
0x5A85,
0x1A85,
0x1A84,
0x9908};
} // namespace NEO

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> cflDeviceIds{
0x3E90,
0x3E93,
0x3E99,
0x3E92,
0x3E9B,
0x3E94,
0x3E91,
0x3E96,
0x3E9A,
0x3EA9,
0x3E98,
0x3E95,
0x3EA6,
0x3EA7,
0x3EA8,
0x3EA5,
0x9BAB,
0x9BA0,
0x9BC0};
static const std::vector<unsigned short> whlDeviceIds{
0x3EA1,
0x3EA3,
0x3EA4,
0x3EA0,
0x3EA2};
static const std::vector<unsigned short> cmlDeviceIds{
0x9B21,
0x9B41,
0x9BA2,
0x9BA4,
0x9BA5,
0x9BA8,
0x9BAA,
0x9BAC,
0x9BC2,
0x9BC4,
0x9BC5,
0x9BC6,
0x9BC8,
0x9BCA,
0x9BCB,
0x9BCC,
0x9BE6,
0x9BF6};
} // namespace NEO

View File

@@ -5,7 +5,27 @@
*
*/
#include "shared/source/gen9/cfl/device_ids_configs_cfl.h"
#include "platforms.h"
#include <algorithm>
namespace NEO {
template <>
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return AOT::CFL;
}
auto deviceId = hwInfo.platform.usDeviceID;
bool isCfl = (std::find(cflDeviceIds.begin(), cflDeviceIds.end(), deviceId) != cflDeviceIds.end());
bool isWhl = (std::find(whlDeviceIds.begin(), whlDeviceIds.end(), deviceId) != whlDeviceIds.end());
bool isCml = (std::find(cmlDeviceIds.begin(), cmlDeviceIds.end(), deviceId) != cmlDeviceIds.end());
if (isCfl) {
return AOT::CFL;
} else if (isCml) {
return AOT::CML;
} else if (isWhl) {
return AOT::WHL;
}
return AOT::UNKNOWN_ISA;
}
} // namespace NEO

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> glkDeviceIds{
0x3184,
0x3185};
} // namespace NEO

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> amlDeviceIds{0x591C};
static const std::vector<unsigned short> kblDeviceIds{
0x5902,
0x590B,
0x590A,
0x5906,
0x590E,
0x5908,
0x5913,
0x5915,
0x5912,
0x591B,
0x5917,
0x591A,
0x5916,
0x591E,
0x591D,
0x5921,
0x5926,
0x5927,
0x592B,
0x592A,
0x5923,
0x5932,
0x593B,
0x593A,
0x593D};
} // namespace NEO

View File

@@ -5,7 +5,24 @@
*
*/
#include "shared/source/gen9/kbl/device_ids_configs_kbl.h"
#include "platforms.h"
#include <algorithm>
namespace NEO {
template <>
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return AOT::KBL;
}
auto deviceId = hwInfo.platform.usDeviceID;
bool isKbl = (std::find(kblDeviceIds.begin(), kblDeviceIds.end(), deviceId) != kblDeviceIds.end());
bool isAml = (std::find(amlDeviceIds.begin(), amlDeviceIds.end(), deviceId) != amlDeviceIds.end());
if (isKbl) {
return AOT::KBL;
} else if (isAml) {
return AOT::AML;
}
return AOT::UNKNOWN_ISA;
}
} // namespace NEO

View File

@@ -11,13 +11,10 @@
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
#include "platforms.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
#include "shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl"
namespace NEO {
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {

View File

@@ -11,13 +11,10 @@
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
#include "platforms.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_KABYLAKE;
#include "shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl"
namespace NEO {
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> sklDeviceIds{
0x1902,
0x190B,
0x190A,
0x1906,
0x190E,
0x1917,
0x1913,
0X1915,
0x1912,
0x191B,
0x191A,
0x1916,
0x191E,
0x191D,
0x1921,
0x9905,
0x192B,
0x192D,
0x192A,
0x1923,
0x1926,
0x1927,
0x1932,
0x193B,
0x193A,
0x193D};
} // namespace NEO

View File

@@ -10,12 +10,10 @@
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
#include "platforms.h"
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
#include "shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
#include "shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl"
template class HwInfoConfigHw<gfxProduct>;

View File

@@ -10,13 +10,9 @@
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
#include "platforms.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_KABYLAKE;
#include "shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl"
namespace NEO {
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -7,14 +7,4 @@
#pragma once
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
#include "shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2.h"
#endif
#endif
#if SUPPORT_XE_HPC_CORE
#ifdef SUPPORT_PVC
#include "shared/source/xe_hpc_core/pvc/definitions/device_ids_configs_pvc.h"
#endif
#endif
#include "shared/source/helpers/definitions/device_ids_configs_base.h"

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
#include "device_ids_configs_dg2.h"
#endif
#endif
#if SUPPORT_XE_HPC_CORE
#ifdef SUPPORT_PVC
#include "shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h"
#endif
#endif
#ifdef SUPPORT_XE_HP_CORE
#ifdef SUPPORT_XE_HP_SDV
#include "shared/source/xe_hp_core/xe_hp_sdv/device_ids_configs_xe_hp_sdv.h"
#endif
#endif
#ifdef SUPPORT_GEN12LP
#ifdef SUPPORT_TGLLP
#include "shared/source/gen12lp/tgllp/device_ids_configs_tgllp.h"
#endif
#ifdef SUPPORT_DG1
#include "shared/source/gen12lp/dg1/device_ids_configs_dg1.h"
#endif
#ifdef SUPPORT_RKL
#include "shared/source/gen12lp/rkl/device_ids_configs_rkl.h"
#endif
#ifdef SUPPORT_ADLS
#include "shared/source/gen12lp/adls/device_ids_configs_adls.h"
#endif
#ifdef SUPPORT_ADLP
#include "shared/source/gen12lp/adlp/device_ids_configs_adlp.h"
#endif
#ifdef SUPPORT_ADLN
#include "shared/source/gen12lp/adln/device_ids_configs_adln.h"
#endif
#endif
#ifdef SUPPORT_GEN11
#ifdef SUPPORT_ICLLP
#include "shared/source/gen11/icllp/device_ids_configs_icllp.h"
#endif
#ifdef SUPPORT_EHL
#include "shared/source/gen11/ehl/device_ids_configs_ehl.h"
#endif
#ifdef SUPPORT_LKF
#include "shared/source/gen11/lkf/device_ids_configs_lkf.h"
#endif
#endif
#ifdef SUPPORT_GEN9
#ifdef SUPPORT_SKL
#include "shared/source/gen9/skl/device_ids_configs_skl.h"
#endif
#ifdef SUPPORT_KBL
#include "shared/source/gen9/kbl/device_ids_configs_kbl.h"
#endif
#ifdef SUPPORT_CFL
#include "shared/source/gen9/cfl/device_ids_configs_cfl.h"
#endif
#ifdef SUPPORT_GLK
#include "shared/source/gen9/glk/device_ids_configs_glk.h"
#endif
#ifdef SUPPORT_BXT
#include "shared/source/gen9/bxt/device_ids_configs_bxt.h"
#endif
#endif
#ifdef SUPPORT_GEN8
#include "shared/source/gen8/bdw/device_ids_configs_bdw.h"
#endif

View File

@@ -7,10 +7,46 @@
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "device_ids_configs.h"
#include "hw_cmds.h"
#include "platforms.h"
#include <algorithm>
ProductConfigHelper::ProductConfigHelper() : deviceAotInfo({
#define DEVICE_CONFIG(productConfig, hwConfig, deviceIds, family, release) {{AOT::productConfig}, &NEO::hwConfig::hwInfo, &NEO::deviceIds, AOT::family, AOT::release},
#include "product_config.inl"
#undef DEVICE_CONFIG
}) {
std::sort(deviceAotInfo.begin(), deviceAotInfo.end(), compareConfigs);
for (auto &device : deviceAotInfo) {
for (const auto &[acronym, value] : AOT::productConfigAcronyms) {
if (value == device.aotConfig.ProductConfig) {
device.acronyms.push_back(NEO::ConstStringRef(acronym));
}
}
}
}
bool ProductConfigHelper::compareConfigs(DeviceAotInfo deviceAotInfo0, DeviceAotInfo deviceAotInfo1) {
return deviceAotInfo0.aotConfig.ProductConfig < deviceAotInfo1.aotConfig.ProductConfig;
}
AOT::PRODUCT_CONFIG ProductConfigHelper::getProductConfigForDeviceId(unsigned short deviceId) {
for (const auto &device : deviceAotInfo) {
if (std::find(device.deviceIds->begin(), device.deviceIds->end(), deviceId) != device.deviceIds->end()) {
return static_cast<AOT::PRODUCT_CONFIG>(device.aotConfig.ProductConfig);
}
}
return AOT::UNKNOWN_ISA;
}
std::vector<DeviceAotInfo> &ProductConfigHelper::getDeviceAotInfo() {
return deviceAotInfo;
}
void ProductConfigHelper::adjustDeviceName(std::string &device) {
std::transform(device.begin(), device.end(), device.begin(), ::tolower);
@@ -25,27 +61,6 @@ void ProductConfigHelper::adjustDeviceName(std::string &device) {
}
}
AOT::RELEASE ProductConfigHelper::returnReleaseForAcronym(const std::string &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 = 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 = std::find_if(AOT::productConfigAcronyms.begin(), AOT::productConfigAcronyms.end(), findMapAcronymWithoutDash(device));
if (it == AOT::productConfigAcronyms.end())
return AOT::UNKNOWN_ISA;
return it->second;
}
NEO::ConstStringRef ProductConfigHelper::getAcronymForAFamily(AOT::FAMILY family) {
for (const auto &[acronym, value] : AOT::familyAcronyms) {
if (value == family) {
@@ -55,6 +70,126 @@ NEO::ConstStringRef ProductConfigHelper::getAcronymForAFamily(AOT::FAMILY family
return {};
}
const std::string ProductConfigHelper::getAcronymForProductConfig(AOT::PRODUCT_CONFIG config) {
auto it = std::find_if(deviceAotInfo.begin(), deviceAotInfo.end(), findProductConfig(config));
if (it == deviceAotInfo.end()) {
return {};
}
return it->acronyms.empty() ? parseMajorMinorRevisionValue(it->aotConfig) : it->acronyms.front().str();
}
AOT::RELEASE ProductConfigHelper::getReleaseForAcronym(const std::string &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::getFamilyForAcronym(const std::string &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::getProductConfigForAcronym(const std::string &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;
}
bool ProductConfigHelper::isRelease(const std::string &device) {
auto release = getReleaseForAcronym(device);
if (release == AOT::UNKNOWN_RELEASE) {
return false;
}
return std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findRelease(release));
}
bool ProductConfigHelper::isFamily(const std::string &device) {
auto family = getFamilyForAcronym(device);
if (family == AOT::UNKNOWN_FAMILY) {
return false;
}
return std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findFamily(family));
}
bool ProductConfigHelper::isProductConfig(const std::string &device) {
auto config = AOT::UNKNOWN_ISA;
if (device.find(".") != std::string::npos) {
config = getProductConfigForVersionValue(device);
} else {
config = getProductConfigForAcronym(device);
}
if (config == AOT::UNKNOWN_ISA) {
return false;
}
return std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findProductConfig(config));
}
std::vector<NEO::ConstStringRef> ProductConfigHelper::getRepresentativeProductAcronyms() {
std::vector<NEO::ConstStringRef> enabledAcronyms{};
for (const auto &device : deviceAotInfo) {
if (!device.acronyms.empty()) {
enabledAcronyms.push_back(device.acronyms.front());
}
}
return enabledAcronyms;
}
std::vector<NEO::ConstStringRef> ProductConfigHelper::getReleasesAcronyms() {
std::vector<NEO::ConstStringRef> ret;
for (const auto &[acronym, value] : AOT::releaseAcronyms) {
if (std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findRelease(value))) {
ret.push_back(NEO::ConstStringRef(acronym));
}
}
return ret;
}
std::vector<NEO::ConstStringRef> ProductConfigHelper::getFamiliesAcronyms() {
std::vector<NEO::ConstStringRef> enabledAcronyms;
for (const auto &[acronym, value] : AOT::familyAcronyms) {
if (std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findFamily(value))) {
enabledAcronyms.push_back(NEO::ConstStringRef(acronym));
}
}
return enabledAcronyms;
}
std::vector<NEO::ConstStringRef> ProductConfigHelper::getAllProductAcronyms() {
std::vector<NEO::ConstStringRef> allSupportedAcronyms{};
for (const auto &device : deviceAotInfo) {
allSupportedAcronyms.insert(allSupportedAcronyms.end(), device.acronyms.begin(), device.acronyms.end());
}
return allSupportedAcronyms;
}
std::vector<NEO::ConstStringRef> ProductConfigHelper::getDeprecatedAcronyms() {
std::vector<NEO::ConstStringRef> prefixes{}, deprecatedAcronyms{}, enabledAcronyms{};
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
if (NEO::hardwarePrefix[j] == nullptr)
continue;
prefixes.push_back(NEO::hardwarePrefix[j]);
}
for (const auto &device : deviceAotInfo) {
enabledAcronyms.insert(enabledAcronyms.end(), device.acronyms.begin(), device.acronyms.end());
}
for (const auto &prefix : prefixes) {
std::string prefixCopy = prefix.str();
ProductConfigHelper::adjustDeviceName(prefixCopy);
if (std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(prefixCopy)))
continue;
deprecatedAcronyms.push_back(prefix);
}
return deprecatedAcronyms;
}
std::string ProductConfigHelper::parseMajorMinorRevisionValue(AheadOfTimeConfig config) {
std::stringstream stringConfig;
stringConfig << config.ProductConfigID.Major << "." << config.ProductConfigID.Minor << "." << config.ProductConfigID.Revision;
@@ -66,3 +201,47 @@ std::string ProductConfigHelper::parseMajorMinorValue(AheadOfTimeConfig config)
stringConfig << config.ProductConfigID.Major << "." << config.ProductConfigID.Minor;
return stringConfig.str();
}
int ProductConfigHelper::parseProductConfigFromString(const std::string &device, size_t begin, size_t end) {
if (begin == end) {
return ConfigStatus::MismatchedValue;
}
if (end == std::string::npos) {
if (!std::all_of(device.begin() + begin, device.end(), (::isdigit))) {
return ConfigStatus::MismatchedValue;
}
return std::stoi(device.substr(begin, device.size() - begin));
} else {
if (!std::all_of(device.begin() + begin, device.begin() + end, (::isdigit))) {
return ConfigStatus::MismatchedValue;
}
return std::stoi(device.substr(begin, end - begin));
}
}
AOT::PRODUCT_CONFIG ProductConfigHelper::getProductConfigForVersionValue(const std::string &device) {
auto majorPos = device.find(".");
auto major = parseProductConfigFromString(device, 0, majorPos);
if (major == ConfigStatus::MismatchedValue || majorPos == std::string::npos) {
return AOT::UNKNOWN_ISA;
}
auto minorPos = device.find(".", ++majorPos);
auto minor = parseProductConfigFromString(device, majorPos, minorPos);
if (minor == ConfigStatus::MismatchedValue || minorPos == std::string::npos) {
return AOT::UNKNOWN_ISA;
}
auto revision = parseProductConfigFromString(device, minorPos + 1, device.size());
if (revision == ConfigStatus::MismatchedValue) {
return AOT::UNKNOWN_ISA;
}
AheadOfTimeConfig product = {0};
product.ProductConfigID.Major = major;
product.ProductConfigID.Minor = minor;
product.ProductConfigID.Revision = revision;
return static_cast<AOT::PRODUCT_CONFIG>(product.ProductConfig);
}

View File

@@ -6,10 +6,12 @@
*/
#pragma once
#include "shared/source/utilities/const_stringref.h"
#include <sstream>
#include <string>
#include <vector>
namespace AOT {
enum PRODUCT_CONFIG : uint32_t;
@@ -17,6 +19,10 @@ enum RELEASE : uint32_t;
enum FAMILY : uint32_t;
} // namespace AOT
namespace NEO {
struct HardwareInfo;
} // namespace NEO
struct AheadOfTimeConfig {
union {
uint32_t ProductConfig;
@@ -30,24 +36,29 @@ 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());
};
}
struct DeviceAotInfo {
AheadOfTimeConfig aotConfig = {};
const NEO::HardwareInfo *hwInfo = nullptr;
const std::vector<unsigned short> *deviceIds = nullptr;
AOT::FAMILY family = {};
AOT::RELEASE release = {};
std::vector<NEO::ConstStringRef> acronyms{};
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());
};
bool operator==(const DeviceAotInfo &rhs) {
return aotConfig.ProductConfig == rhs.aotConfig.ProductConfig && family == rhs.family && release == rhs.release;
}
};
struct ProductConfigHelper {
public:
ProductConfigHelper();
enum ConfigStatus {
MismatchedValue = -1,
};
static void adjustDeviceName(std::string &device);
static std::string parseMajorMinorValue(AheadOfTimeConfig config);
static std::string parseMajorMinorRevisionValue(AheadOfTimeConfig config);
static int parseProductConfigFromString(const std::string &device, size_t begin, size_t end);
inline static std::string parseMajorMinorRevisionValue(AOT::PRODUCT_CONFIG config) {
std::stringstream stringConfig;
AheadOfTimeConfig aotConfig = {0};
@@ -55,8 +66,54 @@ struct ProductConfigHelper {
return parseMajorMinorRevisionValue(aotConfig);
}
static AOT::PRODUCT_CONFIG returnProductConfigForAcronym(const std::string &device);
static AOT::RELEASE returnReleaseForAcronym(const std::string &device);
static AOT::FAMILY returnFamilyForAcronym(const std::string &device);
static NEO::ConstStringRef getAcronymForAFamily(AOT::FAMILY family);
static AOT::PRODUCT_CONFIG getProductConfigForVersionValue(const std::string &device);
static AOT::PRODUCT_CONFIG getProductConfigForAcronym(const std::string &device);
static AOT::RELEASE getReleaseForAcronym(const std::string &device);
static AOT::FAMILY getFamilyForAcronym(const std::string &device);
static bool compareConfigs(DeviceAotInfo deviceAotInfo0, DeviceAotInfo deviceAotInfo1);
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()); };
}
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 findFamily(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs.family; };
}
template <typename EqComparableT>
static auto findRelease(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs.release; };
}
template <typename EqComparableT>
static auto findProductConfig(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs.aotConfig.ProductConfig; };
}
bool isFamily(const std::string &device);
bool isRelease(const std::string &device);
bool isProductConfig(const std::string &device);
AOT::PRODUCT_CONFIG getProductConfigForDeviceId(unsigned short deviceId);
const std::string getAcronymForProductConfig(AOT::PRODUCT_CONFIG config);
std::vector<DeviceAotInfo> &getDeviceAotInfo();
std::vector<NEO::ConstStringRef> getRepresentativeProductAcronyms();
std::vector<NEO::ConstStringRef> getReleasesAcronyms();
std::vector<NEO::ConstStringRef> getFamiliesAcronyms();
std::vector<NEO::ConstStringRef> getDeprecatedAcronyms();
std::vector<NEO::ConstStringRef> getAllProductAcronyms();
protected:
std::vector<DeviceAotInfo> deviceAotInfo;
};

View File

@@ -117,7 +117,7 @@ class HwInfoConfig {
virtual bool isVmBindPatIndexProgrammingSupported() const = 0;
virtual bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const = 0;
virtual bool isIpSamplingSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isGrfNumReportedWithScm() const = 0;
virtual bool isThreadArbitrationPolicyReportedWithScm() const = 0;
virtual bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const = 0;
@@ -218,7 +218,7 @@ class HwInfoConfigHw : public HwInfoConfig {
bool isVmBindPatIndexProgrammingSupported() const override;
bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const override;
bool isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const override;
bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const override;
bool isIpSamplingSupported(const HardwareInfo &hwInfo) const override;
bool isGrfNumReportedWithScm() const override;
bool isThreadArbitrationPolicyReportedWithScm() const override;
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override;

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> xeHpSdvDeviceIds{
0x0201,
0x0202,
0x0203,
0x0204,
0x0205,
0x0206,
0x0207,
0x0208,
0x0209,
0x020A,
0x020B,
0x020C,
0x020D,
0x020E,
0x020F,
0x0210};
} // namespace NEO

View File

@@ -6,9 +6,9 @@
*/
#pragma once
#include "shared/source/xe_hpc_core/hw_cmds_xe_hpc_core_base.h"
#include "device_ids_configs_pvc.h"
#include "shared/source/xe_hpc_core/hw_cmds_xe_hpc_core_base.h"
#include "shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h"
#include <algorithm>
@@ -37,13 +37,13 @@ struct PVC : public XE_HPC_COREFamily {
static constexpr uint8_t pvcBaseDieA0Masked = 0; // [3:5] == 0
static bool isXl(const HardwareInfo &hwInfo) {
auto it = std::find(PVC_XL_IDS.begin(), PVC_XL_IDS.end(), hwInfo.platform.usDeviceID);
return it != PVC_XL_IDS.end();
auto it = std::find(pvcXlDeviceIds.begin(), pvcXlDeviceIds.end(), hwInfo.platform.usDeviceID);
return it != pvcXlDeviceIds.end();
}
static bool isXt(const HardwareInfo &hwInfo) {
auto it = std::find(PVC_XT_IDS.begin(), PVC_XT_IDS.end(), hwInfo.platform.usDeviceID);
return it != PVC_XT_IDS.end();
auto it = std::find(pvcXtDeviceIds.begin(), pvcXtDeviceIds.end(), hwInfo.platform.usDeviceID);
return it != pvcXtDeviceIds.end();
}
static bool isXlA0(const HardwareInfo &hwInfo) {

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> pvcXlDeviceIds{0x0BD0};
static const std::vector<unsigned short> pvcXtDeviceIds{0x0BD5, 0x0BD6, 0x0BD7, 0x0BD8, 0x0BD9, 0x0BDA, 0x0BDB};
} // namespace NEO

View File

@@ -7,9 +7,4 @@
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> DG2_G10_IDS{0x4F80, 0x4F81, 0x4F82, 0x4F83, 0x4F84, 0x5690, 0x5691, 0x5692, 0x56A0, 0x56A1, 0x56A2, 0x56C0};
static const std::vector<unsigned short> DG2_G11_IDS{0x4F87, 0x4F88, 0x5693, 0x5694, 0x5695, 0x56A5, 0x56A6, 0x56B0, 0x56B1, 0x56C1};
} // namespace NEO
#include "shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2_base.h"

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
static const std::vector<unsigned short> dg2G10DeviceIds{
0x4F80,
0x4F81,
0x4F82,
0x4F83,
0x4F84,
0x5690,
0x5691,
0x5692,
0x56A0,
0x56A1,
0x56A2,
0x56C0};
static const std::vector<unsigned short> dg2G11DeviceIds{
0x4F87,
0x4F88,
0x5693,
0x5694,
0x5695,
0x56A5,
0x56A6,
0x56B0,
0x56B1,
0x56C1};
static const std::vector<unsigned short> dg2G12DeviceIds{
0x5696,
0x5697,
0x56A3,
0x56A4,
0x56B2,
0x56B3,
0x4F85,
0x4F86};
} // namespace NEO

View File

@@ -18,7 +18,7 @@ AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const
case 0x8:
return AOT::DG2_G10_C0;
}
} else {
} else if (DG2::isG11(hwInfo)) {
switch (hwInfo.platform.usRevId) {
case 0x0:
return AOT::DG2_G11_A0;
@@ -27,6 +27,8 @@ AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const
case 0x5:
return AOT::DG2_G11_B1;
}
} else if (DG2::isG12(hwInfo)) {
return AOT::DG2_G12_A0;
}
return AOT::UNKNOWN_ISA;
}

View File

@@ -33,13 +33,18 @@ struct DG2 : public XE_HPG_COREFamily {
static void setupHardwareInfoBase(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable);
static bool isG10(const HardwareInfo &hwInfo) {
auto it = std::find(DG2_G10_IDS.begin(), DG2_G10_IDS.end(), hwInfo.platform.usDeviceID);
return it != DG2_G10_IDS.end();
auto it = std::find(dg2G10DeviceIds.begin(), dg2G10DeviceIds.end(), hwInfo.platform.usDeviceID);
return it != dg2G10DeviceIds.end();
}
static bool isG11(const HardwareInfo &hwInfo) {
auto it = std::find(DG2_G11_IDS.begin(), DG2_G11_IDS.end(), hwInfo.platform.usDeviceID);
return it != DG2_G11_IDS.end();
auto it = std::find(dg2G11DeviceIds.begin(), dg2G11DeviceIds.end(), hwInfo.platform.usDeviceID);
return it != dg2G11DeviceIds.end();
}
static bool isG12(const HardwareInfo &hwInfo) {
auto it = std::find(dg2G12DeviceIds.begin(), dg2G12DeviceIds.end(), hwInfo.platform.usDeviceID);
return it != dg2G12DeviceIds.end();
}
};

View File

@@ -7,10 +7,13 @@
#include "shared/source/gen12lp/hw_cmds_adln.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using AdlnHwInfo = ::testing::Test;
@@ -67,3 +70,9 @@ ADLNTEST_F(AdlnHwInfo, givenAdlnWhenCheckL0ThenReturnTrue) {
const HardwareInfo &hardwareInfo = ADLN::hwInfo;
EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
}
ADLNTEST_F(AdlnHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::ADL_N);
}

View File

@@ -7,10 +7,13 @@
#include "shared/source/gen12lp/hw_cmds_adlp.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using AdlpHwInfo = ::testing::Test;
@@ -67,3 +70,9 @@ ADLPTEST_F(AdlpHwInfo, givenAdlpWhenCheckL0ThenReturnTrue) {
const HardwareInfo &hardwareInfo = ADLP::hwInfo;
EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
}
ADLPTEST_F(AdlpHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::ADL_P);
}

View File

@@ -7,9 +7,13 @@
#include "shared/source/gen12lp/hw_cmds_adls.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using AdlsHwInfo = ::testing::Test;
@@ -66,3 +70,9 @@ ADLSTEST_F(AdlsHwInfo, givenAdlsWhenCheckL0ThenReturnTrue) {
const HardwareInfo &hardwareInfo = ADLS::hwInfo;
EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
}
ADLSTEST_F(AdlsHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::ADL_S);
}

View File

@@ -7,10 +7,13 @@
#include "shared/source/gen12lp/hw_cmds_rkl.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using RklHwInfo = ::testing::Test;
@@ -77,3 +80,9 @@ RKLTEST_F(RklHwInfo, givenRklWhenCheckL0ThenReturnTrue) {
const HardwareInfo &hardwareInfo = RKL::hwInfo;
EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
}
RKLTEST_F(RklHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::RKL);
}

View File

@@ -67,4 +67,6 @@ using IsPVC = IsProduct<IGFX_PVC>;
using IsAtLeastSkl = IsAtLeastProduct<IGFX_SKYLAKE>;
using IsAtMostDg2 = IsAtMostProduct<IGFX_DG2>;
using IsNotPVC = IsNotWithinProducts<IGFX_PVC, IGFX_PVC>;

View File

@@ -13,6 +13,8 @@
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using XeHPMaxThreadsTest = Test<DeviceFixture>;
@@ -143,3 +145,9 @@ XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenIsImplicitScalingSupported
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_TRUE(hwInfoConfig.isImplicitScalingSupported(*defaultHwInfo));
}
XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::XEHP_SDV);
}

View File

@@ -39,7 +39,7 @@ DG2TEST_F(TestDg2HwInfoConfig, givenDG2WithA0SteppingThenMaxThreadsForWorkgroupW
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, *hwInfo);
for (const auto &devId : DG2_G10_IDS) {
for (const auto &devId : dg2G10DeviceIds) {
hwInfo->platform.usDeviceID = devId;
auto isWARequired = hwInfoConfig.isMaxThreadsForWorkgroupWARequired(pDevice->getHardwareInfo());
EXPECT_TRUE(isWARequired);

View File

@@ -6,9 +6,13 @@
*/
#include "shared/source/gen11/hw_cmds_ehl.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using EhlHwInfo = ::testing::Test;
@@ -64,3 +68,9 @@ EHLTEST_F(EhlHwInfo, givenBoolWhenCallEhlHardwareInfoSetupThenFeatureTableAndWor
EXPECT_EQ(setParamBool, workaroundTable.flags.waReportPerfCountUseGlobalContextID);
}
}
EHLTEST_F(EhlHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::EHL);
}

View File

@@ -11,6 +11,8 @@
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using IcllpHwInfoConfig = ::testing::Test;
@@ -94,3 +96,8 @@ ICLLPTEST_F(IcllpHwInfo, givenBoolWhenCallIcllpHardwareInfoSetupThenFeatureTable
}
}
}
ICLLPTEST_F(IcllpHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(*defaultHwInfo), AOT::ICL);
}

View File

@@ -6,9 +6,13 @@
*/
#include "shared/source/gen11/hw_cmds_lkf.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
TEST(LkfHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
@@ -83,3 +87,9 @@ LKFTEST_F(LkfHwInfo, givenBoolWhenCallLkfHardwareInfoSetupThenFeatureTableAndWor
EXPECT_EQ(setParamBool, workaroundTable.flags.waReportPerfCountUseGlobalContextID);
}
}
LKFTEST_F(LkfHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::LKF);
}

View File

@@ -12,6 +12,8 @@
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
using Dg1HwInfoConfig = ::testing::Test;
@@ -135,3 +137,8 @@ DG1TEST_F(Dg1HwInfo, whenOverrideGfxPartitionLayoutForWslThenReturnTrue) {
auto hwInfoConfig = HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_TRUE(hwInfoConfig->overrideGfxPartitionLayoutForWsl());
}
DG1TEST_F(Dg1HwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(*defaultHwInfo), AOT::DG1);
}

View File

@@ -7,10 +7,13 @@
#include "shared/source/gen8/hw_cmds_bdw.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
TEST(BdwHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
@@ -81,6 +84,12 @@ BDWTEST_F(BdwHwInfo, givenHwInfoConfigStringThenAfterSetupResultingVmeIsDisabled
EXPECT_FALSE(hwInfo.capabilityTable.supportsVme);
}
BDWTEST_F(BdwHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::BDW);
}
using CompilerHwInfoConfigHelperTestsBdw = ::testing::Test;
BDWTEST_F(CompilerHwInfoConfigHelperTestsBdw, givenBdwWhenIsStatelessToStatefulBufferOffsetSupportedIsCalledThenReturnsTrue) {
EXPECT_FALSE(CompilerHwInfoConfig::get(productFamily)->isStatelessToStatefulBufferOffsetSupported());

View File

@@ -5,5 +5,9 @@
#
if(TESTS_BXT)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_bxt.cpp
)
add_subdirectories()
endif()

View File

@@ -6,9 +6,13 @@
*/
#include "shared/source/gen9/hw_cmds_bxt.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
TEST(BxtHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
@@ -90,3 +94,9 @@ BXTTEST_F(BxtHwInfo, givenBoolWhenCallBxtHardwareInfoSetupThenFeatureTableAndWor
}
}
}
BXTTEST_F(BxtHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::APL);
}

View File

@@ -5,5 +5,9 @@
#
if(TESTS_CFL)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_cfl.cpp
)
add_subdirectories()
endif()

View File

@@ -5,10 +5,15 @@
*
*/
#include "shared/source/gen9/cfl/device_ids_configs_cfl.h"
#include "shared/source/gen9/hw_cmds_cfl.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
TEST(CflHwInfoConfig, GivenIncorrectDataWhenConfiguringHwInfoThenErrorIsReturned) {
@@ -82,3 +87,23 @@ CFLTEST_F(CflHwInfo, givenBoolWhenCallCflHardwareInfoSetupThenFeatureTableAndWor
}
}
}
CFLTEST_F(CflHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
for (const auto &deviceId : cflDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::CFL);
}
for (const auto &deviceId : cmlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::CML);
}
for (const auto &deviceId : whlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::WHL);
}
hwInfo.platform.usDeviceID = 0u;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::UNKNOWN_ISA);
}

View File

@@ -5,5 +5,9 @@
#
if(TESTS_GLK)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_glk.cpp
)
add_subdirectories()
endif()

View File

@@ -6,9 +6,13 @@
*/
#include "shared/source/gen9/hw_cmds_glk.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
TEST(GlkHwInfoConfig, GivenIncorrectDataWhenConfiguringHwInfoThenErrorIsReturned) {
@@ -80,3 +84,9 @@ GLKTEST_F(GlkHwInfo, givenBoolWhenCallGlkHardwareInfoSetupThenFeatureTableAndWor
}
}
}
GLKTEST_F(GlkHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::GLK);
}

View File

@@ -5,5 +5,9 @@
#
if(TESTS_KBL)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_kbl.cpp
)
add_subdirectories()
endif()

View File

@@ -5,8 +5,13 @@
*
*/
#include "shared/source/gen9/kbl/device_ids_configs_kbl.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "platforms.h"
using namespace NEO;
TEST(KblHwInfoConfig, GivenIncorrectDataWhenConfiguringHwInfoThenErrorIsReturned) {
@@ -93,3 +98,19 @@ KBLTEST_F(KblHwInfo, givenBoolWhenCallKblHardwareInfoSetupThenFeatureTableAndWor
}
}
}
KBLTEST_F(KblHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
for (const auto &deviceId : amlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::AML);
}
for (const auto &deviceId : kblDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::KBL);
}
hwInfo.platform.usDeviceID = 0u;
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::UNKNOWN_ISA);
}

View File

@@ -5,5 +5,9 @@
#
if(TESTS_SKL)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_skl.cpp
)
add_subdirectories()
endif()

View File

@@ -6,9 +6,13 @@
*/
#include "shared/source/gen9/hw_cmds_skl.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
using namespace NEO;
TEST(SklHwInfoConfig, GivenIncorrectDataWhenConfiguringHwInfoThenErrorIsReturned) {
@@ -104,3 +108,9 @@ SKLTEST_F(SklHwInfo, givenBoolWhenCallSklHardwareInfoSetupThenFeatureTableAndWor
}
}
}
SKLTEST_F(SklHwInfo, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
HardwareInfo hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.getProductConfigFromHwInfo(hwInfo), AOT::SKL);
}

View File

@@ -6,34 +6,38 @@
*/
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/utilities/const_stringref.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "platforms.h"
#include <algorithm>
using ProductConfigHelperTests = ::testing::Test;
TEST_F(ProductConfigHelperTests, givenProductAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
for (const auto &[acronym, value] : AOT::productConfigAcronyms) {
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym(acronym), value);
EXPECT_EQ(ProductConfigHelper::getProductConfigForAcronym(acronym), value);
}
}
TEST_F(ProductConfigHelperTests, givenReleaseAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
for (const auto &[acronym, value] : AOT::releaseAcronyms) {
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym(acronym), value);
EXPECT_EQ(ProductConfigHelper::getReleaseForAcronym(acronym), value);
}
}
TEST_F(ProductConfigHelperTests, givenFamilyAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
for (const auto &[acronym, value] : AOT::familyAcronyms) {
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym(acronym), value);
EXPECT_EQ(ProductConfigHelper::getFamilyForAcronym(acronym), value);
}
}
TEST_F(ProductConfigHelperTests, givenUnknownAcronymWhenHelperSearchForAMatchThenUnknownEnumValueIsReturned) {
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym("unk"), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym("unk"), AOT::UNKNOWN_RELEASE);
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym("unk"), AOT::UNKNOWN_FAMILY);
EXPECT_EQ(ProductConfigHelper::getProductConfigForAcronym("unk"), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::getReleaseForAcronym("unk"), AOT::UNKNOWN_RELEASE);
EXPECT_EQ(ProductConfigHelper::getFamilyForAcronym("unk"), AOT::UNKNOWN_FAMILY);
}
TEST_F(ProductConfigHelperTests, givenFamilyEnumWhenHelperSearchForAMatchThenCorrespondingAcronymIsReturned) {
@@ -115,7 +119,7 @@ TEST_F(ProductConfigHelperTests, givenProductAcronymWhenRemoveDashesFromTheNameT
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
}
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym(acronymCopy), value);
EXPECT_EQ(ProductConfigHelper::getProductConfigForAcronym(acronymCopy), value);
}
}
@@ -128,7 +132,7 @@ TEST_F(ProductConfigHelperTests, givenReleaseAcronymWhenRemoveDashesFromTheNameT
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
}
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym(acronymCopy), value);
EXPECT_EQ(ProductConfigHelper::getReleaseForAcronym(acronymCopy), value);
}
}
@@ -141,7 +145,7 @@ TEST_F(ProductConfigHelperTests, givenFamilyAcronymWhenRemoveDashesFromTheNameTh
acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end());
}
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym(acronymCopy), value);
EXPECT_EQ(ProductConfigHelper::getFamilyForAcronym(acronymCopy), value);
}
}
@@ -167,4 +171,349 @@ TEST_F(ProductConfigHelperTests, givenAcronymWithoutDashesWhenSearchMatchInSampl
acronym = "abcp";
ret = std::find_if(sampleAcronyms.begin(), sampleAcronyms.end(), ProductConfigHelper::findAcronymWithoutDash(acronym));
EXPECT_NE(ret, sampleAcronyms.end());
}
TEST_F(ProductConfigHelperTests, givenProductConfigValueWhenParseVersionThenCorrectValueIsReturned) {
for (const auto &configMap : AOT::productConfigAcronyms) {
auto version = ProductConfigHelper::parseMajorMinorRevisionValue(configMap.second);
auto productConfig = ProductConfigHelper::getProductConfigForVersionValue(version);
EXPECT_EQ(productConfig, configMap.second);
}
}
TEST_F(ProductConfigHelperTests, givenIncorrectVersionValueWhenGetProductConfigThenUnknownIsaIsReturned) {
EXPECT_EQ(ProductConfigHelper::getProductConfigForVersionValue("9.1."), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::getProductConfigForVersionValue("9.1.."), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::getProductConfigForVersionValue(".1.2"), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::getProductConfigForVersionValue("9.0.a"), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::getProductConfigForVersionValue("9.a"), AOT::UNKNOWN_ISA);
EXPECT_EQ(ProductConfigHelper::getProductConfigForVersionValue("256.350"), AOT::UNKNOWN_ISA);
}
TEST_F(ProductConfigHelperTests, GivenDifferentAotConfigsInDeviceAotInfosWhenComparingThemThenFalseIsReturned) {
DeviceAotInfo lhs{};
DeviceAotInfo rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.aotConfig = {AOT::CONFIG_MAX_PLATFORM};
rhs.aotConfig = {AOT::UNKNOWN_ISA};
EXPECT_FALSE(lhs == rhs);
}
TEST_F(ProductConfigHelperTests, GivenDifferentFamiliesInDeviceAotInfosWhenComparingThemThenFalseIsReturned) {
DeviceAotInfo lhs{};
DeviceAotInfo rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.family = AOT::FAMILY_MAX;
rhs.family = AOT::UNKNOWN_FAMILY;
EXPECT_FALSE(lhs == rhs);
}
TEST_F(ProductConfigHelperTests, GivenDifferentReleasesInDeviceAotInfosWhenComparingThemThenFalseIsReturned) {
DeviceAotInfo lhs{};
DeviceAotInfo rhs{};
ASSERT_TRUE(lhs == rhs);
lhs.release = AOT::RELEASE_MAX;
rhs.release = AOT::UNKNOWN_RELEASE;
EXPECT_FALSE(lhs == rhs);
}
struct AotDeviceInfoTests : public ::testing::Test {
AotDeviceInfoTests() {
productConfigHelper = std::make_unique<ProductConfigHelper>();
}
std::unique_ptr<ProductConfigHelper> productConfigHelper;
};
template <typename EqComparableT>
auto findAcronym(const EqComparableT &lhs) {
return [&lhs](const auto &rhs) { return lhs == rhs; };
}
TEST_F(AotDeviceInfoTests, givenProductOrAotConfigWhenParseMajorMinorRevisionValueThenCorrectStringIsReturned) {
auto &enabledDeviceConfigs = productConfigHelper->getDeviceAotInfo();
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 = ProductConfigHelper::getProductConfigForVersionValue(configStr0);
EXPECT_EQ(gotCofig, productConfig);
}
}
TEST_F(AotDeviceInfoTests, givenProductConfigAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
auto &enabledDeviceConfigs = productConfigHelper->getDeviceAotInfo();
if (enabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
std::string acronym("");
for (auto &device : enabledDeviceConfigs) {
if (!device.acronyms.empty()) {
acronym = device.acronyms.front().str();
auto enabledAcronyms = productConfigHelper->getAllProductAcronyms();
auto acronymFound = std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findAcronym(acronym));
EXPECT_TRUE(acronymFound);
device.acronyms.clear();
device.aotConfig.ProductConfig = AOT::UNKNOWN_ISA;
enabledAcronyms = productConfigHelper->getAllProductAcronyms();
acronymFound = std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findAcronym(acronym));
EXPECT_FALSE(acronymFound);
EXPECT_FALSE(productConfigHelper->isProductConfig(acronym));
}
}
}
TEST_F(AotDeviceInfoTests, givenReleaseAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
auto &enabledDeviceConfigs = productConfigHelper->getDeviceAotInfo();
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 = productConfigHelper->getReleasesAcronyms();
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 = productConfigHelper->getReleasesAcronyms();
releaseFound = std::any_of(enabledReleases.begin(), enabledReleases.end(), findAcronym(acronym));
EXPECT_FALSE(releaseFound);
EXPECT_FALSE(productConfigHelper->isRelease(acronym));
}
TEST_F(AotDeviceInfoTests, givenFamilyAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
auto &enabledDeviceConfigs = productConfigHelper->getDeviceAotInfo();
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 = productConfigHelper->getFamiliesAcronyms();
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 = productConfigHelper->getFamiliesAcronyms();
familyFound = std::any_of(enabledFamilies.begin(), enabledFamilies.end(), findAcronym(acronym));
EXPECT_FALSE(familyFound);
EXPECT_FALSE(productConfigHelper->isFamily(acronym));
}
TEST_F(AotDeviceInfoTests, givenEnabledFamilyAcronymsWhenCheckIfIsFamilyThenTrueIsReturned) {
auto enabledFamiliesAcronyms = productConfigHelper->getFamiliesAcronyms();
for (const auto &acronym : enabledFamiliesAcronyms) {
EXPECT_TRUE(productConfigHelper->isFamily(acronym.str()));
}
}
TEST_F(AotDeviceInfoTests, givenEnabledReleaseAcronymsWhenCheckIfIsReleaseThenTrueIsReturned) {
auto enabledReleasesAcronyms = productConfigHelper->getReleasesAcronyms();
for (const auto &acronym : enabledReleasesAcronyms) {
EXPECT_TRUE(productConfigHelper->isRelease(acronym.str()));
}
}
TEST_F(AotDeviceInfoTests, givenDisabledFamilyOrReleaseNameThenReturnsEmptyList) {
EXPECT_FALSE(productConfigHelper->isFamily(NEO::ConstStringRef("gen0").str()));
EXPECT_FALSE(productConfigHelper->isFamily(NEO::ConstStringRef("genX").str()));
EXPECT_FALSE(productConfigHelper->isRelease(NEO::ConstStringRef("gen0").str()));
EXPECT_FALSE(productConfigHelper->isRelease(NEO::ConstStringRef("genX").str()));
}
TEST_F(AotDeviceInfoTests, givenEnabledFamilyAcronymsWithoutDashesWhenCheckIfIsFamilyThenTrueIsReturned) {
auto enabledFamiliesAcronyms = productConfigHelper->getFamiliesAcronyms();
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(productConfigHelper->isFamily(acronymCopy));
}
}
TEST_F(AotDeviceInfoTests, givenEnabledReleaseAcronymsWithoutDashesWhenCheckIfIsReleaseThenTrueIsReturned) {
auto enabledReleasesAcronyms = productConfigHelper->getReleasesAcronyms();
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(productConfigHelper->isRelease(acronymCopy));
}
}
TEST_F(AotDeviceInfoTests, givenEnabledProductAcronymsWithoutDashesWhenCheckIfIsReleaseThenTrueIsReturned) {
auto enabledProductsAcronyms = productConfigHelper->getAllProductAcronyms();
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(productConfigHelper->isProductConfig(acronymCopy));
}
}
TEST_F(AotDeviceInfoTests, givenDeprecatedAcronymsWhenSearchingPresenceInNewNamesThenFalseIsReturned) {
auto deprecatedAcronyms = productConfigHelper->getDeprecatedAcronyms();
for (const auto &acronym : deprecatedAcronyms) {
std::string acronymCopy = acronym.str();
ProductConfigHelper::adjustDeviceName(acronymCopy);
EXPECT_FALSE(productConfigHelper->isFamily(acronymCopy));
EXPECT_FALSE(productConfigHelper->isRelease(acronymCopy));
EXPECT_FALSE(productConfigHelper->isProductConfig(acronymCopy));
}
}
TEST_F(AotDeviceInfoTests, givenNotFullConfigWhenGetProductConfigThenUnknownIsaIsReturned) {
auto allEnabledDeviceConfigs = productConfigHelper->getDeviceAotInfo();
if (allEnabledDeviceConfigs.empty()) {
GTEST_SKIP();
}
auto aotConfig = allEnabledDeviceConfigs[0].aotConfig;
std::stringstream majorString;
majorString << aotConfig.ProductConfigID.Major;
auto major = majorString.str();
auto aotValue0 = ProductConfigHelper::getProductConfigForVersionValue(major);
EXPECT_EQ(aotValue0, AOT::UNKNOWN_ISA);
auto majorMinor = ProductConfigHelper::parseMajorMinorValue(aotConfig);
auto aotValue1 = ProductConfigHelper::getProductConfigForVersionValue(majorMinor);
EXPECT_EQ(aotValue1, AOT::UNKNOWN_ISA);
}
TEST_F(AotDeviceInfoTests, givenEnabledProductsAcronymsAndVersionsWhenCheckIfProductConfigThenTrueIsReturned) {
auto enabledProducts = productConfigHelper->getDeviceAotInfo();
for (const auto &product : enabledProducts) {
auto configStr = ProductConfigHelper::parseMajorMinorRevisionValue(product.aotConfig);
EXPECT_FALSE(configStr.empty());
EXPECT_TRUE(productConfigHelper->isProductConfig(configStr));
for (const auto &acronym : product.acronyms) {
EXPECT_TRUE(productConfigHelper->isProductConfig(acronym.str()));
}
}
}
TEST_F(AotDeviceInfoTests, givenUnknownIsaVersionWhenCheckIfProductConfigThenFalseIsReturned) {
auto configStr = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
EXPECT_FALSE(productConfigHelper->isProductConfig(configStr));
}
TEST_F(AotDeviceInfoTests, givenRepresentativeProductsAcronymsWhenSearchInAllProductAcronymsThenStringIsFound) {
auto representativeAcronyms = productConfigHelper->getRepresentativeProductAcronyms();
auto allProductAcronyms = productConfigHelper->getAllProductAcronyms();
for (const auto &acronym : representativeAcronyms) {
EXPECT_NE(std::find(allProductAcronyms.begin(), allProductAcronyms.end(), acronym), allProductAcronyms.end());
}
}
TEST_F(AotDeviceInfoTests, givenClearedProductAcronymWhenSearchInRepresentativeAcronymsThenFewerAcronymsAreFound) {
auto &enabledProducts = productConfigHelper->getDeviceAotInfo();
for (auto &product : enabledProducts) {
if (!product.acronyms.empty()) {
auto representativeAcronyms = productConfigHelper->getRepresentativeProductAcronyms();
product.acronyms = {};
auto cutRepresentativeAcronyms = productConfigHelper->getRepresentativeProductAcronyms();
EXPECT_LT(cutRepresentativeAcronyms.size(), representativeAcronyms.size());
}
}
}
TEST_F(AotDeviceInfoTests, givenDeviceIdWhenSearchForProductConfigAndAcronymThenCorrectResultsAreReturned) {
auto deviceAot = productConfigHelper->getDeviceAotInfo();
if (deviceAot.empty()) {
GTEST_SKIP();
}
for (const auto &device : deviceAot) {
for (const auto &deviceId : *device.deviceIds) {
auto config = productConfigHelper->getProductConfigForDeviceId(deviceId);
EXPECT_NE(config, AOT::UNKNOWN_ISA);
auto name = productConfigHelper->getAcronymForProductConfig(config);
EXPECT_FALSE(name.empty());
}
}
}
TEST_F(AotDeviceInfoTests, givenInvalidDeviceIdWhenSearchForProductConfigAndAcronymThenUnknownIsaIsReturned) {
auto config = productConfigHelper->getProductConfigForDeviceId(0x0);
EXPECT_EQ(config, AOT::UNKNOWN_ISA);
auto name = productConfigHelper->getAcronymForProductConfig(config);
EXPECT_TRUE(name.empty());
}
TEST_F(AotDeviceInfoTests, givenDeviceIdsFromDevicesFileWhenGetProductConfigThenValueIsExpectedToBeFound) {
std::vector<unsigned short> deviceIds{
#define NAMEDDEVICE(devId, ignored_product, ignored_devName) devId,
#define DEVICE(devId, ignored_product) devId,
#include "devices.inl"
#undef DEVICE
#undef NAMEDDEVICE
};
if (deviceIds.empty()) {
GTEST_SKIP();
}
for (const auto &deviceId : deviceIds) {
EXPECT_NE(productConfigHelper->getProductConfigForDeviceId(deviceId), AOT::UNKNOWN_ISA);
}
}

View File

@@ -87,18 +87,14 @@ HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenIsImplicitScalingSupportedThenE
EXPECT_FALSE(hwInfoConfig.isImplicitScalingSupported(*defaultHwInfo));
}
HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound, IsAtMostXeHpCore) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_NE(hwInfoConfig.getProductConfigFromHwInfo(*defaultHwInfo), AOT::UNKNOWN_ISA);
}
HWTEST2_F(HwInfoConfigTest, givenAotConfigWhenSetHwInfoRevisionIdThenCorrectValueIsSet, IsAtMostXeHpCore) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
HWTEST2_F(HwInfoConfigTest, givenAotConfigWhenSetHwInfoRevisionIdThenCorrectValueIsSet, IsAtMostDg2) {
auto hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(*defaultHwInfo);
AheadOfTimeConfig aotConfig = {0};
aotConfig.ProductConfig = productConfig;
CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->setProductConfigForHwInfo(*defaultHwInfo, aotConfig);
EXPECT_EQ(defaultHwInfo->platform.usRevId, aotConfig.ProductConfigID.Revision);
CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig);
EXPECT_EQ(hwInfo.platform.usRevId, aotConfig.ProductConfigID.Revision);
}
HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsAdjustWalkOrderAvailableCallThenFalseReturn) {

View File

@@ -17,7 +17,7 @@ XE_HP_CORE_TEST_F(ProductConfigHelperXeHpCoreTests, givenVariousVariantsOfXeHpAc
std::vector<std::string> acronymsVariants = {"xe_hp_core", "xe_hp", "xehp", "XeHp"};
for (auto &acronym : acronymsVariants) {
ProductConfigHelper::adjustDeviceName(acronym);
auto ret = ProductConfigHelper::returnReleaseForAcronym(acronym);
auto ret = ProductConfigHelper::getReleaseForAcronym(acronym);
EXPECT_EQ(ret, AOT::XE_HP_RELEASE);
}
}

View File

@@ -39,7 +39,7 @@ PVCTEST_F(WalkerDispatchTestsPvc, givenPvcWhenEncodeAdditionalWalkerFieldsThenPo
EncodeWalkerArgs walkerArgs{KernelExecutionType::Default, true};
for (auto &testInput : testInputs) {
for (auto &deviceId : PVC_XL_IDS) {
for (auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = testInput.revisionId;
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(
@@ -59,7 +59,7 @@ PVCTEST_F(WalkerDispatchTestsPvc, givenPvcSupportsSystemMemoryFenceWhenNoSystemF
hwInfo.platform.usRevId = 0x3;
EncodeWalkerArgs walkerArgs{KernelExecutionType::Default, false};
for (auto &deviceId : PVC_XL_IDS) {
for (auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
postSyncData.setSystemMemoryFenceRequest(true);

View File

@@ -20,7 +20,7 @@ using PvcConfigHwInfoTests = ::testing::Test;
PVCTEST_F(PvcConfigHwInfoTests, givenPvcDeviceIdsAndRevisionsWhenCheckingConfigsThenReturnCorrectValues) {
HardwareInfo hwInfo = *defaultHwInfo;
for (auto &deviceId : PVC_XL_IDS) {
for (auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_TRUE(PVC::isXl(hwInfo));
EXPECT_FALSE(PVC::isXt(hwInfo));
@@ -38,7 +38,7 @@ PVCTEST_F(PvcConfigHwInfoTests, givenPvcDeviceIdsAndRevisionsWhenCheckingConfigs
EXPECT_FALSE(PVC::isAtMostXtA0(hwInfo));
}
for (auto &deviceId : PVC_XT_IDS) {
for (auto &deviceId : pvcXtDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_FALSE(PVC::isXl(hwInfo));
EXPECT_TRUE(PVC::isXt(hwInfo));

View File

@@ -19,7 +19,7 @@ PVCTEST_F(ProductConfigHelperPvcTests, givenVariousVariantsOfXeHpcAcronymsWhenGe
std::vector<std::string> acronymsVariants = {"xe_hpc_core", "xe_hpc", "xehpc", "XeHpc"};
for (auto &acronym : acronymsVariants) {
ProductConfigHelper::adjustDeviceName(acronym);
auto ret = ProductConfigHelper::returnReleaseForAcronym(acronym);
auto ret = ProductConfigHelper::getReleaseForAcronym(acronym);
EXPECT_EQ(ret, AOT::XE_HPC_RELEASE);
}
}

View File

@@ -6,17 +6,17 @@
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h"
#include "shared/test/common/fixtures/product_config_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "device_ids_configs_pvc.h"
#include "hw_cmds_xe_hpc_core_base.h"
using namespace NEO;
PVCTEST_F(ProductConfigTests, givenPvcXlDeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : PVC_XL_IDS) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x0;
@@ -34,7 +34,7 @@ PVCTEST_F(ProductConfigTests, givenPvcXlDeviceIdWhenDifferentRevisionIsPassedThe
}
PVCTEST_F(ProductConfigTests, givenPvcXtDeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : PVC_XT_IDS) {
for (const auto &deviceId : pvcXtDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x3;

View File

@@ -37,8 +37,8 @@ PVCTEST_F(CommandEncodeStatesPvcTest, GivenSmallSlmTotalSizesWhenSetAdditionalIn
{0x9d, false},
};
for (auto &revisionToTest : revisionsToTest) {
for (auto &deviceId : PVC_XL_IDS) {
for (const auto &revisionToTest : revisionsToTest) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = revisionToTest.revisionId;
INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData;
@@ -73,8 +73,8 @@ PVCTEST_F(EncodeKernelPvcTest, givenRevisionBAndAboveWhenSpecialModeRequiredThen
{0x6, false},
{0x7, false},
};
for (auto &testInput : testInputs) {
for (auto &deviceId : PVC_XL_IDS) {
for (const auto &testInput : testInputs) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo->platform.usDeviceID = deviceId;
hwInfo->platform.usRevId = testInput.revId;
cmdContainer->lastPipelineSelectModeRequired = false;
@@ -106,8 +106,8 @@ PVCTEST_F(EncodeKernelPvcTest, givenRevisionBAndAboveWhenSpecialModeRequiredAndA
{0x6, false},
{0x7, false},
};
for (auto &testInput : testInputs) {
for (auto &deviceId : PVC_XL_IDS) {
for (const auto &testInput : testInputs) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo->platform.usDeviceID = deviceId;
hwInfo->platform.usRevId = testInput.revId;
EncodeComputeMode<FamilyType>::adjustPipelineSelect(*cmdContainer.get(), dispatchInterface->kernelDescriptor);

View File

@@ -11,6 +11,7 @@
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/common/xe_hpc_core/pvc/product_configs_pvc.h"
using namespace NEO;
@@ -52,12 +53,12 @@ PVCTEST_F(PVCHwInfoConfig, givenPvcHwInfoWhenIsIpSamplingSupportedThenCorrectRes
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
auto hwInfo = *defaultHwInfo;
for (auto &deviceId : PVC_XL_IDS) {
for (const auto &deviceId : pvcXlDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_FALSE(hwInfoConfig.isIpSamplingSupported(hwInfo));
}
for (auto &deviceId : PVC_XT_IDS) {
for (const auto &deviceId : pvcXtDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_TRUE(hwInfoConfig.isIpSamplingSupported(hwInfo));
}

View File

@@ -14,7 +14,6 @@ if(TESTS_DG2)
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_dg2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_dg2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests_dg2.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}product_config_tests_dg2.cpp
)
add_subdirectories()
endif()

View File

@@ -6,7 +6,6 @@
*/
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
@@ -392,20 +391,32 @@ DG2TEST_F(HwInfoConfigTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEv
}
DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) {
for (const auto &deviceId : DG2_G10_IDS) {
for (const auto &deviceId : dg2G10DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_TRUE(DG2::isG10(hwInfo));
EXPECT_FALSE(DG2::isG11(hwInfo));
EXPECT_FALSE(DG2::isG12(hwInfo));
}
}
DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) {
for (const auto &deviceId : DG2_G11_IDS) {
for (const auto &deviceId : dg2G11DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_FALSE(DG2::isG10(hwInfo));
EXPECT_TRUE(DG2::isG11(hwInfo));
EXPECT_FALSE(DG2::isG12(hwInfo));
}
}
DG2TEST_F(ProductConfigTests, givenDg2G12DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) {
for (const auto &deviceId : dg2G12DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_FALSE(DG2::isG10(hwInfo));
EXPECT_FALSE(DG2::isG11(hwInfo));
EXPECT_TRUE(DG2::isG12(hwInfo));
}
}
@@ -418,7 +429,7 @@ DG2TEST_F(ProductConfigTests, givenInvalidRevisionIdWhenDeviceIdIsDefaultThenUnk
}
DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : DG2_G10_IDS) {
for (const auto &deviceId : dg2G10DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x0;
@@ -440,7 +451,7 @@ DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedTh
}
DG2TEST_F(ProductConfigTests, givenDg2DeviceIdWhenIncorrectRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &dg2 : {DG2_G10_IDS, DG2_G11_IDS}) {
for (const auto &dg2 : {dg2G10DeviceIds, dg2G11DeviceIds}) {
for (const auto &deviceId : dg2) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = CommonConstants::invalidRevisionID;
@@ -451,7 +462,7 @@ DG2TEST_F(ProductConfigTests, givenDg2DeviceIdWhenIncorrectRevisionIsPassedThenC
}
DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : DG2_G11_IDS) {
for (const auto &deviceId : dg2G11DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x0;
@@ -468,15 +479,22 @@ DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedTh
}
}
DG2TEST_F(ProductConfigTests, givenAotConfigWhenSetHwInfoRevisionIdForDg2ThenCorrectValueIsSet) {
for (const auto &config : AOT_DG2::productConfigs) {
AheadOfTimeConfig aotConfig = {0};
aotConfig.ProductConfig = config;
CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig);
EXPECT_EQ(hwInfo.platform.usRevId, aotConfig.ProductConfigID.Revision);
DG2TEST_F(ProductConfigTests, givenDg2G12DeviceIdWhenGetProductConfigThenCorrectConfigIsReturned) {
for (const auto &deviceId : dg2G12DeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, AOT::DG2_G12_A0);
}
}
DG2TEST_F(ProductConfigTests, givenNotSetDeviceAndRevisionIdWhenGetProductConfigThenUnknownIsaIsReturned) {
hwInfo.platform.usRevId = 0x0;
hwInfo.platform.usDeviceID = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA);
}
DG2TEST_F(HwInfoConfigTestDg2, givenHwInfoConfigWhenAskedIfStorageInfoAdjustmentIsRequiredThenTrueIsReturned) {
auto hwInfoConfig = HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if constexpr (is32bit) {

View File

@@ -19,7 +19,7 @@ DG2TEST_F(ProductConfigHelperDg2Tests, givenVariousVariantsOfXeHpgAcronymsWhenGe
std::vector<std::string> acronymsVariants = {"xe_hpg_core", "xe_hpg", "xehpg", "XeHpg"};
for (auto &acronym : acronymsVariants) {
ProductConfigHelper::adjustDeviceName(acronym);
auto ret = ProductConfigHelper::returnReleaseForAcronym(acronym);
auto ret = ProductConfigHelper::getReleaseForAcronym(acronym);
EXPECT_EQ(ret, AOT::XE_HPG_RELEASE);
}
}

View File

@@ -1,24 +0,0 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/fixtures/product_config_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "device_ids_configs_dg2.h"
#include "hw_cmds_xe_hpc_core_base.h"
using namespace NEO;
DG2TEST_F(ProductConfigTests, givenDefaultDeviceAndRevisionIdWhenGetProductConfigThenDg2G11A0ConfigIsReturned) {
hwInfo.platform.usRevId = 0x0;
hwInfo.platform.usDeviceID = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, AOT::DG2_G11_A0);
}