feature: Add support for older ocloc libraries to create fatbinary w/legacy devs

Related-To: NEO-9630
Signed-off-by: Krzysztof Sprzaczkowski <krzysztof.sprzaczkowski@intel.com>
This commit is contained in:
Krzysztof Sprzaczkowski
2025-10-17 12:49:16 +00:00
committed by Compute-Runtime-Automation
parent 7ee4f2d0aa
commit 07a858ffb9
18 changed files with 1325 additions and 264 deletions

View File

@@ -132,6 +132,8 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}product_config_helper_extra.cpp
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_former.cpp
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_former.h
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math.h
${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/register_offsets.h

View File

@@ -9,6 +9,7 @@
#include "shared/source/helpers/hw_mapper.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/helpers/product_config_helper_former.h"
#include "shared/source/utilities/stackvec.h"
#include "neo_igfxfmid.h"

View File

@@ -79,6 +79,26 @@ void ProductConfigHelper::adjustClosedRangeDeviceLegacyAcronyms(std::string &ran
}
}
AOT::PRODUCT_CONFIG ProductConfigHelper::getLastProductConfigFromFamilyName(AOT::FAMILY family) {
uint32_t lastProduct = AOT::UNKNOWN_ISA;
for (const auto &device : deviceAotInfo) {
if (device.family == family) {
lastProduct = device.aotConfig.value;
}
}
return static_cast<AOT::PRODUCT_CONFIG>(lastProduct);
}
AOT::PRODUCT_CONFIG ProductConfigHelper::getLastProductConfigFromReleaseName(AOT::RELEASE release) {
uint32_t lastProduct = AOT::UNKNOWN_ISA;
for (const auto &device : deviceAotInfo) {
if (device.release == release) {
lastProduct = device.aotConfig.value;
}
}
return static_cast<AOT::PRODUCT_CONFIG>(lastProduct);
}
NEO::ConstStringRef ProductConfigHelper::getAcronymFromAFamily(AOT::FAMILY family) {
for (const auto &[acronym, value] : AOT::familyAcronyms) {
if (value == family) {

View File

@@ -60,6 +60,8 @@ struct ProductConfigHelper {
}
static std::vector<NEO::ConstStringRef> getDeviceAcronyms();
AOT::PRODUCT_CONFIG getLastProductConfigFromFamilyName(AOT::FAMILY family);
AOT::PRODUCT_CONFIG getLastProductConfigFromReleaseName(AOT::RELEASE release);
static NEO::ConstStringRef getAcronymFromAFamily(AOT::FAMILY family);
static NEO::ConstStringRef getAcronymFromARelease(AOT::RELEASE release);
static uint32_t getProductConfigFromVersionValue(const std::string &device);

View File

@@ -0,0 +1,170 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/product_config_helper_former.h"
#include "shared/source/helpers/hw_info.h"
#include "device_ids_configs.h"
#include "hw_cmds.h"
#include "neo_aot_platforms.h"
FormerProductConfigHelper::FormerProductConfigHelper()
: helper(Ocloc::SupportedDevicesMode::concat, nullptr) {
data = helper.collectFormerSupportedDevicesData();
}
Ocloc::SupportedDevicesHelper::SupportedDevicesData &FormerProductConfigHelper::getData() {
return data;
}
template <>
bool FormerProductConfigHelper::isSupportedTarget<AOT::FAMILY>(const std::string &target) const {
return std::any_of(
data.familyGroups.begin(), data.familyGroups.end(),
[&](const auto &pair) { return pair.first == target; });
}
template <>
bool FormerProductConfigHelper::isSupportedTarget<AOT::RELEASE>(const std::string &target) const {
return std::any_of(
data.releaseGroups.begin(), data.releaseGroups.end(),
[&](const auto &pair) { return pair.first == target; });
}
bool FormerProductConfigHelper::isSupportedProductConfig(uint32_t config) const {
if (config == AOT::UNKNOWN_ISA) {
return false;
}
return std::any_of(data.deviceIpVersions.begin(), data.deviceIpVersions.end(),
[config](uint32_t v) { return v == config; });
}
std::vector<NEO::ConstStringRef> FormerProductConfigHelper::getProductAcronymsFromFamilyGroup(const std::string &groupName) const {
return getProductAcronymsFromGroup(groupName, data.familyGroups);
}
std::vector<NEO::ConstStringRef> FormerProductConfigHelper::getProductAcronymsFromReleaseGroup(const std::string &groupName) const {
return getProductAcronymsFromGroup(groupName, data.releaseGroups);
}
AOT::PRODUCT_CONFIG FormerProductConfigHelper::getProductConfigFromDeviceName(const std::string &device) {
uint32_t config = AOT::UNKNOWN_ISA;
char hexPrefixLength = 2;
if (device.find(".") != std::string::npos) {
config = ProductConfigHelper::getProductConfigFromVersionValue(device);
} else if (std::all_of(device.begin(), device.end(), (::isdigit))) {
config = static_cast<uint32_t>(std::stoul(device));
} else if (device.substr(0, hexPrefixLength) == "0x" && std::all_of(device.begin() + hexPrefixLength, device.end(), (::isxdigit))) {
auto deviceId = static_cast<unsigned short>(std::stoi(device, 0, 16));
config = getProductConfigFromDeviceId(deviceId);
} else {
config = getProductConfigFromAcronym(device);
}
return static_cast<AOT::PRODUCT_CONFIG>(config);
}
AOT::PRODUCT_CONFIG FormerProductConfigHelper::getProductConfigFromAcronym(const std::string &device) {
auto it = std::find_if(
data.acronyms.begin(), data.acronyms.end(),
[&](const auto &pair) { return pair.first == device; });
if (it != data.acronyms.end()) {
return static_cast<AOT::PRODUCT_CONFIG>(it->second);
}
return AOT::UNKNOWN_ISA;
}
AOT::PRODUCT_CONFIG FormerProductConfigHelper::getProductConfigFromDeviceId(const uint32_t &deviceId) {
auto it = std::find_if(
data.deviceInfos.begin(), data.deviceInfos.end(),
[&](const auto &deviceInfo) { return deviceInfo.deviceId == deviceId; });
if (it != data.deviceInfos.end()) {
return static_cast<AOT::PRODUCT_CONFIG>(it->ipVersion);
}
return AOT::UNKNOWN_ISA;
}
AOT::PRODUCT_CONFIG FormerProductConfigHelper::getFirstProductConfig() {
uint32_t firstProduct = AOT::UNKNOWN_ISA;
if (!data.acronyms.empty()) {
auto &firstProductPair = data.acronyms.front();
firstProduct = firstProductPair.second;
}
return static_cast<AOT::PRODUCT_CONFIG>(firstProduct);
}
bool FormerProductConfigHelper::isFamilyName(const std::string &family) {
return std::any_of(
data.familyGroups.begin(), data.familyGroups.end(),
[&family](const auto &pair) {
return pair.first == family;
});
}
bool FormerProductConfigHelper::isReleaseName(const std::string &release) {
return std::any_of(
data.releaseGroups.begin(), data.releaseGroups.end(),
[&release](const auto &pair) {
return pair.first == release;
});
}
std::string FormerProductConfigHelper::getFamilyName(Position pos) {
if (data.familyGroups.empty()) {
return "";
}
if (pos == Position::firstItem) {
return data.familyGroups.front().first;
} else {
return data.familyGroups.back().first;
}
}
std::string FormerProductConfigHelper::getReleaseName(Position pos) {
if (data.releaseGroups.empty()) {
return "";
}
if (pos == Position::firstItem) {
return data.releaseGroups.front().first;
} else {
return data.releaseGroups.back().first;
}
}
AOT::PRODUCT_CONFIG FormerProductConfigHelper::getProductConfigFromFamilyName(const std::string &family, Position pos) {
for (const auto &[acronym, value] : data.familyGroups) {
if (acronym == family && !value.empty()) {
if (pos == Position::firstItem) {
return static_cast<AOT::PRODUCT_CONFIG>(value.front());
} else {
return static_cast<AOT::PRODUCT_CONFIG>(value.back());
}
}
}
return AOT::UNKNOWN_ISA;
}
AOT::PRODUCT_CONFIG FormerProductConfigHelper::getProductConfigFromReleaseName(const std::string &release, Position pos) {
for (const auto &[acronym, value] : data.releaseGroups) {
if (acronym == release && !value.empty()) {
if (pos == Position::firstItem) {
return static_cast<AOT::PRODUCT_CONFIG>(value.front());
} else {
return static_cast<AOT::PRODUCT_CONFIG>(value.back());
}
}
}
return AOT::UNKNOWN_ISA;
}
std::vector<NEO::ConstStringRef> FormerProductConfigHelper::getRepresentativeProductAcronyms() {
std::vector<NEO::ConstStringRef> enabledAcronyms{};
for (const auto &[acronym, ipVersion] : data.acronyms) {
enabledAcronyms.push_back(acronym.c_str());
}
return enabledAcronyms;
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/offline_compiler/source/ocloc_api.h"
#include "shared/offline_compiler/source/ocloc_interface.h"
#include "shared/offline_compiler/source/ocloc_supported_devices_helper.h"
#include "shared/source/helpers/hw_ip_version.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/utilities/const_stringref.h"
#include "neo_igfxfmid.h"
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
struct ProductConfigHelper;
struct FormerProductConfigHelper {
public:
enum class Position { firstItem,
lastItem };
FormerProductConfigHelper();
Ocloc::SupportedDevicesHelper::SupportedDevicesData &getData();
template <typename T>
bool isSupportedTarget(const std::string &target) const;
bool isSupportedProductConfig(uint32_t config) const;
std::vector<NEO::ConstStringRef> getProductAcronymsFromFamilyGroup(const std::string &groupName) const;
std::vector<NEO::ConstStringRef> getProductAcronymsFromReleaseGroup(const std::string &groupName) const;
AOT::PRODUCT_CONFIG getProductConfigFromDeviceName(const std::string &device);
AOT::PRODUCT_CONFIG getProductConfigFromAcronym(const std::string &device);
AOT::PRODUCT_CONFIG getProductConfigFromDeviceId(const uint32_t &deviceId);
AOT::PRODUCT_CONFIG getFirstProductConfig();
bool isFamilyName(const std::string &family);
bool isReleaseName(const std::string &release);
std::string getFamilyName(Position pos);
std::string getReleaseName(Position pos);
AOT::PRODUCT_CONFIG getProductConfigFromFamilyName(const std::string &family, Position pos);
AOT::PRODUCT_CONFIG getProductConfigFromReleaseName(const std::string &release, Position pos);
std::vector<NEO::ConstStringRef> getRepresentativeProductAcronyms();
protected:
template <typename GroupT>
std::vector<NEO::ConstStringRef> getProductAcronymsFromGroup(const std::string &groupName, const GroupT &groups) const;
Ocloc::SupportedDevicesHelper helper;
Ocloc::SupportedDevicesHelper::SupportedDevicesData data;
};
template <typename GroupT>
std::vector<NEO::ConstStringRef> FormerProductConfigHelper::getProductAcronymsFromGroup(const std::string &groupName, const GroupT &groups) const {
std::vector<NEO::ConstStringRef> enabledAcronyms{};
for (const auto &[name, ipVersions] : groups) {
if (name == groupName) {
for (const auto &ipVersion : ipVersions) {
auto it = std::find_if(data.acronyms.begin(), data.acronyms.end(),
[&ipVersion](const std::pair<std::string, uint32_t> &pair) {
return pair.second == ipVersion;
});
if (it != data.acronyms.end()) {
enabledAcronyms.push_back(it->first);
}
}
}
}
return enabledAcronyms;
}