2022-03-11 01:27:38 +08:00
|
|
|
/*
|
2022-12-16 22:13:42 +08:00
|
|
|
* Copyright (C) 2022-2023 Intel Corporation
|
2022-03-11 01:27:38 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2022-07-08 19:29:59 +08:00
|
|
|
|
2022-12-06 23:59:36 +08:00
|
|
|
#include "shared/source/helpers/hw_ip_version.h"
|
2022-06-14 07:13:43 +08:00
|
|
|
#include "shared/source/utilities/const_stringref.h"
|
|
|
|
|
2022-11-15 23:24:52 +08:00
|
|
|
#include "igfxfmid.h"
|
|
|
|
|
|
|
|
#include <algorithm>
|
2022-03-11 01:27:38 +08:00
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
2022-07-08 19:29:59 +08:00
|
|
|
#include <vector>
|
2022-03-11 01:27:38 +08:00
|
|
|
|
2022-06-20 20:16:05 +08:00
|
|
|
namespace AOT {
|
|
|
|
enum PRODUCT_CONFIG : uint32_t;
|
|
|
|
enum RELEASE : uint32_t;
|
|
|
|
enum FAMILY : uint32_t;
|
|
|
|
} // namespace AOT
|
|
|
|
|
2022-07-08 19:29:59 +08:00
|
|
|
namespace NEO {
|
|
|
|
struct HardwareInfo;
|
|
|
|
} // namespace NEO
|
|
|
|
|
|
|
|
struct DeviceAotInfo {
|
2022-12-06 23:59:36 +08:00
|
|
|
NEO::HardwareIpVersion aotConfig{};
|
2022-07-08 19:29:59 +08:00
|
|
|
const NEO::HardwareInfo *hwInfo = nullptr;
|
|
|
|
const std::vector<unsigned short> *deviceIds = nullptr;
|
|
|
|
AOT::FAMILY family = {};
|
|
|
|
AOT::RELEASE release = {};
|
2022-12-16 22:13:42 +08:00
|
|
|
std::vector<NEO::ConstStringRef> deviceAcronyms{};
|
|
|
|
std::vector<NEO::ConstStringRef> rtlIdAcronyms{};
|
2022-06-14 20:49:57 +08:00
|
|
|
|
2022-07-08 19:29:59 +08:00
|
|
|
bool operator==(const DeviceAotInfo &rhs) {
|
2022-12-06 23:59:36 +08:00
|
|
|
return aotConfig.value == rhs.aotConfig.value && family == rhs.family && release == rhs.release && hwInfo == rhs.hwInfo;
|
2022-06-14 20:49:57 +08:00
|
|
|
}
|
2022-07-08 19:29:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ProductConfigHelper {
|
|
|
|
public:
|
|
|
|
ProductConfigHelper();
|
|
|
|
enum ConfigStatus {
|
|
|
|
MismatchedValue = -1,
|
|
|
|
};
|
2022-06-14 20:49:57 +08:00
|
|
|
static void adjustDeviceName(std::string &device);
|
2022-12-06 23:59:36 +08:00
|
|
|
static std::string parseMajorMinorValue(NEO::HardwareIpVersion config);
|
|
|
|
static std::string parseMajorMinorRevisionValue(NEO::HardwareIpVersion config);
|
2022-07-08 19:29:59 +08:00
|
|
|
static int parseProductConfigFromString(const std::string &device, size_t begin, size_t end);
|
2022-06-14 07:13:43 +08:00
|
|
|
inline static std::string parseMajorMinorRevisionValue(AOT::PRODUCT_CONFIG config) {
|
2022-03-11 01:27:38 +08:00
|
|
|
std::stringstream stringConfig;
|
2022-12-06 23:59:36 +08:00
|
|
|
NEO::HardwareIpVersion aotConfig = {0};
|
|
|
|
aotConfig.value = config;
|
2022-06-14 07:13:43 +08:00
|
|
|
return parseMajorMinorRevisionValue(aotConfig);
|
2022-03-11 01:27:38 +08:00
|
|
|
}
|
|
|
|
|
2022-11-17 00:30:56 +08:00
|
|
|
static std::vector<NEO::ConstStringRef> getDeviceAcronyms();
|
2023-04-18 00:11:43 +08:00
|
|
|
static NEO::ConstStringRef getAcronymFromAFamily(AOT::FAMILY family);
|
|
|
|
static uint32_t getProductConfigFromVersionValue(const std::string &device);
|
|
|
|
static AOT::PRODUCT_CONFIG getProductConfigFromAcronym(const std::string &device);
|
2022-07-08 19:29:59 +08:00
|
|
|
|
|
|
|
static bool compareConfigs(DeviceAotInfo deviceAotInfo0, DeviceAotInfo deviceAotInfo1);
|
|
|
|
|
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findMapAcronymWithoutDash(const EqComparableT &lhs) {
|
|
|
|
return [&lhs](const auto &rhs) {
|
|
|
|
NEO::ConstStringRef ptrStr(rhs.first);
|
|
|
|
return lhs == ptrStr || ptrStr.isEqualWithoutSeparator('-', lhs.c_str()); };
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findAcronymWithoutDash(const EqComparableT &lhs) {
|
|
|
|
return [&lhs](const auto &rhs) { return lhs == rhs || rhs.isEqualWithoutSeparator('-', lhs.c_str()); };
|
|
|
|
}
|
|
|
|
|
2022-11-15 23:24:52 +08:00
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findAcronym(const EqComparableT &lhs) {
|
2022-12-16 22:13:42 +08:00
|
|
|
return [&lhs](const auto &rhs) { return std::any_of(rhs.deviceAcronyms.begin(), rhs.deviceAcronyms.end(), findAcronymWithoutDash(lhs)) ||
|
|
|
|
std::any_of(rhs.rtlIdAcronyms.begin(), rhs.rtlIdAcronyms.end(), findAcronymWithoutDash(lhs)); };
|
2022-11-15 23:24:52 +08:00
|
|
|
}
|
|
|
|
|
2022-07-08 19:29:59 +08:00
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findFamily(const EqComparableT &lhs) {
|
|
|
|
return [&lhs](const auto &rhs) { return lhs == rhs.family; };
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findRelease(const EqComparableT &lhs) {
|
|
|
|
return [&lhs](const auto &rhs) { return lhs == rhs.release; };
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findProductConfig(const EqComparableT &lhs) {
|
2022-12-06 23:59:36 +08:00
|
|
|
return [&lhs](const auto &rhs) { return lhs == rhs.aotConfig.value; };
|
2022-07-08 19:29:59 +08:00
|
|
|
}
|
|
|
|
|
2022-12-16 22:13:42 +08:00
|
|
|
template <typename EqComparableT>
|
|
|
|
static auto findDeviceAcronymForRelease(const EqComparableT &lhs) {
|
|
|
|
return [&lhs](const auto &rhs) { return lhs == rhs.release && !rhs.deviceAcronyms.empty(); };
|
|
|
|
}
|
|
|
|
|
2022-11-17 00:30:56 +08:00
|
|
|
void initialize();
|
2023-04-18 00:11:43 +08:00
|
|
|
bool isSupportedFamily(uint32_t family) const;
|
|
|
|
bool isSupportedRelease(uint32_t release) const;
|
|
|
|
bool isSupportedProductConfig(uint32_t config) const;
|
2023-05-12 21:46:58 +08:00
|
|
|
bool getDeviceAotInfoForProductConfig(uint32_t config, DeviceAotInfo &out) const;
|
2022-11-17 00:30:56 +08:00
|
|
|
|
2022-07-08 19:29:59 +08:00
|
|
|
std::vector<DeviceAotInfo> &getDeviceAotInfo();
|
|
|
|
std::vector<NEO::ConstStringRef> getRepresentativeProductAcronyms();
|
|
|
|
std::vector<NEO::ConstStringRef> getReleasesAcronyms();
|
|
|
|
std::vector<NEO::ConstStringRef> getFamiliesAcronyms();
|
|
|
|
std::vector<NEO::ConstStringRef> getDeprecatedAcronyms();
|
|
|
|
std::vector<NEO::ConstStringRef> getAllProductAcronyms();
|
2023-04-18 00:11:43 +08:00
|
|
|
AOT::FAMILY getFamilyFromDeviceName(const std::string &device) const;
|
|
|
|
AOT::PRODUCT_CONFIG getProductConfigFromDeviceName(const std::string &device) const;
|
|
|
|
PRODUCT_FAMILY getProductFamilyFromDeviceName(const std::string &device) const;
|
|
|
|
AOT::RELEASE getReleaseFromDeviceName(const std::string &device) const;
|
|
|
|
const std::string getAcronymForProductConfig(uint32_t config) const;
|
2022-07-08 19:29:59 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
std::vector<DeviceAotInfo> deviceAotInfo;
|
2022-03-11 01:27:38 +08:00
|
|
|
};
|