diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp index fa1b73cb40..9b3db656cb 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdlist_pvc.cpp @@ -22,7 +22,7 @@ using CommandListStatePrefetchPvcXt = Test; 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); } diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp index 57735258a8..39f8f65a93 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_device_pvc.cpp @@ -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); diff --git a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp index 366cfdfa39..5c3bae2f45 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp @@ -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(device->getOsInterface().getDriverModel()->as()); VariableBackup 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(device->getOsInterface().getDriverModel()->as()); diff --git a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp index 9f1b5f4bb9..9a2dec7e75 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp @@ -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()); } diff --git a/opencl/test/unit_test/gen12lp/tgllp/test_hw_info_config_tgllp.cpp b/opencl/test/unit_test/gen12lp/tgllp/test_hw_info_config_tgllp.cpp index 3ce0f505b3..de81aea3d7 100644 --- a/opencl/test/unit_test/gen12lp/tgllp/test_hw_info_config_tgllp.cpp +++ b/opencl/test/unit_test/gen12lp/tgllp/test_hw_info_config_tgllp.cpp @@ -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); +} \ No newline at end of file diff --git a/opencl/test/unit_test/gen9/bxt/CMakeLists.txt b/opencl/test/unit_test/gen9/bxt/CMakeLists.txt index 5491171e33..26b754d6ab 100644 --- a/opencl/test/unit_test/gen9/bxt/CMakeLists.txt +++ b/opencl/test/unit_test/gen9/bxt/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/cfl/CMakeLists.txt b/opencl/test/unit_test/gen9/cfl/CMakeLists.txt index 00df6d8368..06b01bf8c2 100644 --- a/opencl/test/unit_test/gen9/cfl/CMakeLists.txt +++ b/opencl/test/unit_test/gen9/cfl/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/glk/CMakeLists.txt b/opencl/test/unit_test/gen9/glk/CMakeLists.txt index 99443bb8a9..004271605c 100644 --- a/opencl/test/unit_test/gen9/glk/CMakeLists.txt +++ b/opencl/test/unit_test/gen9/glk/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/kbl/CMakeLists.txt b/opencl/test/unit_test/gen9/kbl/CMakeLists.txt index d3e60a0b73..91f389947e 100644 --- a/opencl/test/unit_test/gen9/kbl/CMakeLists.txt +++ b/opencl/test/unit_test/gen9/kbl/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/skl/CMakeLists.txt b/opencl/test/unit_test/gen9/skl/CMakeLists.txt index 944ba01a76..753508d589 100644 --- a/opencl/test/unit_test/gen9/skl/CMakeLists.txt +++ b/opencl/test/unit_test/gen9/skl/CMakeLists.txt @@ -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 ) diff --git a/opencl/test/unit_test/offline_compiler/CMakeLists.txt b/opencl/test/unit_test/offline_compiler/CMakeLists.txt index bb47e381c5..a8c2960682 100644 --- a/opencl/test/unit_test/offline_compiler/CMakeLists.txt +++ b/opencl/test/unit_test/offline_compiler/CMakeLists.txt @@ -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 diff --git a/opencl/test/unit_test/offline_compiler/mock/mock_argument_helper.h b/opencl/test/unit_test/offline_compiler/mock/mock_argument_helper.h index 420b7969fe..41494130fb 100644 --- a/opencl/test/unit_test/offline_compiler/mock/mock_argument_helper.h +++ b/opencl/test/unit_test/offline_compiler/mock/mock_argument_helper.h @@ -19,7 +19,6 @@ class MockOclocArgHelper : public OclocArgHelper { public: - using OclocArgHelper::deviceProductTable; using OclocArgHelper::hasOutput; using OclocArgHelper::headers; using OclocArgHelper::inputs; diff --git a/opencl/test/unit_test/offline_compiler/ocloc_api_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_api_tests.cpp index 83fe92f669..f3ea02d000 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_api_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_api_tests.cpp @@ -215,7 +215,7 @@ TEST(OclocApiTests, givenUnknownAcronymWhenIdsCommandIsInvokeThenErrorIsReported TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) { std::string clFileName(clFiles + "copybuffer.cl"); std::unique_ptr argHelper = std::make_unique(); - auto allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs(); + auto allSupportedDeviceConfigs = argHelper->productConfigHelper->getDeviceAotInfo(); if (allSupportedDeviceConfigs.empty()) { GTEST_SKIP(); } diff --git a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp index 55fb4765b2..49cf334da8 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp @@ -20,6 +20,7 @@ #include "environment.h" #include "mock/mock_argument_helper.h" #include "mock/mock_offline_compiler.h" +#include "platforms.h" #include #include @@ -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 &out, ConstStringRef ac } std::vector prepareProductsWithoutDashes(OclocArgHelper *argHelper) { - auto enabledProductsAcronyms = argHelper->getEnabledProductAcronyms(); + auto enabledProductsAcronyms = argHelper->productConfigHelper->getRepresentativeProductAcronyms(); if (enabledProductsAcronyms.size() < 2) { return {}; } @@ -104,7 +105,7 @@ std::vector prepareProductsWithoutDashes(OclocArgHelper *argHelper) } std::vector prepareReleasesWithoutDashes(OclocArgHelper *argHelper) { - auto enabledReleasesAcronyms = argHelper->getEnabledReleasesAcronyms(); + auto enabledReleasesAcronyms = argHelper->productConfigHelper->getReleasesAcronyms(); if (enabledReleasesAcronyms.size() < 2) { return {}; } @@ -118,7 +119,7 @@ std::vector prepareReleasesWithoutDashes(OclocArgHelper *argHelper) } std::vector 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 argHelper = std::make_unique(); + NEO::HardwareInfo hwInfo; + EXPECT_FALSE(argHelper->getHwInfoForProductConfig(AOT::UNKNOWN_ISA, hwInfo, 0u)); +} + TEST(OclocFatBinaryRequestedFatBinary, givenReleaseOrFamilyAcronymWhenGetAcronymsForTargetThenCorrectValuesAreReturned) { std::unique_ptr argHelper = std::make_unique(); - 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 argHelper = std::make_unique(); - 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 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 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 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 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 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 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 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 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 expected{}; auto releaseFromId = static_cast(static_cast(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 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 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 expected{}; auto familyFromId = static_cast(static_cast(AOT::UNKNOWN_FAMILY) + 1); - auto familyToId = ProductConfigHelper::returnFamilyForAcronym(family.str()); + auto familyToId = ProductConfigHelper::getFamilyForAcronym(family.str()); while (familyFromId <= familyToId) { getProductsAcronymsForTarget(expected, familyFromId, oclocArgHelperWithoutInput.get()); diff --git a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.h b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.h index 0830d6ea27..16c12b787d 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.h +++ b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.h @@ -17,7 +17,7 @@ namespace NEO { class OclocEnabledAcronyms : public ::testing::Test { public: - std::vector enabledProducts{}; + std::vector enabledProducts{}; std::vector enabledProductsAcronyms{}; std::vector enabledFamiliesAcronyms{}; std::vector enabledReleasesAcronyms{}; @@ -29,10 +29,10 @@ class OclocFatBinaryProductAcronymsTests : public OclocEnabledAcronyms { oclocArgHelperWithoutInput = std::make_unique(); 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 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: diff --git a/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp index 0cb400021d..92abc5d486 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.cpp @@ -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; } diff --git a/opencl/test/unit_test/offline_compiler/ocloc_validator_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_validator_tests.cpp index 55042d33cd..fdb8f10132 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_validator_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_validator_tests.cpp @@ -91,32 +91,3 @@ TEST(OclocValidate, WhenErrorsEmitedThenRedirectsThemToStdout) { EXPECT_EQ(static_cast(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 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 &>(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()); - } -} diff --git a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp index 62ceda255f..2d7e65305e 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -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 #include @@ -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 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 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 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(deviceAotInfo[0].aotConfig.ProductConfig); + productString << oclocArgHelperWithoutInput->productConfigHelper->getAcronymForProductConfig(config); std::vector 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 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)}; diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/hw_helper_tests_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/hw_helper_tests_pvc.cpp index d41efdd19f..3de4a8a79d 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/hw_helper_tests_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/hw_helper_tests_pvc.cpp @@ -21,7 +21,7 @@ using HwHelperTestsPvcXt = Test; 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); } diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/CMakeLists.txt b/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/CMakeLists.txt index a7869117d7..c159d73189 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/CMakeLists.txt +++ b/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/CMakeLists.txt @@ -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}) diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/device_id_tests_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/device_id_tests_pvc.cpp index 9584561bb0..6c1c76c73f 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/device_id_tests_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/linux/dll/device_id_tests_pvc.cpp @@ -9,7 +9,7 @@ using namespace NEO; -TEST_F(DeviceIdTests, GivenPvcSupportedDeviceIdThenConfigIsCorrect) { +PVCTEST_F(DeviceIdTests, GivenPvcSupportedDeviceIdThenConfigIsCorrect) { std::array expectedDescriptors = {{ {0x0BD0, &PvcHwConfig::hwInfo, &PvcHwConfig::setupHardwareInfo}, {0x0BD5, &PvcHwConfig::hwInfo, &PvcHwConfig::setupHardwareInfo}, diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp index 7104a14a37..0369729a47 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp @@ -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 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)); } diff --git a/opencl/test/unit_test/xe_hpg_core/dg2/test_device_caps_dg2.cpp b/opencl/test/unit_test/xe_hpg_core/dg2/test_device_caps_dg2.cpp index 1136eccde6..7a302a5081 100644 --- a/opencl/test/unit_test/xe_hpg_core/dg2/test_device_caps_dg2.cpp +++ b/opencl/test/unit_test/xe_hpg_core/dg2/test_device_caps_dg2.cpp @@ -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(MockDevice::createWithNewExecutionEnvironment(&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(MockDevice::createWithNewExecutionEnvironment(&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)); diff --git a/shared/offline_compiler/source/decoder/binary_decoder.cpp b/shared/offline_compiler/source/decoder/binary_decoder.cpp index 5f7242f731..27e1a9ee2f 100644 --- a/shared/offline_compiler/source/decoder/binary_decoder.cpp +++ b/shared/offline_compiler/source/decoder/binary_decoder.cpp @@ -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) { diff --git a/shared/offline_compiler/source/decoder/binary_encoder.cpp b/shared/offline_compiler/source/decoder/binary_encoder.cpp index 0feb43025d..16f6c9d147 100644 --- a/shared/offline_compiler/source/decoder/binary_encoder.cpp +++ b/shared/offline_compiler/source/decoder/binary_encoder.cpp @@ -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() { diff --git a/shared/offline_compiler/source/ocloc_arg_helper.cpp b/shared/offline_compiler/source/ocloc_arg_helper.cpp index 53e90bd4b9..8d88c70ee2 100644 --- a/shared/offline_compiler/source/ocloc_arg_helper.cpp +++ b/shared/offline_compiler/source/ocloc_arg_helper.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/string.h" #include "hw_cmds.h" +#include "platforms.h" #include #include @@ -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(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(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(); } OclocArgHelper::OclocArgHelper() : OclocArgHelper(0, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) {} @@ -168,25 +149,25 @@ std::unique_ptr 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 OclocArgHelper::getDeprecatedAcronyms() { - std::vector 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 OclocArgHelper::getAllSupportedProductAcronyms() { - std::vector allEnabledAcronyms{}; - for (const auto &device : deviceMap) { - allEnabledAcronyms.insert(allEnabledAcronyms.end(), device.acronyms.begin(), device.acronyms.end()); - } - return allEnabledAcronyms; -} - -std::vector OclocArgHelper::getEnabledProductAcronyms() { - std::vector enabledAcronyms{}; - for (const auto &device : deviceMap) { - if (!device.acronyms.empty()) { - enabledAcronyms.push_back(device.acronyms.front()); - } - } - return enabledAcronyms; -} - -std::vector OclocArgHelper::getEnabledReleasesAcronyms() { - std::vector 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 OclocArgHelper::getEnabledFamiliesAcronyms() { - std::vector 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 &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(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"; } diff --git a/shared/offline_compiler/source/ocloc_arg_helper.h b/shared/offline_compiler/source/ocloc_arg_helper.h index 02a96c70d1..eb9cbbd405 100644 --- a/shared/offline_compiler/source/ocloc_arg_helper.h +++ b/shared/offline_compiler/source/ocloc_arg_helper.h @@ -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 #include #include @@ -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 *deviceIds = nullptr; - AOT::FAMILY family = AOT::UNKNOWN_FAMILY; - AOT::RELEASE release = AOT::UNKNOWN_RELEASE; - AheadOfTimeConfig aotConfig = {0}; - std::vector acronyms{}; - - bool operator==(const DeviceMapping &rhs) { - return aotConfig.ProductConfig == rhs.aotConfig.ProductConfig && family == rhs.family && release == rhs.release; - } -}; - class OclocArgHelper { protected: std::vector inputs, headers; @@ -72,8 +51,6 @@ class OclocArgHelper { uint64_t **lenOutputs = nullptr; bool hasOutput = false; MessagePrinter messagePrinter; - const std::vector deviceProductTable; - std::vector 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 - auto findFamily(const EqComparableT &lhs) { - return [&lhs](const auto &rhs) { return lhs == rhs.family; }; - } - - template - auto findRelease(const EqComparableT &lhs) { - return [&lhs](const auto &rhs) { return lhs == rhs.release; }; - } - - template - 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 &getAllSupportedDeviceConfigs(); - std::vector getEnabledProductAcronyms(); - std::vector getEnabledReleasesAcronyms(); - std::vector getEnabledFamiliesAcronyms(); - std::vector getDeprecatedAcronyms(); - std::vector 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 headersToVectorOfStrings(); MOCKABLE_VIRTUAL void readFileToVectorOfStrings(const std::string &filename, std::vector &lines); MOCKABLE_VIRTUAL std::vector 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; }; diff --git a/shared/offline_compiler/source/ocloc_fatbinary.cpp b/shared/offline_compiler/source/ocloc_fatbinary.cpp index 3cf30f38e2..4a128b0d9b 100644 --- a/shared/offline_compiler/source/ocloc_fatbinary.cpp +++ b/shared/offline_compiler/source/ocloc_fatbinary.cpp @@ -17,6 +17,7 @@ #include "shared/source/helpers/product_config_helper.h" #include "igfxfmid.h" +#include "platforms.h" #include #include @@ -35,8 +36,8 @@ bool requestedFatBinary(const std::vector &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 &args, OclocArgHelper *he template <> void getProductsAcronymsForTarget(std::vector &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(std::vector template <> void getProductsAcronymsForTarget(std::vector &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 &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 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 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 getProductForOpenRange(ConstStringRef openRange, Ocl --familyTo; getProductsForTargetRange(family, static_cast(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 getProductForOpenRange(ConstStringRef openRange, Ocl --releaseTo; getProductsForTargetRange(release, static_cast(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 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 getProductForSpecificTarget(CompilerOptions::Tokeniz std::vector getTargetProductsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper) { std::vector 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 &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; } diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 87d963efb7..2945297b9a 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -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 #include @@ -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::vectorgetAllSupportedDeviceConfigs(); + auto enabledDevices = helper->productConfigHelper->getDeviceAotInfo(); std::vector 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 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; } diff --git a/shared/offline_compiler/source/offline_compiler.h b/shared/offline_compiler/source/offline_compiler.h index d7b5c8ff6f..6fd28c9b84 100644 --- a/shared/offline_compiler/source/offline_compiler.h +++ b/shared/offline_compiler/source/offline_compiler.h @@ -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 &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; diff --git a/shared/source/dll/devices/product_config_base.inl b/shared/source/dll/devices/product_config_base.inl index 02b1793e79..d4cf96315a 100644 --- a/shared/source/dll/devices/product_config_base.inl +++ b/shared/source/dll/devices/product_config_base.inl @@ -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 diff --git a/shared/source/enable_cores.cmake b/shared/source/enable_cores.cmake index b565da7a5a..1a4b124ae1 100644 --- a/shared/source/enable_cores.cmake +++ b/shared/source/enable_cores.cmake @@ -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}) diff --git a/shared/source/gen11/ehl/device_ids_configs_ehl.h b/shared/source/gen11/ehl/device_ids_configs_ehl.h new file mode 100644 index 0000000000..9d3c125528 --- /dev/null +++ b/shared/source/gen11/ehl/device_ids_configs_ehl.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector ehlDeviceIds{ + 0x4500, + 0x4541, + 0x4551, + 0x4571, + 0x4555, + 0x4E51, + 0x4E61, + 0x4E71, + 0x4E55}; +} // namespace NEO diff --git a/shared/source/gen11/icllp/device_ids_configs_icllp.h b/shared/source/gen11/icllp/device_ids_configs_icllp.h new file mode 100644 index 0000000000..193d518723 --- /dev/null +++ b/shared/source/gen11/icllp/device_ids_configs_icllp.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector icllpDeviceIds{ + 0xFF05, + 0x8A56, + 0x8A58, + 0x8A5C, + 0x8A5A, + 0x8A50, + 0x8A52, + 0x8A51}; +} // namespace NEO diff --git a/shared/source/xe_hpc_core/pvc/definitions/device_ids_configs_pvc.h b/shared/source/gen11/lkf/device_ids_configs_lkf.h similarity index 52% rename from shared/source/xe_hpc_core/pvc/definitions/device_ids_configs_pvc.h rename to shared/source/gen11/lkf/device_ids_configs_lkf.h index 907ada4a5f..4fb7df672b 100644 --- a/shared/source/xe_hpc_core/pvc/definitions/device_ids_configs_pvc.h +++ b/shared/source/gen11/lkf/device_ids_configs_lkf.h @@ -10,6 +10,5 @@ #include namespace NEO { -static const std::vector PVC_XT_IDS{0x0BD5, 0x0BD6, 0x0BD8}; -static const std::vector PVC_XL_IDS{0x0BD0}; +static const std::vector lkfDeviceIds{0x9840}; } // namespace NEO diff --git a/shared/source/gen12lp/adln/device_ids_configs_adln.h b/shared/source/gen12lp/adln/device_ids_configs_adln.h new file mode 100644 index 0000000000..5040d23d40 --- /dev/null +++ b/shared/source/gen12lp/adln/device_ids_configs_adln.h @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector adlnDeviceIds{0x46D0}; +} // namespace NEO diff --git a/shared/source/gen12lp/adlp/device_ids_configs_adlp.h b/shared/source/gen12lp/adlp/device_ids_configs_adlp.h new file mode 100644 index 0000000000..b3388a91a8 --- /dev/null +++ b/shared/source/gen12lp/adlp/device_ids_configs_adlp.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector 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 diff --git a/shared/source/gen12lp/adls/device_ids_configs_adls.h b/shared/source/gen12lp/adls/device_ids_configs_adls.h new file mode 100644 index 0000000000..4f20a6f639 --- /dev/null +++ b/shared/source/gen12lp/adls/device_ids_configs_adls.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector adlsDeviceIds{ + 0x4680, + 0x4682, + 0x4688, + 0x468A, + 0x4690, + 0x4692, + 0x4693, + 0xA780, + 0xA781, + 0xA782, + 0xA783, + 0xA788, + 0xA789}; + +} // namespace NEO diff --git a/shared/source/gen12lp/dg1/device_ids_configs_dg1.h b/shared/source/gen12lp/dg1/device_ids_configs_dg1.h new file mode 100644 index 0000000000..e65b82021d --- /dev/null +++ b/shared/source/gen12lp/dg1/device_ids_configs_dg1.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector dg1DeviceIds{ + 0x4905, + 0x4906, + 0x4907, + 0x4908}; +} // namespace NEO diff --git a/shared/source/gen12lp/rkl/device_ids_configs_rkl.h b/shared/source/gen12lp/rkl/device_ids_configs_rkl.h new file mode 100644 index 0000000000..95797e383c --- /dev/null +++ b/shared/source/gen12lp/rkl/device_ids_configs_rkl.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector rklDeviceIds{ + 0x4C80, + 0x4C8A, + 0x4C8B, + 0x4C8C, + 0x4C90, + 0x4C9A}; +} // namespace NEO diff --git a/shared/source/gen12lp/tgllp/device_ids_configs_tgllp.h b/shared/source/gen12lp/tgllp/device_ids_configs_tgllp.h new file mode 100644 index 0000000000..0dd49e1aaa --- /dev/null +++ b/shared/source/gen12lp/tgllp/device_ids_configs_tgllp.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector tgllpDeviceIds{ + 0xFF20, + 0x9A49, + 0x9A40, + 0x9A59, + 0x9A60, + 0x9A68, + 0x9A70, + 0x9A78}; +} // namespace NEO diff --git a/shared/source/gen8/bdw/device_ids_configs_bdw.h b/shared/source/gen8/bdw/device_ids_configs_bdw.h new file mode 100644 index 0000000000..fecdbbd20a --- /dev/null +++ b/shared/source/gen8/bdw/device_ids_configs_bdw.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector bdwDeviceIds{ + 0x1602, + 0x160A, + 0x1606, + 0x160E, + 0x160D, + 0x1612, + 0x161A, + 0x1616, + 0x161E, + 0x161D, + 0x1622, + 0x162A, + 0x1626, + 0x162B, + 0x162E, + 0x162D}; +} // namespace NEO diff --git a/shared/source/gen9/bxt/device_ids_configs_bxt.h b/shared/source/gen9/bxt/device_ids_configs_bxt.h new file mode 100644 index 0000000000..70c2b05c2b --- /dev/null +++ b/shared/source/gen9/bxt/device_ids_configs_bxt.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector bxtDeviceIds{ + 0x9906, + 0x9907, + 0x0A84, + 0x5A84, + 0x5A85, + 0x1A85, + 0x1A84, + 0x9908}; +} // namespace NEO diff --git a/shared/source/gen9/cfl/device_ids_configs_cfl.h b/shared/source/gen9/cfl/device_ids_configs_cfl.h new file mode 100644 index 0000000000..7c0be31a23 --- /dev/null +++ b/shared/source/gen9/cfl/device_ids_configs_cfl.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector cflDeviceIds{ + 0x3E90, + 0x3E93, + 0x3E99, + 0x3E92, + 0x3E9B, + 0x3E94, + 0x3E91, + 0x3E96, + 0x3E9A, + 0x3EA9, + 0x3E98, + 0x3E95, + 0x3EA6, + 0x3EA7, + 0x3EA8, + 0x3EA5, + 0x9BAB, + 0x9BA0, + 0x9BC0}; + +static const std::vector whlDeviceIds{ + 0x3EA1, + 0x3EA3, + 0x3EA4, + 0x3EA0, + 0x3EA2}; + +static const std::vector cmlDeviceIds{ + 0x9B21, + 0x9B41, + 0x9BA2, + 0x9BA4, + 0x9BA5, + 0x9BA8, + 0x9BAA, + 0x9BAC, + 0x9BC2, + 0x9BC4, + 0x9BC5, + 0x9BC6, + 0x9BC8, + 0x9BCA, + 0x9BCB, + 0x9BCC, + 0x9BE6, + 0x9BF6}; +} // namespace NEO diff --git a/shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl b/shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl index 9fa6a33869..0ab4edded9 100644 --- a/shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl +++ b/shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl @@ -5,7 +5,27 @@ * */ +#include "shared/source/gen9/cfl/device_ids_configs_cfl.h" + +#include "platforms.h" + +#include + +namespace NEO { template <> AOT::PRODUCT_CONFIG HwInfoConfigHw::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const { - return AOT::CFL; -} \ No newline at end of file + 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 \ No newline at end of file diff --git a/shared/source/gen9/glk/device_ids_configs_glk.h b/shared/source/gen9/glk/device_ids_configs_glk.h new file mode 100644 index 0000000000..0203ebcec4 --- /dev/null +++ b/shared/source/gen9/glk/device_ids_configs_glk.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector glkDeviceIds{ + 0x3184, + 0x3185}; +} // namespace NEO diff --git a/shared/source/gen9/kbl/device_ids_configs_kbl.h b/shared/source/gen9/kbl/device_ids_configs_kbl.h new file mode 100644 index 0000000000..d6cc09b5bd --- /dev/null +++ b/shared/source/gen9/kbl/device_ids_configs_kbl.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector amlDeviceIds{0x591C}; +static const std::vector 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 diff --git a/shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl b/shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl index fa253b8d08..13ec60b71a 100644 --- a/shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl +++ b/shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl @@ -5,7 +5,24 @@ * */ +#include "shared/source/gen9/kbl/device_ids_configs_kbl.h" + +#include "platforms.h" + +#include + +namespace NEO { template <> AOT::PRODUCT_CONFIG HwInfoConfigHw::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const { - return AOT::KBL; -} \ No newline at end of file + 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 \ No newline at end of file diff --git a/shared/source/gen9/linux/hw_info_config_cfl.cpp b/shared/source/gen9/linux/hw_info_config_cfl.cpp index 05f191fe18..2e433c9bc1 100644 --- a/shared/source/gen9/linux/hw_info_config_cfl.cpp +++ b/shared/source/gen9/linux/hw_info_config_cfl.cpp @@ -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::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { if (nullptr == osIface) { diff --git a/shared/source/gen9/linux/hw_info_config_kbl.cpp b/shared/source/gen9/linux/hw_info_config_kbl.cpp index aa9e1d86e6..8e23055afc 100644 --- a/shared/source/gen9/linux/hw_info_config_kbl.cpp +++ b/shared/source/gen9/linux/hw_info_config_kbl.cpp @@ -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::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { if (nullptr == osIface) { diff --git a/shared/source/gen9/skl/device_ids_configs_skl.h b/shared/source/gen9/skl/device_ids_configs_skl.h new file mode 100644 index 0000000000..4aef8b4518 --- /dev/null +++ b/shared/source/gen9/skl/device_ids_configs_skl.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector 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 diff --git a/shared/source/gen9/windows/hw_info_config_cfl.cpp b/shared/source/gen9/windows/hw_info_config_cfl.cpp index a002fd9fbf..b6418c040f 100644 --- a/shared/source/gen9/windows/hw_info_config_cfl.cpp +++ b/shared/source/gen9/windows/hw_info_config_cfl.cpp @@ -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; diff --git a/shared/source/gen9/windows/hw_info_config_kbl.cpp b/shared/source/gen9/windows/hw_info_config_kbl.cpp index d30bc77eed..2fa60dee4d 100644 --- a/shared/source/gen9/windows/hw_info_config_kbl.cpp +++ b/shared/source/gen9/windows/hw_info_config_kbl.cpp @@ -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; - } // namespace NEO diff --git a/shared/source/helpers/definitions/device_ids_configs.h b/shared/source/helpers/definitions/device_ids_configs.h index 219ede932a..0652201754 100644 --- a/shared/source/helpers/definitions/device_ids_configs.h +++ b/shared/source/helpers/definitions/device_ids_configs.h @@ -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" \ No newline at end of file diff --git a/shared/source/helpers/definitions/device_ids_configs_base.h b/shared/source/helpers/definitions/device_ids_configs_base.h new file mode 100644 index 0000000000..c57d7a271f --- /dev/null +++ b/shared/source/helpers/definitions/device_ids_configs_base.h @@ -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 diff --git a/shared/source/helpers/product_config_helper.cpp b/shared/source/helpers/product_config_helper.cpp index d46dc538ce..c0ed45fd5d 100644 --- a/shared/source/helpers/product_config_helper.cpp +++ b/shared/source/helpers/product_config_helper.cpp @@ -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 +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(device.aotConfig.ProductConfig); + } + } + return AOT::UNKNOWN_ISA; +} + +std::vector &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 ProductConfigHelper::getRepresentativeProductAcronyms() { + std::vector enabledAcronyms{}; + for (const auto &device : deviceAotInfo) { + if (!device.acronyms.empty()) { + enabledAcronyms.push_back(device.acronyms.front()); + } + } + return enabledAcronyms; +} + +std::vector ProductConfigHelper::getReleasesAcronyms() { + std::vector 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 ProductConfigHelper::getFamiliesAcronyms() { + std::vector 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 ProductConfigHelper::getAllProductAcronyms() { + std::vector allSupportedAcronyms{}; + for (const auto &device : deviceAotInfo) { + allSupportedAcronyms.insert(allSupportedAcronyms.end(), device.acronyms.begin(), device.acronyms.end()); + } + return allSupportedAcronyms; +} + +std::vector ProductConfigHelper::getDeprecatedAcronyms() { + std::vector 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(product.ProductConfig); +} diff --git a/shared/source/helpers/product_config_helper.h b/shared/source/helpers/product_config_helper.h index b47fe7be79..fafc3aea7f 100644 --- a/shared/source/helpers/product_config_helper.h +++ b/shared/source/helpers/product_config_helper.h @@ -6,10 +6,12 @@ */ #pragma once + #include "shared/source/utilities/const_stringref.h" #include #include +#include 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 - 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 *deviceIds = nullptr; + AOT::FAMILY family = {}; + AOT::RELEASE release = {}; + std::vector acronyms{}; - template - 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 + 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 + static auto findAcronymWithoutDash(const EqComparableT &lhs) { + return [&lhs](const auto &rhs) { return lhs == rhs || rhs.isEqualWithoutSeparator('-', lhs.c_str()); }; + } + + template + static auto findFamily(const EqComparableT &lhs) { + return [&lhs](const auto &rhs) { return lhs == rhs.family; }; + } + + template + static auto findRelease(const EqComparableT &lhs) { + return [&lhs](const auto &rhs) { return lhs == rhs.release; }; + } + + template + 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 &getDeviceAotInfo(); + std::vector getRepresentativeProductAcronyms(); + std::vector getReleasesAcronyms(); + std::vector getFamiliesAcronyms(); + std::vector getDeprecatedAcronyms(); + std::vector getAllProductAcronyms(); + + protected: + std::vector deviceAotInfo; }; diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index 6e15933d9e..addcbf8fc8 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -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; diff --git a/shared/source/xe_hp_core/xe_hp_sdv/device_ids_configs_xe_hp_sdv.h b/shared/source/xe_hp_core/xe_hp_sdv/device_ids_configs_xe_hp_sdv.h new file mode 100644 index 0000000000..3afd775f1b --- /dev/null +++ b/shared/source/xe_hp_core/xe_hp_sdv/device_ids_configs_xe_hp_sdv.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector xeHpSdvDeviceIds{ + 0x0201, + 0x0202, + 0x0203, + 0x0204, + 0x0205, + 0x0206, + 0x0207, + 0x0208, + 0x0209, + 0x020A, + 0x020B, + 0x020C, + 0x020D, + 0x020E, + 0x020F, + 0x0210}; +} // namespace NEO diff --git a/shared/source/xe_hpc_core/hw_cmds_pvc.h b/shared/source/xe_hpc_core/hw_cmds_pvc.h index cef89f582d..52a44e54f9 100644 --- a/shared/source/xe_hpc_core/hw_cmds_pvc.h +++ b/shared/source/xe_hpc_core/hw_cmds_pvc.h @@ -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 @@ -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) { diff --git a/shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h b/shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h new file mode 100644 index 0000000000..a202518859 --- /dev/null +++ b/shared/source/xe_hpc_core/pvc/device_ids_configs_pvc.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector pvcXlDeviceIds{0x0BD0}; +static const std::vector pvcXtDeviceIds{0x0BD5, 0x0BD6, 0x0BD7, 0x0BD8, 0x0BD9, 0x0BDA, 0x0BDB}; +} // namespace NEO \ No newline at end of file diff --git a/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2.h b/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2.h index 1aa4ed3bfd..7b21aa12a3 100644 --- a/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2.h +++ b/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2.h @@ -7,9 +7,4 @@ #pragma once -#include - -namespace NEO { -static const std::vector DG2_G10_IDS{0x4F80, 0x4F81, 0x4F82, 0x4F83, 0x4F84, 0x5690, 0x5691, 0x5692, 0x56A0, 0x56A1, 0x56A2, 0x56C0}; -static const std::vector DG2_G11_IDS{0x4F87, 0x4F88, 0x5693, 0x5694, 0x5695, 0x56A5, 0x56A6, 0x56B0, 0x56B1, 0x56C1}; -} // namespace NEO \ No newline at end of file +#include "shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2_base.h" \ No newline at end of file diff --git a/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2_base.h b/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2_base.h new file mode 100644 index 0000000000..785d06d5c8 --- /dev/null +++ b/shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2_base.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include + +namespace NEO { +static const std::vector dg2G10DeviceIds{ + 0x4F80, + 0x4F81, + 0x4F82, + 0x4F83, + 0x4F84, + 0x5690, + 0x5691, + 0x5692, + 0x56A0, + 0x56A1, + 0x56A2, + 0x56C0}; + +static const std::vector dg2G11DeviceIds{ + 0x4F87, + 0x4F88, + 0x5693, + 0x5694, + 0x5695, + 0x56A5, + 0x56A6, + 0x56B0, + 0x56B1, + 0x56C1}; + +static const std::vector dg2G12DeviceIds{ + 0x5696, + 0x5697, + 0x56A3, + 0x56A4, + 0x56B2, + 0x56B3, + 0x4F85, + 0x4F86}; +} // namespace NEO \ No newline at end of file diff --git a/shared/source/xe_hpg_core/dg2/definitions/os_agnostic_hw_info_config_dg2_extra.inl b/shared/source/xe_hpg_core/dg2/definitions/os_agnostic_hw_info_config_dg2_extra.inl index 0308cc3247..746d4f9c20 100644 --- a/shared/source/xe_hpg_core/dg2/definitions/os_agnostic_hw_info_config_dg2_extra.inl +++ b/shared/source/xe_hpg_core/dg2/definitions/os_agnostic_hw_info_config_dg2_extra.inl @@ -18,7 +18,7 @@ AOT::PRODUCT_CONFIG HwInfoConfigHw::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::getProductConfigFromHwInfo(const case 0x5: return AOT::DG2_G11_B1; } + } else if (DG2::isG12(hwInfo)) { + return AOT::DG2_G12_A0; } return AOT::UNKNOWN_ISA; } \ No newline at end of file diff --git a/shared/source/xe_hpg_core/hw_cmds_dg2.h b/shared/source/xe_hpg_core/hw_cmds_dg2.h index a337b3d52f..6b9f68beca 100644 --- a/shared/source/xe_hpg_core/hw_cmds_dg2.h +++ b/shared/source/xe_hpg_core/hw_cmds_dg2.h @@ -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(); } }; diff --git a/shared/test/common/gen12lp/adln/test_hw_info_config_adln.cpp b/shared/test/common/gen12lp/adln/test_hw_info_config_adln.cpp index e5db73fc48..e2a2d6ab58 100644 --- a/shared/test/common/gen12lp/adln/test_hw_info_config_adln.cpp +++ b/shared/test/common/gen12lp/adln/test_hw_info_config_adln.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/common/gen12lp/adlp/test_hw_info_config_adlp.cpp b/shared/test/common/gen12lp/adlp/test_hw_info_config_adlp.cpp index 6723f19aec..f347d52695 100644 --- a/shared/test/common/gen12lp/adlp/test_hw_info_config_adlp.cpp +++ b/shared/test/common/gen12lp/adlp/test_hw_info_config_adlp.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/common/gen12lp/adls/test_hw_info_config_adls.cpp b/shared/test/common/gen12lp/adls/test_hw_info_config_adls.cpp index 3aa091e48e..9b0b6ea8d7 100644 --- a/shared/test/common/gen12lp/adls/test_hw_info_config_adls.cpp +++ b/shared/test/common/gen12lp/adls/test_hw_info_config_adls.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/common/gen12lp/rkl/test_hw_info_config_rkl.cpp b/shared/test/common/gen12lp/rkl/test_hw_info_config_rkl.cpp index 435b97cf86..0600a5b320 100644 --- a/shared/test/common/gen12lp/rkl/test_hw_info_config_rkl.cpp +++ b/shared/test/common/gen12lp/rkl/test_hw_info_config_rkl.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/common/test_macros/header/common_matchers.h b/shared/test/common/test_macros/header/common_matchers.h index 569a9b771b..09740a6a5c 100644 --- a/shared/test/common/test_macros/header/common_matchers.h +++ b/shared/test/common/test_macros/header/common_matchers.h @@ -67,4 +67,6 @@ using IsPVC = IsProduct; using IsAtLeastSkl = IsAtLeastProduct; +using IsAtMostDg2 = IsAtMostProduct; + using IsNotPVC = IsNotWithinProducts; diff --git a/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp b/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp index 7f6b8d7b7c..6d2df514d8 100644 --- a/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp +++ b/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp @@ -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; @@ -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); +} \ No newline at end of file diff --git a/shared/test/common/xe_hpg_core/dg2/test_hw_info_config_dg2.cpp b/shared/test/common/xe_hpg_core/dg2/test_hw_info_config_dg2.cpp index b2cf46e830..5596155f7d 100644 --- a/shared/test/common/xe_hpg_core/dg2/test_hw_info_config_dg2.cpp +++ b/shared/test/common/xe_hpg_core/dg2/test_hw_info_config_dg2.cpp @@ -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); diff --git a/shared/test/unit_test/gen11/ehl/test_hw_info_config_ehl.cpp b/shared/test/unit_test/gen11/ehl/test_hw_info_config_ehl.cpp index 3cb7392697..d219cf5486 100644 --- a/shared/test/unit_test/gen11/ehl/test_hw_info_config_ehl.cpp +++ b/shared/test/unit_test/gen11/ehl/test_hw_info_config_ehl.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen11/icllp/test_hw_info_config_icllp.cpp b/shared/test/unit_test/gen11/icllp/test_hw_info_config_icllp.cpp index 568619c6c1..7efc009b4c 100644 --- a/shared/test/unit_test/gen11/icllp/test_hw_info_config_icllp.cpp +++ b/shared/test/unit_test/gen11/icllp/test_hw_info_config_icllp.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen11/lkf/test_hw_info_config_lkf.cpp b/shared/test/unit_test/gen11/lkf/test_hw_info_config_lkf.cpp index ce24e35511..68227fa587 100644 --- a/shared/test/unit_test/gen11/lkf/test_hw_info_config_lkf.cpp +++ b/shared/test/unit_test/gen11/lkf/test_hw_info_config_lkf.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp b/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp index 67c810fabd..3411c9ce1f 100644 --- a/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp +++ b/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen8/bdw/test_hw_info_config_bdw.cpp b/shared/test/unit_test/gen8/bdw/test_hw_info_config_bdw.cpp index d50d29abd4..1d242dc564 100644 --- a/shared/test/unit_test/gen8/bdw/test_hw_info_config_bdw.cpp +++ b/shared/test/unit_test/gen8/bdw/test_hw_info_config_bdw.cpp @@ -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()); diff --git a/shared/test/unit_test/gen9/bxt/CMakeLists.txt b/shared/test/unit_test/gen9/bxt/CMakeLists.txt index 0497670fe1..6eba85041e 100644 --- a/shared/test/unit_test/gen9/bxt/CMakeLists.txt +++ b/shared/test/unit_test/gen9/bxt/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/bxt/test_hw_info_config_bxt.cpp b/shared/test/unit_test/gen9/bxt/test_hw_info_config_bxt.cpp similarity index 92% rename from opencl/test/unit_test/gen9/bxt/test_hw_info_config_bxt.cpp rename to shared/test/unit_test/gen9/bxt/test_hw_info_config_bxt.cpp index 1ca8fc8da2..7d50717f80 100644 --- a/opencl/test/unit_test/gen9/bxt/test_hw_info_config_bxt.cpp +++ b/shared/test/unit_test/gen9/bxt/test_hw_info_config_bxt.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen9/cfl/CMakeLists.txt b/shared/test/unit_test/gen9/cfl/CMakeLists.txt index dfd4feedd2..31f4a0b48b 100644 --- a/shared/test/unit_test/gen9/cfl/CMakeLists.txt +++ b/shared/test/unit_test/gen9/cfl/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/cfl/test_hw_info_config_cfl.cpp b/shared/test/unit_test/gen9/cfl/test_hw_info_config_cfl.cpp similarity index 79% rename from opencl/test/unit_test/gen9/cfl/test_hw_info_config_cfl.cpp rename to shared/test/unit_test/gen9/cfl/test_hw_info_config_cfl.cpp index f7e55f091d..520ca7062b 100644 --- a/opencl/test/unit_test/gen9/cfl/test_hw_info_config_cfl.cpp +++ b/shared/test/unit_test/gen9/cfl/test_hw_info_config_cfl.cpp @@ -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); +} diff --git a/shared/test/unit_test/gen9/glk/CMakeLists.txt b/shared/test/unit_test/gen9/glk/CMakeLists.txt index aff45f7b01..6558ce90ba 100644 --- a/shared/test/unit_test/gen9/glk/CMakeLists.txt +++ b/shared/test/unit_test/gen9/glk/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/glk/test_hw_info_config_glk.cpp b/shared/test/unit_test/gen9/glk/test_hw_info_config_glk.cpp similarity index 91% rename from opencl/test/unit_test/gen9/glk/test_hw_info_config_glk.cpp rename to shared/test/unit_test/gen9/glk/test_hw_info_config_glk.cpp index 77b289b2c2..1ce4393c95 100644 --- a/opencl/test/unit_test/gen9/glk/test_hw_info_config_glk.cpp +++ b/shared/test/unit_test/gen9/glk/test_hw_info_config_glk.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen9/kbl/CMakeLists.txt b/shared/test/unit_test/gen9/kbl/CMakeLists.txt index 7b6ddea453..2ac569a96a 100644 --- a/shared/test/unit_test/gen9/kbl/CMakeLists.txt +++ b/shared/test/unit_test/gen9/kbl/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/kbl/test_hw_info_config_kbl.cpp b/shared/test/unit_test/gen9/kbl/test_hw_info_config_kbl.cpp similarity index 84% rename from opencl/test/unit_test/gen9/kbl/test_hw_info_config_kbl.cpp rename to shared/test/unit_test/gen9/kbl/test_hw_info_config_kbl.cpp index 7dc555eb14..ae257e5d0a 100644 --- a/opencl/test/unit_test/gen9/kbl/test_hw_info_config_kbl.cpp +++ b/shared/test/unit_test/gen9/kbl/test_hw_info_config_kbl.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/gen9/skl/CMakeLists.txt b/shared/test/unit_test/gen9/skl/CMakeLists.txt index 654db45a89..1c9173936a 100644 --- a/shared/test/unit_test/gen9/skl/CMakeLists.txt +++ b/shared/test/unit_test/gen9/skl/CMakeLists.txt @@ -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() diff --git a/opencl/test/unit_test/gen9/skl/test_hw_info_config_skl.cpp b/shared/test/unit_test/gen9/skl/test_hw_info_config_skl.cpp similarity index 93% rename from opencl/test/unit_test/gen9/skl/test_hw_info_config_skl.cpp rename to shared/test/unit_test/gen9/skl/test_hw_info_config_skl.cpp index 2942409912..1d348efc24 100644 --- a/opencl/test/unit_test/gen9/skl/test_hw_info_config_skl.cpp +++ b/shared/test/unit_test/gen9/skl/test_hw_info_config_skl.cpp @@ -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); +} \ No newline at end of file diff --git a/shared/test/unit_test/helpers/product_config_helper_tests.cpp b/shared/test/unit_test/helpers/product_config_helper_tests.cpp index 346f772601..2a88f23e2b 100644 --- a/shared/test/unit_test/helpers/product_config_helper_tests.cpp +++ b/shared/test/unit_test/helpers/product_config_helper_tests.cpp @@ -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 + 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(); + } + std::unique_ptr productConfigHelper; +}; + +template +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(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 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); + } } \ No newline at end of file diff --git a/shared/test/unit_test/helpers/test_hw_info_config.cpp b/shared/test/unit_test/helpers/test_hw_info_config.cpp index 369710b444..bd8a94b9bc 100644 --- a/shared/test/unit_test/helpers/test_hw_info_config.cpp +++ b/shared/test/unit_test/helpers/test_hw_info_config.cpp @@ -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) { diff --git a/shared/test/unit_test/xe_hp_core/product_config_tests_xe_hp_core.cpp b/shared/test/unit_test/xe_hp_core/product_config_tests_xe_hp_core.cpp index a684016f7c..b354313f0e 100644 --- a/shared/test/unit_test/xe_hp_core/product_config_tests_xe_hp_core.cpp +++ b/shared/test/unit_test/xe_hp_core/product_config_tests_xe_hp_core.cpp @@ -17,7 +17,7 @@ XE_HP_CORE_TEST_F(ProductConfigHelperXeHpCoreTests, givenVariousVariantsOfXeHpAc std::vector 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); } } \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpc_core/pvc/dispatch_walker_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/dispatch_walker_tests_pvc.cpp index 189a3e20b5..2c97d9ae87 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/dispatch_walker_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/dispatch_walker_tests_pvc.cpp @@ -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); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp index f0eaad9a48..99a84b8427 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp @@ -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)); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/product_config_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/product_config_helper_tests_pvc.cpp index 13a34c46e4..994c95ee6f 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/product_config_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/product_config_helper_tests_pvc.cpp @@ -19,7 +19,7 @@ PVCTEST_F(ProductConfigHelperPvcTests, givenVariousVariantsOfXeHpcAcronymsWhenGe std::vector 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); } } \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpc_core/pvc/product_config_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/product_config_tests_pvc.cpp index dd6cd2730c..1e1e045690 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/product_config_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/product_config_tests_pvc.cpp @@ -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; diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp index bc3b52bd0b..8066e81e83 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp @@ -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::adjustPipelineSelect(*cmdContainer.get(), dispatchInterface->kernelDescriptor); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp index 6f139a7ae2..a05ce9f7f2 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp @@ -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)); } diff --git a/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt b/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt index f87ec44a47..fefb5a66c0 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt +++ b/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt @@ -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() diff --git a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp index 48998afdc2..0abde1c21c 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp @@ -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) { diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp index 851c4aebd7..b7faef9cb7 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp @@ -19,7 +19,7 @@ DG2TEST_F(ProductConfigHelperDg2Tests, givenVariousVariantsOfXeHpgAcronymsWhenGe std::vector 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); } } \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_tests_dg2.cpp deleted file mode 100644 index 19ae997afb..0000000000 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_tests_dg2.cpp +++ /dev/null @@ -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); -} \ No newline at end of file