mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
fix: add missing support for acronyms without dashes
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
20e22deced
commit
d7c7cb203c
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 <algorithm>
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user