diff --git a/shared/offline_compiler/source/CMakeLists.txt b/shared/offline_compiler/source/CMakeLists.txt index 00d8433367..f88b4743ca 100644 --- a/shared/offline_compiler/source/CMakeLists.txt +++ b/shared/offline_compiler/source/CMakeLists.txt @@ -68,7 +68,6 @@ set(CLOC_LIB_SRCS_LIB ${NEO_SHARED_DIRECTORY}/helpers/hw_info_helper.h ${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.cpp ${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.h - ${NEO_SHARED_DIRECTORY}/helpers${BRANCH_DIR_SUFFIX}product_config_helper_extra.cpp ${NEO_SHARED_DIRECTORY}/os_interface/os_library.h ${NEO_SHARED_DIRECTORY}/release_helper/release_helper.h ${NEO_SHARED_DIRECTORY}/release_helper/release_helper.cpp diff --git a/shared/source/helpers/CMakeLists.txt b/shared/source/helpers/CMakeLists.txt index e8e2cd5959..40bba98f61 100644 --- a/shared/source/helpers/CMakeLists.txt +++ b/shared/source/helpers/CMakeLists.txt @@ -136,7 +136,6 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.h ${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper.h - ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}product_config_helper_extra.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ptr_math.h ${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/register_offsets.h diff --git a/shared/source/helpers/product_config_helper.cpp b/shared/source/helpers/product_config_helper.cpp index 311b2447f8..bee5097245 100644 --- a/shared/source/helpers/product_config_helper.cpp +++ b/shared/source/helpers/product_config_helper.cpp @@ -296,3 +296,31 @@ uint32_t ProductConfigHelper::getProductConfigFromVersionValue(const std::string return product.value; } +void ProductConfigHelper::initialize() { + for (auto &device : deviceAotInfo) { + for (const auto &[acronym, value] : AOT::deviceAcronyms) { + if (value == device.aotConfig.value) { + device.deviceAcronyms.push_back(NEO::ConstStringRef(acronym)); + } + } + + for (const auto &[acronym, value] : AOT::rtlIdAcronyms) { + if (value == device.aotConfig.value) { + device.rtlIdAcronyms.push_back(NEO::ConstStringRef(acronym)); + } + } + } +} + +AOT::PRODUCT_CONFIG ProductConfigHelper::getProductConfigFromAcronym(const std::string &device) { + auto deviceAcronymIt = std::find_if(AOT::deviceAcronyms.begin(), AOT::deviceAcronyms.end(), findMapAcronymWithoutDash(device)); + if (deviceAcronymIt != AOT::deviceAcronyms.end()) { + return deviceAcronymIt->second; + } + + auto rtlIdAcronymIt = std::find_if(AOT::rtlIdAcronyms.begin(), AOT::rtlIdAcronyms.end(), findMapAcronymWithoutDash(device)); + if (rtlIdAcronymIt != AOT::rtlIdAcronyms.end()) { + return rtlIdAcronymIt->second; + } + return AOT::UNKNOWN_ISA; +} diff --git a/shared/source/helpers/product_config_helper_extra.cpp b/shared/source/helpers/product_config_helper_extra.cpp deleted file mode 100644 index 6b6d7aff8c..0000000000 --- a/shared/source/helpers/product_config_helper_extra.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2022-2023 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/product_config_helper.h" - -#include "platforms.h" - -#include - -void ProductConfigHelper::initialize() { - for (auto &device : deviceAotInfo) { - for (const auto &[acronym, value] : AOT::deviceAcronyms) { - if (value == device.aotConfig.value) { - device.deviceAcronyms.push_back(NEO::ConstStringRef(acronym)); - } - } - } -} - -AOT::PRODUCT_CONFIG ProductConfigHelper::getProductConfigFromAcronym(const std::string &device) { - auto it = std::find_if(AOT::deviceAcronyms.begin(), AOT::deviceAcronyms.end(), findMapAcronymWithoutDash(device)); - if (it == AOT::deviceAcronyms.end()) - return AOT::UNKNOWN_ISA; - return it->second; -} 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 fcd2467d41..1018fd26b9 100644 --- a/shared/test/unit_test/helpers/product_config_helper_tests.cpp +++ b/shared/test/unit_test/helpers/product_config_helper_tests.cpp @@ -299,7 +299,12 @@ TEST_F(AotDeviceInfoTests, givenProductOrAotConfigWhenParseMajorMinorRevisionVal } TEST_F(AotDeviceInfoTests, givenProductAcronymWhenRemoveDashesFromTheNameThenStillCorrectValueIsReturned) { + uint32_t numSupportedAcronyms = 0; for (const auto &[acronym, value] : AOT::deviceAcronyms) { + if (!productConfigHelper->isSupportedProductConfig(value)) { + continue; + } + numSupportedAcronyms++; std::string acronymCopy = acronym; auto findDash = acronymCopy.find("-"); @@ -309,10 +314,30 @@ TEST_F(AotDeviceInfoTests, givenProductAcronymWhenRemoveDashesFromTheNameThenSti EXPECT_EQ(productConfigHelper->getProductConfigFromDeviceName(acronymCopy), value); } + for (const auto &[acronym, value] : AOT::rtlIdAcronyms) { + if (!productConfigHelper->isSupportedProductConfig(value)) { + continue; + } + numSupportedAcronyms++; + std::string acronymCopy = acronym; + + auto findDash = acronymCopy.find("-"); + if (findDash != std::string::npos) { + acronymCopy.erase(std::remove(acronymCopy.begin(), acronymCopy.end(), '-'), acronymCopy.end()); + } + + EXPECT_EQ(productConfigHelper->getProductConfigFromDeviceName(acronymCopy), value); + } + EXPECT_LT(0u, numSupportedAcronyms); } TEST_F(AotDeviceInfoTests, givenReleaseAcronymWhenRemoveDashesFromTheNameThenStillCorrectValueIsReturned) { + uint32_t numSupportedAcronyms = 0; for (const auto &[acronym, value] : AOT::releaseAcronyms) { + if (!productConfigHelper->isSupportedRelease(value)) { + continue; + } + numSupportedAcronyms++; std::string acronymCopy = acronym; auto findDash = acronymCopy.find("-"); @@ -322,10 +347,16 @@ TEST_F(AotDeviceInfoTests, givenReleaseAcronymWhenRemoveDashesFromTheNameThenSti EXPECT_EQ(productConfigHelper->getReleaseFromDeviceName(acronymCopy), value); } + EXPECT_LT(0u, numSupportedAcronyms); } TEST_F(AotDeviceInfoTests, givenFamilyAcronymWhenRemoveDashesFromTheNameThenStillCorrectValueIsReturned) { + uint32_t numSupportedAcronyms = 0; for (const auto &[acronym, value] : AOT::familyAcronyms) { + if (!productConfigHelper->isSupportedFamily(value)) { + continue; + } + numSupportedAcronyms++; std::string acronymCopy = acronym; auto findDash = acronymCopy.find("-"); @@ -335,6 +366,7 @@ TEST_F(AotDeviceInfoTests, givenFamilyAcronymWhenRemoveDashesFromTheNameThenStil EXPECT_EQ(productConfigHelper->getFamilyFromDeviceName(acronymCopy), value); } + EXPECT_LT(0u, numSupportedAcronyms); } TEST_F(AotDeviceInfoTests, givenProductConfigAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {