mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 13:54:58 +08:00
Ocloc: New AOT design implementation
Ocloc will handle any new values that may be passed to the -device argument. Supported acronyms are available under cmd: ocloc compile --help Supported patterns: - device acronym - release acronym - family acronym - version (major.minor.revision) Fatbinary will no longer handle major.minor.revision variances, only acronyms allowed. Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2a71266708
commit
6d365cbfc3
@@ -361,6 +361,11 @@ if(NOT DEFINED KHRONOS_GL_HEADERS_DIR)
|
||||
endif()
|
||||
message(STATUS "Khronos OpenGL headers dir: ${KHRONOS_GL_HEADERS_DIR}")
|
||||
|
||||
if(NOT DEFINED AOT_CONFIG_HEADERS_DIR)
|
||||
get_filename_component(AOT_CONFIG_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}aot_config_headers" ABSOLUTE)
|
||||
message(STATUS "AOT config headers dir: ${AOT_CONFIG_HEADERS_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT THIRD_PARTY_DIR)
|
||||
get_filename_component(THIRD_PARTY_DIR "../third_party/" ABSOLUTE)
|
||||
endif()
|
||||
@@ -722,6 +727,7 @@ endif()
|
||||
|
||||
# Project-wide include paths
|
||||
# Please keep alphabetical order
|
||||
include_directories(${AOT_CONFIG_HEADERS_DIR})
|
||||
include_directories(${NEO_BUILD_DIR})
|
||||
include_directories(${NEO_SOURCE_DIR})
|
||||
include_directories(${NEO_SHARED_DIRECTORY}/aub_mem_dump/definitions${BRANCH_DIR_SUFFIX})
|
||||
|
||||
@@ -2036,13 +2036,14 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
|
||||
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
|
||||
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
|
||||
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
|
||||
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
|
||||
@@ -2051,7 +2052,7 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ 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_fatbinary_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fatbinary_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fcl_facade_tests.cpp
|
||||
|
||||
@@ -23,6 +23,7 @@ class MockOfflineCompiler : public OfflineCompiler {
|
||||
using OfflineCompiler::appendExtraInternalOptions;
|
||||
using OfflineCompiler::argHelper;
|
||||
using OfflineCompiler::buildIrBinary;
|
||||
using OfflineCompiler::deviceConfig;
|
||||
using OfflineCompiler::deviceName;
|
||||
using OfflineCompiler::elfBinary;
|
||||
using OfflineCompiler::excludeIr;
|
||||
@@ -36,6 +37,7 @@ class MockOfflineCompiler : public OfflineCompiler {
|
||||
using OfflineCompiler::hwInfo;
|
||||
using OfflineCompiler::igcFacade;
|
||||
using OfflineCompiler::initHardwareInfo;
|
||||
using OfflineCompiler::initHardwareInfoForProductConfig;
|
||||
using OfflineCompiler::inputFile;
|
||||
using OfflineCompiler::inputFileLlvm;
|
||||
using OfflineCompiler::inputFileSpirV;
|
||||
@@ -49,6 +51,7 @@ class MockOfflineCompiler : public OfflineCompiler {
|
||||
using OfflineCompiler::outputNoSuffix;
|
||||
using OfflineCompiler::parseCommandLine;
|
||||
using OfflineCompiler::parseDebugSettings;
|
||||
using OfflineCompiler::revisionId;
|
||||
using OfflineCompiler::setStatelessToStatefullBufferOffsetFlag;
|
||||
using OfflineCompiler::sourceCode;
|
||||
using OfflineCompiler::storeBinary;
|
||||
|
||||
@@ -178,12 +178,29 @@ TEST(OclocApiTests, GivenInvalidQueryWhenQueryingThenErrorIsReturned) {
|
||||
|
||||
TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
|
||||
std::string clFileName(clFiles + "copybuffer.cl");
|
||||
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
|
||||
auto allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
if (allSupportedDeviceConfigs.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
std::string family("");
|
||||
for (const auto &config : allSupportedDeviceConfigs) {
|
||||
if (config.hwInfo->platform.eProductFamily == NEO::DEFAULT_PLATFORM::hwInfo.platform.eProductFamily) {
|
||||
family = ProductConfigHelper::getAcronymForAFamily(config.family).str();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (family.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
const char *argv[] = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
clFileName.c_str(),
|
||||
"-device",
|
||||
NEO::familyName[NEO::DEFAULT_PLATFORM::hwInfo.platform.eRenderCoreFamily]};
|
||||
family.c_str()};
|
||||
unsigned int argc = sizeof(argv) / sizeof(const char *);
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
@@ -194,7 +211,7 @@ TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
|
||||
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file test_files/copybuffer.cl -device "s + argv[4]));
|
||||
EXPECT_EQ(std::string::npos, output.find("Command was: ocloc -file " + clFileName + " -device " + family));
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, WhenArgsWithMissingFileAreGivenThenErrorMessageIsProduced) {
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
struct OclocArgHelperTests : public ::testing::Test {
|
||||
OclocArgHelperTests() {
|
||||
argHelper = std::make_unique<OclocArgHelper>();
|
||||
}
|
||||
std::unique_ptr<OclocArgHelper> argHelper;
|
||||
};
|
||||
|
||||
template <typename EqComparableT>
|
||||
auto findAcronym(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) { return lhs == rhs; };
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenProductOrAotConfigWhenParseMajorMinorRevisionValueThenCorrectStringIsReturned) {
|
||||
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
if (enabledDeviceConfigs.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
for (const auto &device : enabledDeviceConfigs) {
|
||||
auto productConfig = static_cast<AOT::PRODUCT_CONFIG>(device.aotConfig.ProductConfig);
|
||||
auto configStr0 = ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
auto configStr1 = ProductConfigHelper::parseMajorMinorRevisionValue(device.aotConfig);
|
||||
EXPECT_STREQ(configStr0.c_str(), configStr1.c_str());
|
||||
|
||||
auto gotCofig = argHelper->getMajorMinorRevision(configStr0);
|
||||
|
||||
EXPECT_EQ(gotCofig.ProductConfig, productConfig);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenProductConfigAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
|
||||
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
if (enabledDeviceConfigs.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
std::string acronym("");
|
||||
for (auto &device : enabledDeviceConfigs) {
|
||||
if (!device.acronyms.empty()) {
|
||||
acronym = device.acronyms.front().str();
|
||||
auto enabledAcronyms = argHelper->getEnabledProductAcronyms();
|
||||
|
||||
auto acronymFound = std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findAcronym(acronym));
|
||||
EXPECT_TRUE(acronymFound);
|
||||
|
||||
device.acronyms.clear();
|
||||
device.aotConfig.ProductConfig = AOT::UNKNOWN_ISA;
|
||||
|
||||
enabledAcronyms = argHelper->getEnabledProductAcronyms();
|
||||
acronymFound = std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findAcronym(acronym));
|
||||
|
||||
EXPECT_FALSE(acronymFound);
|
||||
EXPECT_FALSE(argHelper->isProductConfig(acronym));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenReleaseAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
|
||||
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
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 = argHelper->getEnabledReleasesAcronyms();
|
||||
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 = argHelper->getEnabledReleasesAcronyms();
|
||||
releaseFound = std::any_of(enabledReleases.begin(), enabledReleases.end(), findAcronym(acronym));
|
||||
|
||||
EXPECT_FALSE(releaseFound);
|
||||
EXPECT_FALSE(argHelper->isRelease(acronym));
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenFamilyAcronymWhenCheckAllEnabledThenCorrectValuesAreReturned) {
|
||||
auto &enabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
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 = argHelper->getEnabledFamiliesAcronyms();
|
||||
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 = argHelper->getEnabledFamiliesAcronyms();
|
||||
familyFound = std::any_of(enabledFamilies.begin(), enabledFamilies.end(), findAcronym(acronym));
|
||||
|
||||
EXPECT_FALSE(familyFound);
|
||||
EXPECT_FALSE(argHelper->isFamily(acronym));
|
||||
}
|
||||
|
||||
TEST_F(OclocArgHelperTests, givenHwInfoForProductConfigWhenUnknownIsaIsPassedThenFalseIsReturned) {
|
||||
NEO::HardwareInfo hwInfo;
|
||||
EXPECT_FALSE(argHelper->getHwInfoForProductConfig(AOT::UNKNOWN_ISA, hwInfo));
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,21 +16,39 @@
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class OclocFatBinaryGetTargetConfigsForFatbinary : public ::testing::Test {
|
||||
class OclocEnabledAcronyms : public ::testing::Test {
|
||||
public:
|
||||
OclocFatBinaryGetTargetConfigsForFatbinary() {
|
||||
std::vector<DeviceMapping> enabledProducts{};
|
||||
std::vector<ConstStringRef> enabledProductsAcronyms{};
|
||||
std::vector<ConstStringRef> enabledFamiliesAcronyms{};
|
||||
std::vector<ConstStringRef> enabledReleasesAcronyms{};
|
||||
};
|
||||
|
||||
class OclocFatBinaryProductAcronymsTests : public OclocEnabledAcronyms {
|
||||
public:
|
||||
OclocFatBinaryProductAcronymsTests() {
|
||||
oclocArgHelperWithoutInput = std::make_unique<OclocArgHelper>();
|
||||
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{true};
|
||||
|
||||
enabledProducts = oclocArgHelperWithoutInput->getAllSupportedDeviceConfigs();
|
||||
enabledProductsAcronyms = oclocArgHelperWithoutInput->getEnabledProductAcronyms();
|
||||
enabledFamiliesAcronyms = oclocArgHelperWithoutInput->getEnabledFamiliesAcronyms();
|
||||
enabledReleasesAcronyms = oclocArgHelperWithoutInput->getEnabledReleasesAcronyms();
|
||||
}
|
||||
|
||||
std::unique_ptr<OclocArgHelper> oclocArgHelperWithoutInput;
|
||||
};
|
||||
|
||||
class OclocFatBinaryTest : public ::testing::Test {
|
||||
class OclocFatBinaryTest : public OclocEnabledAcronyms {
|
||||
public:
|
||||
OclocFatBinaryTest() {
|
||||
mockArgHelperFilesMap[spirvFilename] = spirvFileContent;
|
||||
mockArgHelper.interceptOutput = true;
|
||||
|
||||
enabledProducts = mockArgHelper.getAllSupportedDeviceConfigs();
|
||||
enabledProductsAcronyms = mockArgHelper.getEnabledProductAcronyms();
|
||||
enabledFamiliesAcronyms = mockArgHelper.getEnabledFamiliesAcronyms();
|
||||
enabledReleasesAcronyms = mockArgHelper.getEnabledReleasesAcronyms();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -16,16 +16,16 @@ TEST_P(OclocProductConfigTests, GivenProductConfigValuesWhenInitHardwareInfoThen
|
||||
auto allSupportedDeviceConfigs = mockOfflineCompiler->argHelper->getAllSupportedDeviceConfigs();
|
||||
|
||||
for (const auto &deviceConfig : allSupportedDeviceConfigs) {
|
||||
if (productConfig == deviceConfig.config) {
|
||||
if (aotConfig.ProductConfig == deviceConfig.aotConfig.ProductConfig) {
|
||||
if (deviceConfig.deviceIds) {
|
||||
deviceId = deviceConfig.deviceIds->front();
|
||||
}
|
||||
revId = deviceConfig.revId;
|
||||
revId = deviceConfig.aotConfig.ProductConfigID.Revision;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mockOfflineCompiler->deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
mockOfflineCompiler->deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
mockOfflineCompiler->initHardwareInfo(mockOfflineCompiler->deviceName);
|
||||
|
||||
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.eProductFamily, productFamily);
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
#include "opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h"
|
||||
|
||||
namespace NEO {
|
||||
struct OclocProductConfigTests : public ::testing::TestWithParam<std::tuple<PRODUCT_CONFIG, PRODUCT_FAMILY>> {
|
||||
struct OclocProductConfigTests : public ::testing::TestWithParam<std::tuple<AOT::PRODUCT_CONFIG, PRODUCT_FAMILY>> {
|
||||
void SetUp() override {
|
||||
std::tie(productConfig, productFamily) = GetParam();
|
||||
std::tie(aotConfig.ProductConfig, productFamily) = GetParam();
|
||||
mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
|
||||
}
|
||||
|
||||
PRODUCT_CONFIG productConfig;
|
||||
AheadOfTimeConfig aotConfig;
|
||||
PRODUCT_FAMILY productFamily;
|
||||
std::unique_ptr<MockOfflineCompiler> mockOfflineCompiler;
|
||||
};
|
||||
|
||||
@@ -194,7 +194,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
|
||||
std::string configStr;
|
||||
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
|
||||
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
|
||||
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -521,6 +521,30 @@ TEST(MultiCommandWhiteboxTest, GivenInvalidArgsWhenInitializingThenErrorIsReturn
|
||||
}
|
||||
|
||||
using MockOfflineCompilerTests = ::testing::Test;
|
||||
TEST_F(MockOfflineCompilerTests, givenProductConfigValueAndRevisionIdWhenInitHwInfoThenTheseValuesAreSet) {
|
||||
MockOfflineCompiler mockOfflineCompiler;
|
||||
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
|
||||
if (allEnabledDeviceConfigs.empty()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto config = AOT::UNKNOWN_ISA;
|
||||
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
|
||||
config = static_cast<AOT::PRODUCT_CONFIG>(deviceMapConfig.aotConfig.ProductConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mockOfflineCompiler.revisionId = 0x3;
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(config);
|
||||
EXPECT_FALSE(mockOfflineCompiler.deviceName.empty());
|
||||
|
||||
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usRevId, mockOfflineCompiler.revisionId);
|
||||
EXPECT_EQ(mockOfflineCompiler.deviceConfig, config);
|
||||
}
|
||||
|
||||
TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHardwareInfoValuesAreSet) {
|
||||
MockOfflineCompiler mockOfflineCompiler;
|
||||
auto allEnabledDeviceConfigs = mockOfflineCompiler.argHelper->getAllSupportedDeviceConfigs();
|
||||
@@ -528,20 +552,16 @@ TEST_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenBaseHa
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto expectedRevId = 0u;
|
||||
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
|
||||
expectedRevId = deviceMapConfig.revId;
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_FALSE(mockOfflineCompiler.deviceName.empty());
|
||||
|
||||
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
|
||||
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usRevId, expectedRevId);
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.eProductFamily, productFamily);
|
||||
EXPECT_NE(mockOfflineCompiler.hwInfo.gtSystemInfo.MaxEuPerSubSlice, 0u);
|
||||
EXPECT_NE(mockOfflineCompiler.hwInfo.gtSystemInfo.MaxSlicesSupported, 0u);
|
||||
@@ -555,9 +575,9 @@ HWTEST2_F(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenMax
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
for (const auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -741,6 +761,7 @@ TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrect
|
||||
std::stringstream deviceString, productString;
|
||||
deviceString << "0x" << std::hex << deviceId;
|
||||
|
||||
mockOfflineCompiler.argHelper->getPrinterRef() = MessagePrinter{true};
|
||||
mockOfflineCompiler.initHardwareInfo(deviceString.str());
|
||||
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usDeviceID, deviceId);
|
||||
}
|
||||
@@ -761,6 +782,7 @@ TEST_F(OfflineCompilerTests, givenProperDeviceIdHexAsDeviceArgumentThenSuccessIs
|
||||
"-device",
|
||||
deviceString.str()};
|
||||
|
||||
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
EXPECT_EQ(pOfflineCompiler->getHardwareInfo().platform.usDeviceID, deviceId);
|
||||
@@ -804,7 +826,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithMissingRevisionValueWhenIn
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.1.\nError: Cannot get HW Info for device 9.1..\n");
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.1.\nError: Cannot get HW Info for device 9.1..\n");
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
@@ -819,7 +841,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithInvalidPatternThenInvalidD
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.1..\nError: Cannot get HW Info for device 9.1...\n");
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.1..\nError: Cannot get HW Info for device 9.1...\n");
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
@@ -834,7 +856,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithMissingMajorValueWhenInval
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: .1.2\nError: Cannot get HW Info for device .1.2.\n");
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine device target: .1.2\nError: Cannot get HW Info for device .1.2.\n");
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
@@ -849,7 +871,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenInvalidRevisionValueIsPass
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.0.a\nError: Cannot get HW Info for device 9.0.a.\n");
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.0.a\nError: Cannot get HW Info for device 9.0.a.\n");
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
@@ -864,7 +886,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenInvalidMinorValueIsPassedT
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 9.a\nError: Cannot get HW Info for device 9.a.\n");
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine device target: 9.a\nError: Cannot get HW Info for device 9.a.\n");
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
@@ -879,7 +901,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenPassedValuesAreOutOfRangeT
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine target based on product config: 256.350\nError: Cannot get HW Info for device 256.350.\n");
|
||||
EXPECT_STREQ(output.c_str(), "Could not determine device target: 256.350\nError: Cannot get HW Info for device 256.350.\n");
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
@@ -894,7 +916,7 @@ TEST_F(OfflineCompilerTests, givenInitHardwareInfowhenDeviceConfigContainsDevice
|
||||
|
||||
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
|
||||
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
|
||||
deviceMapConfig.deviceIds = &deviceIdsForTests;
|
||||
break;
|
||||
}
|
||||
@@ -1333,7 +1355,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
|
||||
std::string configStr;
|
||||
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
|
||||
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
|
||||
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
|
||||
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.aotConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1639,6 +1661,36 @@ TEST(OfflineCompilerTest, WhenParsingCmdLineThenOptionsAreReadCorrectly) {
|
||||
delete mockOfflineCompiler;
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenUnknownIsaConfigValueWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
|
||||
auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
|
||||
|
||||
auto deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
|
||||
std::stringstream resString;
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
||||
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
resString << "Could not determine device target: " << deviceName << "\n";
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenUnsupportedDeviceConfigWhenInitHardwareInfoThenInvalidDeviceIsReturned) {
|
||||
auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
|
||||
|
||||
auto deviceName = "00.01.02";
|
||||
std::stringstream resString;
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto retVal = mockOfflineCompiler->initHardwareInfoForProductConfig(deviceName);
|
||||
EXPECT_EQ(retVal, OclocErrorCode::INVALID_DEVICE);
|
||||
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
resString << "Could not determine target based on product config: " << deviceName << "\n";
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, givenStatelessToStatefullOptimizationEnabledWhenDebugSettingsAreParsedThenOptimizationStringIsPresent) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
MockOfflineCompiler mockOfflineCompiler;
|
||||
@@ -1720,23 +1772,6 @@ TEST(OfflineCompilerTest, GivenValidParamWhenGettingHardwareInfoThenSuccessIsRet
|
||||
EXPECT_NE(PRODUCT_FAMILY::IGFX_UNKNOWN, mockOfflineCompiler->getHardwareInfo().platform.eProductFamily);
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenConfigValueWhichIsOutOfRangeWhenGettingHardwareInfoThenInvalidDeviceIsReturned) {
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
|
||||
uint32_t value = 0xffffff + 1;
|
||||
std::stringstream inproperValue, resString;
|
||||
inproperValue << value;
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, mockOfflineCompiler->initHardwareInfo(inproperValue.str()));
|
||||
|
||||
resString << "Could not determine target based on product config: " << inproperValue.str() << "\n";
|
||||
|
||||
auto output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.c_str(), resString.str().c_str());
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, WhenStoringBinaryThenStoredCorrectly) {
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
@@ -2983,37 +3018,35 @@ TEST(OclocArgHelperTest, GivenNoOutputPrintMessages) {
|
||||
EXPECT_STREQ(printMsg.data(), capturedStdout.c_str());
|
||||
}
|
||||
|
||||
TEST(OclocArgHelperTest, GivenDifferentRevisionIdsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
|
||||
TEST(OclocArgHelperTest, GivenDifferentAotConfigsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
|
||||
DeviceMapping lhs{};
|
||||
DeviceMapping rhs{};
|
||||
ASSERT_TRUE(lhs == rhs);
|
||||
|
||||
lhs.revId = 1;
|
||||
rhs.revId = 2;
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
}
|
||||
|
||||
TEST(OclocArgHelperTest, GivenDifferentHwInfosInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
|
||||
DeviceMapping lhs{};
|
||||
DeviceMapping rhs{};
|
||||
ASSERT_TRUE(lhs == rhs);
|
||||
|
||||
HardwareInfo firstHwInfo{};
|
||||
lhs.hwInfo = &firstHwInfo;
|
||||
|
||||
HardwareInfo secondHwInfo{};
|
||||
rhs.hwInfo = &secondHwInfo;
|
||||
lhs.aotConfig = {AOT::CONFIG_MAX_PLATFORM};
|
||||
rhs.aotConfig = {AOT::UNKNOWN_ISA};
|
||||
|
||||
EXPECT_FALSE(lhs == rhs);
|
||||
}
|
||||
|
||||
TEST(OclocArgHelperTest, GivenDifferentConfigsInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
|
||||
TEST(OclocArgHelperTest, GivenDifferentFamiliesInDeviceMappingsWhenComparingThemThenFalseIsReturned) {
|
||||
DeviceMapping lhs{};
|
||||
DeviceMapping rhs{};
|
||||
ASSERT_TRUE(lhs == rhs);
|
||||
|
||||
lhs.config = CONFIG_MAX_PLATFORM;
|
||||
rhs.config = UNKNOWN_ISA;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -5,22 +5,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/xe_hpc_core/pvc/product_configs_pvc.h"
|
||||
|
||||
#include "opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.h"
|
||||
|
||||
namespace NEO {
|
||||
static PRODUCT_CONFIG pvcProductConfig[] = {
|
||||
PVC_XL_A0,
|
||||
PVC_XL_A0P,
|
||||
PVC_XT_A0,
|
||||
PVC_XT_B0,
|
||||
PVC_XT_B1,
|
||||
PVC_XT_C0};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
OclocProductConfigPvcTestsValues,
|
||||
OclocProductConfigTests,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(pvcProductConfig),
|
||||
::testing::ValuesIn(AOT_PVC::productConfigs),
|
||||
::testing::Values(IGFX_PVC)));
|
||||
|
||||
} // namespace NEO
|
||||
@@ -5,19 +5,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h"
|
||||
|
||||
#include "opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.h"
|
||||
|
||||
namespace NEO {
|
||||
static PRODUCT_CONFIG dg2ProductConfig[] = {
|
||||
DG2_G10_A0,
|
||||
DG2_G11,
|
||||
DG2_G10_B0};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
OclocProductConfigDg2TestsValues,
|
||||
OclocProductConfigTests,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(dg2ProductConfig),
|
||||
::testing::ValuesIn(AOT_DG2::productConfigs),
|
||||
::testing::Values(IGFX_DG2)));
|
||||
|
||||
} // namespace NEO
|
||||
@@ -12,6 +12,8 @@ set(OCLOC_FOLDER_NAME "offline_compiler")
|
||||
set(CLOC_LIB_SRCS_LIB
|
||||
${NEO_SHARED_DIRECTORY}/compiler_interface/compiler_options/compiler_options_base.cpp
|
||||
${NEO_SHARED_DIRECTORY}/compiler_interface/create_main.cpp
|
||||
${NEO_SHARED_DIRECTORY}/compiler_interface/oclc_extensions.cpp
|
||||
${NEO_SHARED_DIRECTORY}/compiler_interface/oclc_extensions.h
|
||||
${NEO_SHARED_DIRECTORY}/device_binary_format/ar/ar.h
|
||||
${NEO_SHARED_DIRECTORY}/device_binary_format/ar/ar_decoder.cpp
|
||||
${NEO_SHARED_DIRECTORY}/device_binary_format/ar/ar_decoder.h
|
||||
@@ -28,11 +30,11 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${NEO_SHARED_DIRECTORY}/dll/devices/devices_base.inl
|
||||
${NEO_SHARED_DIRECTORY}/dll/devices${BRANCH_DIR_SUFFIX}/product_config.inl
|
||||
${NEO_SHARED_DIRECTORY}/dll/devices/product_config_base.inl
|
||||
${NEO_SHARED_DIRECTORY}/dll/devices${BRANCH_DIR_SUFFIX}platforms.h
|
||||
${NEO_SHARED_DIRECTORY}/helpers/abort.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_hw_info_config.h
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_hw_info_config.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_hw_info_config_base.inl
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_aot_config_bdw_and_later.inl
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_hw_info_config_bdw_and_later.inl
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_options_parser.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/compiler_options_parser.h
|
||||
@@ -41,9 +43,9 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${NEO_SHARED_DIRECTORY}/helpers/hw_info.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/hw_info.h
|
||||
${NEO_SHARED_DIRECTORY}/helpers${BRANCH_DIR_SUFFIX}hw_info_extended.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.h
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/os_library.h
|
||||
${NEO_SHARED_DIRECTORY}/compiler_interface/oclc_extensions.cpp
|
||||
${NEO_SHARED_DIRECTORY}/compiler_interface/oclc_extensions.h
|
||||
${OCLOC_DIRECTORY}/source/decoder/binary_decoder.cpp
|
||||
${OCLOC_DIRECTORY}/source/decoder/binary_decoder.h
|
||||
${OCLOC_DIRECTORY}/source/decoder/binary_encoder.cpp
|
||||
@@ -81,6 +83,7 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${NEO_SOURCE_DIR}/shared/source/device_binary_format/device_binary_format_zebin.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/device_binary_format/zebin_decoder.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/device_binary_format/yaml/yaml_parser.cpp
|
||||
${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}aot_config_headers/platforms.h
|
||||
)
|
||||
|
||||
if(${IGA_HEADERS_AVAILABLE})
|
||||
|
||||
@@ -336,7 +336,7 @@ Examples:
|
||||
Disassemble Intel Compute GPU device binary
|
||||
ocloc disasm -file source_file_Gen9core.bin
|
||||
)===",
|
||||
NEO::getDevicesTypes().c_str());
|
||||
argHelper->getAllSupportedAcronyms().c_str());
|
||||
}
|
||||
|
||||
int BinaryDecoder::processBinary(const void *&ptr, std::ostream &ptmFile) {
|
||||
|
||||
@@ -133,7 +133,7 @@ Examples:
|
||||
Assemble to Intel Compute GPU device binary
|
||||
ocloc asm -out reassembled.bin
|
||||
)===",
|
||||
NEO::getDevicesTypes().c_str());
|
||||
argHelper->getAllSupportedAcronyms().c_str());
|
||||
}
|
||||
|
||||
int BinaryEncoder::encode() {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "ocloc_arg_helper.h"
|
||||
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
@@ -63,13 +64,11 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
|
||||
#undef NAMEDDEVICE
|
||||
{0u, std::string("")}}),
|
||||
deviceMap({
|
||||
#define DEVICE_CONFIG_IDS_AND_REVISION(product, productConfig, deviceIds, revision_id) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, revision_id},
|
||||
#define DEVICE_CONFIG_IDS(product, productConfig, deviceIds) {product, &NEO::productConfig::hwInfo, &NEO::deviceIds, NEO::productConfig::hwInfo.platform.usRevId},
|
||||
#define DEVICE_CONFIG(product, productConfig) {product, &NEO::productConfig::hwInfo, nullptr, NEO::productConfig::hwInfo.platform.usRevId},
|
||||
#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
|
||||
#undef DEVICE_CONFIG_IDS_AND_REVISION
|
||||
}) {
|
||||
for (uint32_t i = 0; i < numSources; ++i) {
|
||||
inputs.push_back(Source(dataSources[i], static_cast<size_t>(lenSources[i]), nameSources[i]));
|
||||
@@ -77,15 +76,15 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
|
||||
for (uint32_t i = 0; i < numInputHeaders; ++i) {
|
||||
headers.push_back(Source(dataInputHeaders[i], static_cast<size_t>(lenInputHeaders[i]), nameInputHeaders[i]));
|
||||
}
|
||||
for (unsigned int family = 0; family < IGFX_MAX_CORE; ++family) {
|
||||
if (NEO::familyName[family] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
insertGenNames(static_cast<GFXCORE_FAMILY>(family));
|
||||
}
|
||||
|
||||
std::sort(deviceMap.begin(), deviceMap.end(), compareConfigs);
|
||||
deviceMap.erase(std::unique(deviceMap.begin(), deviceMap.end(), isDuplicateConfig), deviceMap.end());
|
||||
for (auto &device : deviceMap) {
|
||||
for (const auto &[acronym, value] : AOT::productConfigAcronyms) {
|
||||
if (value == device.aotConfig.ProductConfig) {
|
||||
device.acronyms.push_back(NEO::ConstStringRef(acronym));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OclocArgHelper::OclocArgHelper() : OclocArgHelper(0, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) {}
|
||||
@@ -169,31 +168,19 @@ std::unique_ptr<char[]> OclocArgHelper::loadDataFromFile(const std::string &file
|
||||
}
|
||||
}
|
||||
|
||||
void OclocArgHelper::setDeviceInfoForFatbinaryTarget(const DeviceMapping &device) {
|
||||
deviceForFatbinary.hwInfo = device.hwInfo;
|
||||
deviceForFatbinary.revId = device.revId;
|
||||
deviceForFatbinary.deviceIds = device.deviceIds;
|
||||
}
|
||||
|
||||
void OclocArgHelper::setHwInfoForFatbinaryTarget(NEO::HardwareInfo &hwInfo) {
|
||||
hwInfo = *deviceForFatbinary.hwInfo;
|
||||
NEO::hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
|
||||
hwInfo.platform.usRevId = deviceForFatbinary.revId;
|
||||
if (deviceForFatbinary.deviceIds) {
|
||||
hwInfo.platform.usDeviceID = deviceForFatbinary.deviceIds->front();
|
||||
}
|
||||
}
|
||||
|
||||
bool OclocArgHelper::getHwInfoForProductConfig(uint32_t config, NEO::HardwareInfo &hwInfo) {
|
||||
bool retVal = false;
|
||||
if (config == UNKNOWN_ISA) {
|
||||
if (config == AOT::UNKNOWN_ISA) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
for (auto &deviceConfig : deviceMap) {
|
||||
if (deviceConfig.config == config) {
|
||||
if (deviceConfig.aotConfig.ProductConfig == config) {
|
||||
hwInfo = *deviceConfig.hwInfo;
|
||||
const auto &compilerHwInfoConfig = *NEO::CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
compilerHwInfoConfig.setProductConfigForHwInfo(hwInfo, deviceConfig.aotConfig);
|
||||
NEO::hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
|
||||
hwInfo.platform.usRevId = deviceConfig.revId;
|
||||
|
||||
if (deviceConfig.deviceIds) {
|
||||
hwInfo.platform.usDeviceID = deviceConfig.deviceIds->front();
|
||||
}
|
||||
@@ -204,14 +191,6 @@ bool OclocArgHelper::getHwInfoForProductConfig(uint32_t config, NEO::HardwareInf
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void OclocArgHelper::getProductConfigsForGfxCoreFamily(GFXCORE_FAMILY core, std::vector<DeviceMapping> &out) {
|
||||
for (auto &deviceConfig : deviceMap) {
|
||||
if (deviceConfig.hwInfo->platform.eRenderCoreFamily == core) {
|
||||
out.push_back(deviceConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OclocArgHelper::saveOutput(const std::string &filename, const void *pData, const size_t &dataSize) {
|
||||
if (outputEnabled()) {
|
||||
addOutput(filename, pData, dataSize);
|
||||
@@ -231,6 +210,60 @@ void OclocArgHelper::saveOutput(const std::string &filename, const std::ostream
|
||||
}
|
||||
}
|
||||
|
||||
std::string OclocArgHelper::getAllSupportedAcronyms() {
|
||||
std::ostringstream os;
|
||||
for (const auto &device : deviceMap) {
|
||||
for (const auto &acronym : device.acronyms) {
|
||||
if (os.tellp())
|
||||
os << ", ";
|
||||
os << acronym.str();
|
||||
}
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::vector<NEO::ConstStringRef> OclocArgHelper::getEnabledProductAcronyms() {
|
||||
std::vector<NEO::ConstStringRef> enabledAcronyms{};
|
||||
for (const auto &device : deviceMap) {
|
||||
if (!device.acronyms.empty()) {
|
||||
enabledAcronyms.push_back(device.acronyms.front());
|
||||
}
|
||||
}
|
||||
return enabledAcronyms;
|
||||
}
|
||||
|
||||
std::vector<NEO::ConstStringRef> OclocArgHelper::getEnabledReleasesAcronyms() {
|
||||
std::vector<NEO::ConstStringRef> 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<NEO::ConstStringRef> OclocArgHelper::getEnabledFamiliesAcronyms() {
|
||||
std::vector<NEO::ConstStringRef> 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++) {
|
||||
@@ -245,15 +278,6 @@ std::vector<DeviceMapping> &OclocArgHelper::getAllSupportedDeviceConfigs() {
|
||||
return deviceMap;
|
||||
}
|
||||
|
||||
std::vector<PRODUCT_CONFIG> OclocArgHelper::getAllSupportedProductConfigs() {
|
||||
std::vector<PRODUCT_CONFIG> allConfigs;
|
||||
for (auto &deviceConfig : deviceMap) {
|
||||
allConfigs.push_back(deviceConfig.config);
|
||||
}
|
||||
std::sort(allConfigs.begin(), allConfigs.end());
|
||||
return allConfigs;
|
||||
}
|
||||
|
||||
int OclocArgHelper::parseProductConfigFromString(const std::string &device, size_t begin, size_t end) {
|
||||
if (begin == end) {
|
||||
return CONFIG_STATUS::MISMATCHED_VALUE;
|
||||
@@ -271,119 +295,55 @@ int OclocArgHelper::parseProductConfigFromString(const std::string &device, size
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint32_t> OclocArgHelper::getMajorMinorRevision(const std::string &device) {
|
||||
std::vector<uint32_t> numeration;
|
||||
AheadOfTimeConfig OclocArgHelper::getMajorMinorRevision(const std::string &device) {
|
||||
AheadOfTimeConfig product = {AOT::UNKNOWN_ISA};
|
||||
auto majorPos = device.find(".");
|
||||
auto major = parseProductConfigFromString(device, 0, majorPos);
|
||||
if (major == CONFIG_STATUS::MISMATCHED_VALUE) {
|
||||
return {};
|
||||
}
|
||||
numeration.push_back(major);
|
||||
if (majorPos == std::string::npos) {
|
||||
return numeration;
|
||||
if (major == CONFIG_STATUS::MISMATCHED_VALUE || majorPos == std::string::npos) {
|
||||
return product;
|
||||
}
|
||||
|
||||
auto minorPos = device.find(".", ++majorPos);
|
||||
auto minor = parseProductConfigFromString(device, majorPos, minorPos);
|
||||
|
||||
if (minor == CONFIG_STATUS::MISMATCHED_VALUE) {
|
||||
return {};
|
||||
}
|
||||
numeration.push_back(minor);
|
||||
if (minorPos == std::string::npos) {
|
||||
return numeration;
|
||||
if (minor == CONFIG_STATUS::MISMATCHED_VALUE || minorPos == std::string::npos) {
|
||||
return product;
|
||||
}
|
||||
|
||||
auto revision = parseProductConfigFromString(device, minorPos + 1, device.size());
|
||||
if (revision == CONFIG_STATUS::MISMATCHED_VALUE) {
|
||||
return {};
|
||||
return product;
|
||||
}
|
||||
numeration.push_back(revision);
|
||||
return numeration;
|
||||
product.ProductConfigID.Major = major;
|
||||
product.ProductConfigID.Minor = minor;
|
||||
product.ProductConfigID.Revision = revision;
|
||||
return product;
|
||||
}
|
||||
|
||||
uint32_t OclocArgHelper::getProductConfig(std::vector<uint32_t> &numeration) {
|
||||
uint32_t config = 0x0;
|
||||
|
||||
config = numeration.at(0) << 16;
|
||||
if (numeration.size() > 1) {
|
||||
config |= (numeration.at(1) << 8);
|
||||
bool OclocArgHelper::isRelease(const std::string &device) {
|
||||
auto release = ProductConfigHelper::returnReleaseForAcronym(device);
|
||||
if (release == AOT::UNKNOWN_RELEASE) {
|
||||
return false;
|
||||
}
|
||||
if (numeration.size() > 2) {
|
||||
config |= numeration.at(2);
|
||||
}
|
||||
|
||||
return config;
|
||||
return std::any_of(deviceMap.begin(), deviceMap.end(), findRelease(release));
|
||||
}
|
||||
|
||||
uint32_t OclocArgHelper::getMaskForConfig(std::vector<uint32_t> &numeration) {
|
||||
uint32_t mask = 0xffffff;
|
||||
if (numeration.size() == 1) {
|
||||
mask = 0xff0000;
|
||||
} else if (numeration.size() == 2) {
|
||||
mask = 0xffff00;
|
||||
bool OclocArgHelper::isFamily(const std::string &device) {
|
||||
auto family = ProductConfigHelper::returnFamilyForAcronym(device);
|
||||
if (family == AOT::UNKNOWN_FAMILY) {
|
||||
return false;
|
||||
}
|
||||
return mask;
|
||||
return std::any_of(deviceMap.begin(), deviceMap.end(), findFamily(family));
|
||||
}
|
||||
|
||||
bool OclocArgHelper::isGen(const std::string &device) {
|
||||
std::string buf(device);
|
||||
std::transform(buf.begin(), buf.end(), buf.begin(), ::tolower);
|
||||
auto it = genIGFXMap.find(buf);
|
||||
return it == genIGFXMap.end() ? false : true;
|
||||
}
|
||||
|
||||
unsigned int OclocArgHelper::returnIGFXforGen(const std::string &device) {
|
||||
std::string buf(device);
|
||||
std::transform(buf.begin(), buf.end(), buf.begin(), ::tolower);
|
||||
auto it = genIGFXMap.find(buf);
|
||||
if (it == genIGFXMap.end())
|
||||
return 0;
|
||||
return it->second;
|
||||
bool OclocArgHelper::isProductConfig(const std::string &device) {
|
||||
auto 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";
|
||||
}
|
||||
|
||||
PRODUCT_CONFIG OclocArgHelper::findConfigMatch(const std::string &device, bool firstAppearance) {
|
||||
auto numeration = getMajorMinorRevision(device);
|
||||
if (numeration.empty()) {
|
||||
return PRODUCT_CONFIG::UNKNOWN_ISA;
|
||||
}
|
||||
|
||||
std::vector<PRODUCT_CONFIG> allMatchedConfigs;
|
||||
std::vector<PRODUCT_CONFIG> allConfigs = getAllSupportedProductConfigs();
|
||||
auto configValue = getProductConfig(numeration);
|
||||
uint32_t mask = getMaskForConfig(numeration);
|
||||
|
||||
if (!firstAppearance) {
|
||||
// find last appearance
|
||||
std::reverse(allConfigs.begin(), allConfigs.end());
|
||||
}
|
||||
|
||||
for (auto &productConfig : allConfigs) {
|
||||
uint32_t value = static_cast<uint32_t>(productConfig) & mask;
|
||||
if (value == configValue) {
|
||||
return productConfig;
|
||||
}
|
||||
}
|
||||
return PRODUCT_CONFIG::UNKNOWN_ISA;
|
||||
}
|
||||
|
||||
void OclocArgHelper::insertGenNames(GFXCORE_FAMILY family) {
|
||||
std::string genName = NEO::familyName[family];
|
||||
std::transform(genName.begin(), genName.end(), genName.begin(), ::tolower);
|
||||
genIGFXMap.insert({genName, family});
|
||||
|
||||
auto findCore = genName.find("_core");
|
||||
if (findCore != std::string::npos) {
|
||||
genName = genName.substr(0, findCore);
|
||||
genIGFXMap.insert({genName, family});
|
||||
}
|
||||
|
||||
auto findUnderline = genName.find("_");
|
||||
if (findUnderline != std::string::npos) {
|
||||
genName.erase(std::remove(genName.begin(), genName.end(), '_'), genName.end());
|
||||
genIGFXMap.insert({genName, family});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "shared/offline_compiler/source/decoder/helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/utilities/const_stringref.h"
|
||||
|
||||
#include "device_ids_configs.h"
|
||||
#include "hw_cmds.h"
|
||||
@@ -48,13 +50,15 @@ struct DeviceProduct {
|
||||
};
|
||||
|
||||
struct DeviceMapping {
|
||||
PRODUCT_CONFIG config = UNKNOWN_ISA;
|
||||
const NEO::HardwareInfo *hwInfo = nullptr;
|
||||
const std::vector<unsigned short> *deviceIds = nullptr;
|
||||
unsigned int revId = 0U;
|
||||
AOT::FAMILY family = AOT::UNKNOWN_FAMILY;
|
||||
AOT::RELEASE release = AOT::UNKNOWN_RELEASE;
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
std::vector<NEO::ConstStringRef> acronyms{};
|
||||
|
||||
bool operator==(const DeviceMapping &rhs) {
|
||||
return config == rhs.config && hwInfo == rhs.hwInfo && revId == rhs.revId;
|
||||
return aotConfig.ProductConfig == rhs.aotConfig.ProductConfig && family == rhs.family && release == rhs.release;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,9 +74,6 @@ class OclocArgHelper {
|
||||
MessagePrinter messagePrinter;
|
||||
const std::vector<DeviceProduct> deviceProductTable;
|
||||
std::vector<DeviceMapping> deviceMap;
|
||||
DeviceMapping deviceForFatbinary;
|
||||
std::map<std::string, unsigned int> genIGFXMap;
|
||||
bool fatBinary = false;
|
||||
void moveOutputs();
|
||||
Source *findSourceFile(const std::string &filename);
|
||||
bool sourceFileExists(const std::string &filename) const;
|
||||
@@ -82,11 +83,22 @@ class OclocArgHelper {
|
||||
}
|
||||
|
||||
static bool compareConfigs(DeviceMapping deviceMap0, DeviceMapping deviceMap1) {
|
||||
return deviceMap0.config < deviceMap1.config;
|
||||
return deviceMap0.aotConfig.ProductConfig < deviceMap1.aotConfig.ProductConfig;
|
||||
}
|
||||
|
||||
static bool isDuplicateConfig(DeviceMapping deviceMap0, DeviceMapping deviceMap1) {
|
||||
return deviceMap0.config == deviceMap1.config;
|
||||
template <typename EqComparableT>
|
||||
auto findFamily(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) { return lhs == rhs.family; };
|
||||
}
|
||||
|
||||
template <typename EqComparableT>
|
||||
auto findRelease(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) { return lhs == rhs.release; };
|
||||
}
|
||||
|
||||
template <typename EqComparableT>
|
||||
auto findProductConfig(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) { return lhs == rhs.aotConfig.ProductConfig; };
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -105,16 +117,13 @@ class OclocArgHelper {
|
||||
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);
|
||||
void getProductConfigsForGfxCoreFamily(GFXCORE_FAMILY core, std::vector<DeviceMapping> &out);
|
||||
void setDeviceInfoForFatbinaryTarget(const DeviceMapping &device);
|
||||
void setHwInfoForFatbinaryTarget(NEO::HardwareInfo &hwInfo);
|
||||
std::vector<PRODUCT_CONFIG> getAllSupportedProductConfigs();
|
||||
std::vector<DeviceMapping> &getAllSupportedDeviceConfigs();
|
||||
std::vector<uint32_t> getMajorMinorRevision(const std::string &device);
|
||||
uint32_t getProductConfig(std::vector<uint32_t> &numeration);
|
||||
uint32_t getMaskForConfig(std::vector<uint32_t> &numeration);
|
||||
PRODUCT_CONFIG findConfigMatch(const std::string &device, bool firstAppearance);
|
||||
void insertGenNames(GFXCORE_FAMILY family);
|
||||
std::vector<NEO::ConstStringRef> getEnabledProductAcronyms();
|
||||
std::vector<NEO::ConstStringRef> getEnabledReleasesAcronyms();
|
||||
std::vector<NEO::ConstStringRef> getEnabledFamiliesAcronyms();
|
||||
std::string getAllSupportedAcronyms();
|
||||
AheadOfTimeConfig getMajorMinorRevision(const std::string &device);
|
||||
bool setAcronymForDeviceId(std::string &device);
|
||||
std::vector<std::string> headersToVectorOfStrings();
|
||||
MOCKABLE_VIRTUAL void readFileToVectorOfStrings(const std::string &filename, std::vector<std::string> &lines);
|
||||
MOCKABLE_VIRTUAL std::vector<char> readBinaryFile(const std::string &filename);
|
||||
@@ -130,13 +139,6 @@ class OclocArgHelper {
|
||||
return headers;
|
||||
}
|
||||
|
||||
void setFatbinary(bool isFatBinary) {
|
||||
this->fatBinary = isFatBinary;
|
||||
}
|
||||
|
||||
bool isFatbinary() {
|
||||
return fatBinary;
|
||||
}
|
||||
MOCKABLE_VIRTUAL void saveOutput(const std::string &filename, const void *pData, const size_t &dataSize);
|
||||
void saveOutput(const std::string &filename, const std::ostream &stream);
|
||||
|
||||
@@ -149,8 +151,10 @@ class OclocArgHelper {
|
||||
messagePrinter.printf(format, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
std::string returnProductNameForDevice(unsigned short deviceId);
|
||||
bool isGen(const std::string &device);
|
||||
unsigned int returnIGFXforGen(const std::string &device);
|
||||
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);
|
||||
};
|
||||
|
||||
@@ -23,295 +23,195 @@
|
||||
#include <cstdio>
|
||||
|
||||
namespace NEO {
|
||||
std::vector<PRODUCT_CONFIG> getAllMatchedConfigs(const std::string device, OclocArgHelper *argHelper) {
|
||||
std::vector<PRODUCT_CONFIG> allMatchedConfigs;
|
||||
auto numeration = argHelper->getMajorMinorRevision(device);
|
||||
if (numeration.empty()) {
|
||||
return {};
|
||||
}
|
||||
auto config = argHelper->getProductConfig(numeration);
|
||||
std::vector<PRODUCT_CONFIG> allConfigs = argHelper->getAllSupportedProductConfigs();
|
||||
uint32_t mask = argHelper->getMaskForConfig(numeration);
|
||||
|
||||
for (auto &productConfig : allConfigs) {
|
||||
auto prod = static_cast<uint32_t>(productConfig) & mask;
|
||||
if (config == prod) {
|
||||
allMatchedConfigs.push_back(productConfig);
|
||||
}
|
||||
}
|
||||
|
||||
return allMatchedConfigs;
|
||||
}
|
||||
|
||||
bool requestedFatBinary(const std::vector<std::string> &args, OclocArgHelper *helper) {
|
||||
for (size_t argIndex = 1; argIndex < args.size(); argIndex++) {
|
||||
const auto &currArg = args[argIndex];
|
||||
const bool hasMoreArgs = (argIndex + 1 < args.size());
|
||||
if ((ConstStringRef("-device") == currArg) && hasMoreArgs) {
|
||||
ConstStringRef deviceArg(args[argIndex + 1]);
|
||||
auto products = getAllMatchedConfigs(deviceArg.str(), helper);
|
||||
if (products.size() > 1) {
|
||||
return true;
|
||||
}
|
||||
return deviceArg.contains("*") || deviceArg.contains("-") || deviceArg.contains(",") || helper->isGen(deviceArg.str());
|
||||
auto retVal = deviceArg.contains("*");
|
||||
retVal |= deviceArg.contains(":");
|
||||
retVal |= deviceArg.contains(",");
|
||||
retVal |= helper->isFamily(deviceArg.str());
|
||||
retVal |= helper->isRelease(deviceArg.str());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<PRODUCT_FAMILY> getAllSupportedTargetPlatforms() {
|
||||
return std::vector<PRODUCT_FAMILY>{ALL_SUPPORTED_PRODUCT_FAMILIES};
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> toProductNames(const std::vector<PRODUCT_FAMILY> &productIds) {
|
||||
std::vector<ConstStringRef> ret;
|
||||
for (auto prodId : productIds) {
|
||||
ret.push_back(ConstStringRef(hardwarePrefix[prodId], strlen(hardwarePrefix[prodId])));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
PRODUCT_FAMILY asProductId(ConstStringRef product, const std::vector<PRODUCT_FAMILY> &allSupportedPlatforms) {
|
||||
for (auto &family : allSupportedPlatforms) {
|
||||
if (product == hardwarePrefix[family]) {
|
||||
return family;
|
||||
}
|
||||
}
|
||||
return IGFX_UNKNOWN;
|
||||
}
|
||||
|
||||
std::vector<DeviceMapping> getProductConfigsForOpenRange(ConstStringRef openRange, OclocArgHelper *argHelper, bool rangeTo) {
|
||||
std::vector<DeviceMapping> requestedConfigs;
|
||||
std::vector<DeviceMapping> allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
|
||||
if (argHelper->isGen(openRange.str())) {
|
||||
std::vector<GFXCORE_FAMILY> coreIdList;
|
||||
auto coreId = argHelper->returnIGFXforGen(openRange.str());
|
||||
coreIdList.push_back(static_cast<GFXCORE_FAMILY>(coreId));
|
||||
if (rangeTo) {
|
||||
auto coreId = coreIdList.back();
|
||||
unsigned int coreIt = IGFX_UNKNOWN_CORE;
|
||||
++coreIt;
|
||||
while (coreIt <= static_cast<unsigned int>(coreId)) {
|
||||
argHelper->getProductConfigsForGfxCoreFamily(static_cast<GFXCORE_FAMILY>(coreIt), requestedConfigs);
|
||||
++coreIt;
|
||||
}
|
||||
} else {
|
||||
unsigned int coreIt = coreIdList.front();
|
||||
while (coreIt < static_cast<unsigned int>(IGFX_MAX_CORE)) {
|
||||
argHelper->getProductConfigsForGfxCoreFamily(static_cast<GFXCORE_FAMILY>(coreIt), requestedConfigs);
|
||||
++coreIt;
|
||||
template <>
|
||||
void getProductsAcronymsForTarget<AOT::FAMILY>(std::vector<NEO::ConstStringRef> &out, AOT::FAMILY target, OclocArgHelper *argHelper) {
|
||||
auto allSuppportedProducts = argHelper->getAllSupportedDeviceConfigs();
|
||||
for (const auto &device : allSuppportedProducts) {
|
||||
if (device.family == target && !device.acronyms.empty()) {
|
||||
if (std::find(out.begin(), out.end(), device.acronyms.front()) == out.end()) {
|
||||
out.push_back(device.acronyms.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void getProductsAcronymsForTarget<AOT::RELEASE>(std::vector<NEO::ConstStringRef> &out, AOT::RELEASE target, OclocArgHelper *argHelper) {
|
||||
auto allSuppportedProducts = argHelper->getAllSupportedDeviceConfigs();
|
||||
for (const auto &device : allSuppportedProducts) {
|
||||
if (device.release == target && !device.acronyms.empty()) {
|
||||
if (std::find(out.begin(), out.end(), device.acronyms.front()) == out.end()) {
|
||||
out.push_back(device.acronyms.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void getProductsForTargetRange(T targetFrom, T targetTo, std::vector<ConstStringRef> &out,
|
||||
OclocArgHelper *argHelper) {
|
||||
if (targetFrom > targetTo) {
|
||||
std::swap(targetFrom, targetTo);
|
||||
}
|
||||
while (targetFrom <= targetTo) {
|
||||
getProductsAcronymsForTarget<T>(out, targetFrom, argHelper);
|
||||
targetFrom = static_cast<T>(static_cast<unsigned int>(targetFrom) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void getProductsForRange(unsigned int productFrom, unsigned int productTo, std::vector<ConstStringRef> &out,
|
||||
OclocArgHelper *argHelper) {
|
||||
auto allSuppportedProducts = argHelper->getAllSupportedDeviceConfigs();
|
||||
|
||||
for (const auto &device : allSuppportedProducts) {
|
||||
auto validAcronym = device.aotConfig.ProductConfig >= productFrom;
|
||||
validAcronym &= device.aotConfig.ProductConfig <= productTo;
|
||||
validAcronym &= !device.acronyms.empty();
|
||||
if (validAcronym) {
|
||||
out.push_back(device.acronyms.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> getProductForClosedRange(ConstStringRef rangeFrom, ConstStringRef rangeTo, OclocArgHelper *argHelper) {
|
||||
std::vector<ConstStringRef> requestedProducts = {};
|
||||
auto rangeFromStr = rangeFrom.str();
|
||||
auto rangeToStr = rangeTo.str();
|
||||
|
||||
if (argHelper->isFamily(rangeFromStr) && argHelper->isFamily(rangeToStr)) {
|
||||
auto familyFrom = ProductConfigHelper::returnFamilyForAcronym(rangeFromStr);
|
||||
auto familyTo = ProductConfigHelper::returnFamilyForAcronym(rangeToStr);
|
||||
getProductsForTargetRange(familyFrom, familyTo, requestedProducts, argHelper);
|
||||
|
||||
} else if (argHelper->isRelease(rangeFromStr) && argHelper->isRelease(rangeToStr)) {
|
||||
auto releaseFrom = ProductConfigHelper::returnReleaseForAcronym(rangeFromStr);
|
||||
auto releaseTo = ProductConfigHelper::returnReleaseForAcronym(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);
|
||||
if (productConfigFrom > productConfigTo) {
|
||||
std::swap(productConfigFrom, productConfigTo);
|
||||
}
|
||||
getProductsForRange(productConfigFrom, productConfigTo, requestedProducts, argHelper);
|
||||
} else {
|
||||
auto productConfig = argHelper->findConfigMatch(openRange.str(), !rangeTo);
|
||||
if (productConfig == PRODUCT_CONFIG::UNKNOWN_ISA) {
|
||||
argHelper->printf("Unknown device : %s\n", openRange.str().c_str());
|
||||
return {};
|
||||
}
|
||||
auto configIt = std::find_if(allSupportedDeviceConfigs.begin(),
|
||||
allSupportedDeviceConfigs.end(),
|
||||
[&cf = productConfig](const DeviceMapping &c) -> bool { return cf == c.config; });
|
||||
if (rangeTo) {
|
||||
for (auto &deviceConfig : allSupportedDeviceConfigs) {
|
||||
if (deviceConfig.config <= productConfig) {
|
||||
requestedConfigs.push_back(deviceConfig);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
requestedConfigs.insert(requestedConfigs.end(), configIt, allSupportedDeviceConfigs.end());
|
||||
}
|
||||
}
|
||||
return requestedConfigs;
|
||||
}
|
||||
|
||||
std::vector<DeviceMapping> getProductConfigsForClosedRange(ConstStringRef rangeFrom, ConstStringRef rangeTo, OclocArgHelper *argHelper) {
|
||||
std::vector<DeviceMapping> requestedConfigs;
|
||||
std::vector<DeviceMapping> allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
|
||||
if (argHelper->isGen(rangeFrom.str())) {
|
||||
if (false == argHelper->isGen(rangeTo.str())) {
|
||||
argHelper->printf("Ranges mixing configs and architecture is not supported, should be architectureFrom-architectureTo or configFrom-configTo\n");
|
||||
return {};
|
||||
}
|
||||
auto coreFrom = argHelper->returnIGFXforGen(rangeFrom.str());
|
||||
auto coreTo = argHelper->returnIGFXforGen(rangeTo.str());
|
||||
if (static_cast<GFXCORE_FAMILY>(coreFrom) > static_cast<GFXCORE_FAMILY>(coreTo)) {
|
||||
std::swap(coreFrom, coreTo);
|
||||
}
|
||||
while (coreFrom <= coreTo) {
|
||||
argHelper->getProductConfigsForGfxCoreFamily(static_cast<GFXCORE_FAMILY>(coreFrom), requestedConfigs);
|
||||
coreFrom = static_cast<GFXCORE_FAMILY>(static_cast<unsigned int>(coreFrom) + 1);
|
||||
}
|
||||
} else {
|
||||
auto configFrom = argHelper->findConfigMatch(rangeFrom.str(), true);
|
||||
if (configFrom == PRODUCT_CONFIG::UNKNOWN_ISA) {
|
||||
argHelper->printf("Unknown device range : %s\n", rangeFrom.str().c_str());
|
||||
return {};
|
||||
}
|
||||
|
||||
auto configTo = argHelper->findConfigMatch(rangeTo.str(), false);
|
||||
if (configTo == PRODUCT_CONFIG::UNKNOWN_ISA) {
|
||||
argHelper->printf("Unknown device range : %s\n", rangeTo.str().c_str());
|
||||
return {};
|
||||
}
|
||||
|
||||
if (configFrom > configTo) {
|
||||
configFrom = argHelper->findConfigMatch(rangeTo.str(), true);
|
||||
configTo = argHelper->findConfigMatch(rangeFrom.str(), false);
|
||||
}
|
||||
|
||||
for (auto &deviceConfig : allSupportedDeviceConfigs) {
|
||||
if (deviceConfig.config >= configFrom && deviceConfig.config <= configTo) {
|
||||
requestedConfigs.push_back(deviceConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return requestedConfigs;
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> getPlatformsForClosedRange(ConstStringRef rangeFrom, ConstStringRef rangeTo, PRODUCT_FAMILY platformFrom, OclocArgHelper *argHelper) {
|
||||
std::vector<PRODUCT_FAMILY> requestedPlatforms;
|
||||
std::vector<PRODUCT_FAMILY> allSupportedPlatforms = getAllSupportedTargetPlatforms();
|
||||
|
||||
auto platformTo = asProductId(rangeTo, allSupportedPlatforms);
|
||||
if (IGFX_UNKNOWN == platformTo) {
|
||||
argHelper->printf("Unknown device : %s\n", rangeTo.str().c_str());
|
||||
auto target = rangeFromStr + ":" + rangeToStr;
|
||||
argHelper->printf("Failed to parse target : %s.\n", target.c_str());
|
||||
return {};
|
||||
}
|
||||
if (platformFrom > platformTo) {
|
||||
std::swap(platformFrom, platformTo);
|
||||
}
|
||||
|
||||
auto from = std::find(allSupportedPlatforms.begin(), allSupportedPlatforms.end(), platformFrom);
|
||||
auto to = std::find(allSupportedPlatforms.begin(), allSupportedPlatforms.end(), platformTo) + 1;
|
||||
requestedPlatforms.insert(requestedPlatforms.end(), from, to);
|
||||
|
||||
return toProductNames(requestedPlatforms);
|
||||
return requestedProducts;
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> getPlatformsForOpenRange(ConstStringRef openRange, PRODUCT_FAMILY prodId, OclocArgHelper *argHelper, bool rangeTo) {
|
||||
std::vector<PRODUCT_FAMILY> requestedPlatforms;
|
||||
std::vector<PRODUCT_FAMILY> allSupportedPlatforms = getAllSupportedTargetPlatforms();
|
||||
std::vector<ConstStringRef> getProductForOpenRange(ConstStringRef openRange, OclocArgHelper *argHelper, bool rangeTo) {
|
||||
std::vector<ConstStringRef> requestedProducts = {};
|
||||
auto openRangeStr = openRange.str();
|
||||
|
||||
auto prodIt = std::find(allSupportedPlatforms.begin(), allSupportedPlatforms.end(), prodId);
|
||||
assert(prodIt != allSupportedPlatforms.end());
|
||||
if (rangeTo) {
|
||||
requestedPlatforms.insert(requestedPlatforms.end(), allSupportedPlatforms.begin(), prodIt + 1);
|
||||
} else {
|
||||
requestedPlatforms.insert(requestedPlatforms.end(), prodIt, allSupportedPlatforms.end());
|
||||
}
|
||||
|
||||
return toProductNames(requestedPlatforms);
|
||||
}
|
||||
|
||||
std::vector<DeviceMapping> getProductConfigsForSpecificTargets(CompilerOptions::TokenizedString targets, OclocArgHelper *argHelper) {
|
||||
std::vector<DeviceMapping> requestedConfigs;
|
||||
std::vector<DeviceMapping> allSupportedDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
|
||||
for (auto &target : targets) {
|
||||
if (argHelper->isGen(target.str())) {
|
||||
auto coreId = argHelper->returnIGFXforGen(target.str());
|
||||
argHelper->getProductConfigsForGfxCoreFamily(static_cast<GFXCORE_FAMILY>(coreId), requestedConfigs);
|
||||
if (argHelper->isFamily(openRangeStr)) {
|
||||
auto family = ProductConfigHelper::returnFamilyForAcronym(openRangeStr);
|
||||
if (rangeTo) {
|
||||
unsigned int familyFrom = AOT::UNKNOWN_FAMILY;
|
||||
++familyFrom;
|
||||
getProductsForTargetRange(static_cast<AOT::FAMILY>(familyFrom), family, requestedProducts, argHelper);
|
||||
} else {
|
||||
auto configFirstEl = argHelper->findConfigMatch(target.str(), true);
|
||||
if (configFirstEl == PRODUCT_CONFIG::UNKNOWN_ISA) {
|
||||
argHelper->printf("Unknown device range : %s\n", target.str().c_str());
|
||||
return {};
|
||||
}
|
||||
unsigned int familyTo = AOT::FAMILY_MAX;
|
||||
--familyTo;
|
||||
getProductsForTargetRange(family, static_cast<AOT::FAMILY>(familyTo), requestedProducts, argHelper);
|
||||
}
|
||||
} else if (argHelper->isRelease(openRangeStr)) {
|
||||
auto release = ProductConfigHelper::returnReleaseForAcronym(openRangeStr);
|
||||
if (rangeTo) {
|
||||
unsigned int releaseFrom = AOT::UNKNOWN_FAMILY;
|
||||
++releaseFrom;
|
||||
getProductsForTargetRange(static_cast<AOT::RELEASE>(releaseFrom), release, requestedProducts, argHelper);
|
||||
} else {
|
||||
unsigned int releaseTo = AOT::RELEASE_MAX;
|
||||
--releaseTo;
|
||||
getProductsForTargetRange(release, static_cast<AOT::RELEASE>(releaseTo), requestedProducts, argHelper);
|
||||
}
|
||||
} else if (argHelper->isProductConfig(openRangeStr)) {
|
||||
auto product = ProductConfigHelper::returnProductConfigForAcronym(openRangeStr);
|
||||
if (rangeTo) {
|
||||
unsigned int productFrom = AOT::UNKNOWN_ISA;
|
||||
++productFrom;
|
||||
getProductsForRange(productFrom, static_cast<unsigned int>(product), requestedProducts, argHelper);
|
||||
} else {
|
||||
unsigned int productTo = AOT::CONFIG_MAX_PLATFORM;
|
||||
--productTo;
|
||||
getProductsForRange(product, static_cast<AOT::PRODUCT_CONFIG>(productTo), requestedProducts, argHelper);
|
||||
}
|
||||
}
|
||||
return requestedProducts;
|
||||
}
|
||||
|
||||
auto configLastEl = argHelper->findConfigMatch(target.str(), false);
|
||||
for (auto &deviceConfig : allSupportedDeviceConfigs) {
|
||||
if (deviceConfig.config >= configFirstEl && deviceConfig.config <= configLastEl) {
|
||||
requestedConfigs.push_back(deviceConfig);
|
||||
}
|
||||
}
|
||||
std::vector<ConstStringRef> getProductForSpecificTarget(CompilerOptions::TokenizedString targets, OclocArgHelper *argHelper) {
|
||||
std::vector<ConstStringRef> requestedConfigs;
|
||||
for (const auto &target : targets) {
|
||||
auto targetStr = target.str();
|
||||
if (argHelper->isFamily(targetStr)) {
|
||||
auto family = ProductConfigHelper::returnFamilyForAcronym(targetStr);
|
||||
getProductsAcronymsForTarget(requestedConfigs, family, argHelper);
|
||||
} else if (argHelper->isRelease(targetStr)) {
|
||||
auto release = ProductConfigHelper::returnReleaseForAcronym(targetStr);
|
||||
getProductsAcronymsForTarget(requestedConfigs, release, argHelper);
|
||||
} else if (argHelper->isProductConfig(targetStr)) {
|
||||
requestedConfigs.push_back(target);
|
||||
} else {
|
||||
argHelper->printf("Failed to parse target : %s - invalid device:\n", targetStr.c_str());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return requestedConfigs;
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> getPlatformsForSpecificTargets(CompilerOptions::TokenizedString targets, OclocArgHelper *argHelper) {
|
||||
std::vector<PRODUCT_FAMILY> requestedPlatforms;
|
||||
std::vector<PRODUCT_FAMILY> allSupportedPlatforms = getAllSupportedTargetPlatforms();
|
||||
|
||||
for (auto &target : targets) {
|
||||
auto prodId = asProductId(target, allSupportedPlatforms);
|
||||
if (IGFX_UNKNOWN == prodId) {
|
||||
argHelper->printf("Unknown device : %s\n", target.str().c_str());
|
||||
return {};
|
||||
}
|
||||
requestedPlatforms.push_back(prodId);
|
||||
}
|
||||
return toProductNames(requestedPlatforms);
|
||||
}
|
||||
|
||||
bool isDeviceWithPlatformAbbreviation(ConstStringRef deviceArg, OclocArgHelper *argHelper) {
|
||||
std::vector<PRODUCT_FAMILY> allSupportedPlatforms = getAllSupportedTargetPlatforms();
|
||||
PRODUCT_FAMILY prodId = IGFX_UNKNOWN;
|
||||
auto sets = CompilerOptions::tokenize(deviceArg, ',');
|
||||
if (sets[0].contains("-")) {
|
||||
auto range = CompilerOptions::tokenize(deviceArg, '-');
|
||||
prodId = asProductId(range[0], allSupportedPlatforms);
|
||||
|
||||
} else {
|
||||
prodId = asProductId(sets[0], allSupportedPlatforms);
|
||||
}
|
||||
return prodId != IGFX_UNKNOWN;
|
||||
}
|
||||
|
||||
std::vector<ConstStringRef> getTargetPlatformsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper) {
|
||||
std::vector<PRODUCT_FAMILY> allSupportedPlatforms = getAllSupportedTargetPlatforms();
|
||||
std::vector<ConstStringRef> getTargetProductsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper) {
|
||||
std::vector<ConstStringRef> retVal;
|
||||
|
||||
auto sets = CompilerOptions::tokenize(deviceArg, ',');
|
||||
if (sets[0].contains("-")) {
|
||||
auto range = CompilerOptions::tokenize(deviceArg, '-');
|
||||
if (range.size() > 2) {
|
||||
argHelper->printf("Invalid range : %s - should be from-to or -to or from-\n", sets[0].str().c_str());
|
||||
return {};
|
||||
}
|
||||
auto prodId = asProductId(range[0], allSupportedPlatforms);
|
||||
if (range.size() == 1) {
|
||||
bool rangeTo = ('-' == sets[0][0]);
|
||||
retVal = getPlatformsForOpenRange(range[0], prodId, argHelper, rangeTo);
|
||||
} else {
|
||||
retVal = getPlatformsForClosedRange(range[0], range[1], prodId, argHelper);
|
||||
}
|
||||
} else {
|
||||
retVal = getPlatformsForSpecificTargets(sets, argHelper);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
std::vector<DeviceMapping> getTargetConfigsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper) {
|
||||
if (deviceArg == "*") {
|
||||
return argHelper->getAllSupportedDeviceConfigs();
|
||||
}
|
||||
std::vector<DeviceMapping> retVal;
|
||||
auto sets = CompilerOptions::tokenize(deviceArg, ',');
|
||||
if (sets[0].contains("-")) {
|
||||
auto range = CompilerOptions::tokenize(deviceArg, '-');
|
||||
if (range.size() > 2) {
|
||||
argHelper->printf("Invalid range : %s - should be from-to or -to or from-\n", sets[0].str().c_str());
|
||||
return {};
|
||||
}
|
||||
if (range.size() == 1) {
|
||||
bool rangeTo = ('-' == sets[0][0]);
|
||||
retVal = getProductConfigsForOpenRange(range[0], argHelper, rangeTo);
|
||||
|
||||
} else {
|
||||
retVal = getProductConfigsForClosedRange(range[0], range[1], argHelper);
|
||||
}
|
||||
return argHelper->getEnabledProductAcronyms();
|
||||
} else {
|
||||
retVal = getProductConfigsForSpecificTargets(sets, argHelper);
|
||||
auto sets = CompilerOptions::tokenize(deviceArg, ',');
|
||||
if (sets[0].contains(":")) {
|
||||
auto range = CompilerOptions::tokenize(deviceArg, ':');
|
||||
if (range.size() > 2) {
|
||||
argHelper->printf("Invalid range : %s - should be from:to or :to or from:\n", sets[0].str().c_str());
|
||||
return {};
|
||||
}
|
||||
if (range.size() == 1) {
|
||||
bool rangeTo = (':' == sets[0][0]);
|
||||
|
||||
retVal = getProductForOpenRange(range[0], argHelper, rangeTo);
|
||||
|
||||
} else {
|
||||
retVal = getProductForClosedRange(range[0], range[1], argHelper);
|
||||
}
|
||||
} else {
|
||||
retVal = getProductForSpecificTarget(sets, argHelper);
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy, std::string pointerSize, Ar::ArEncoder &fatbinary,
|
||||
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &deviceConfig) {
|
||||
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &product) {
|
||||
|
||||
if (retVal == 0) {
|
||||
retVal = buildWithSafetyGuard(pCompiler);
|
||||
@@ -321,9 +221,9 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
|
||||
}
|
||||
if (retVal == 0) {
|
||||
if (!pCompiler->isQuiet())
|
||||
argHelper->printf("Build succeeded for : %s.\n", deviceConfig.c_str());
|
||||
argHelper->printf("Build succeeded for : %s.\n", product.c_str());
|
||||
} else {
|
||||
argHelper->printf("Build failed for : %s with error code: %d\n", deviceConfig.c_str(), retVal);
|
||||
argHelper->printf("Build failed for : %s with error code: %d\n", product.c_str(), retVal);
|
||||
argHelper->printf("Command was:");
|
||||
for (const auto &arg : argsCopy)
|
||||
argHelper->printf(" %s", arg.c_str());
|
||||
@@ -333,7 +233,8 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
|
||||
if (retVal) {
|
||||
return retVal;
|
||||
}
|
||||
fatbinary.appendFileEntry(pointerSize + "." + deviceConfig, pCompiler->getPackedDeviceBinaryOutput());
|
||||
auto productConfig = ProductConfigHelper::parseMajorMinorRevisionValue(ProductConfigHelper::returnProductConfigForAcronym(product));
|
||||
fatbinary.appendFileEntry(pointerSize + "." + productConfig, pCompiler->getPackedDeviceBinaryOutput());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -384,56 +285,25 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
|
||||
}
|
||||
|
||||
Ar::ArEncoder fatbinary(true);
|
||||
if (isDeviceWithPlatformAbbreviation(ConstStringRef(args[deviceArgIndex]), argHelper)) {
|
||||
std::vector<ConstStringRef> targetPlatforms;
|
||||
targetPlatforms = getTargetPlatformsForFatbinary(ConstStringRef(args[deviceArgIndex]), argHelper);
|
||||
if (targetPlatforms.empty()) {
|
||||
argHelper->printf("Failed to parse target devices from : %s\n", args[deviceArgIndex].c_str());
|
||||
return 1;
|
||||
}
|
||||
for (auto &targetPlatform : targetPlatforms) {
|
||||
int retVal = 0;
|
||||
argsCopy[deviceArgIndex] = targetPlatform.str();
|
||||
std::vector<ConstStringRef> targetProducts;
|
||||
targetProducts = getTargetProductsForFatbinary(ConstStringRef(args[deviceArgIndex]), argHelper);
|
||||
if (targetProducts.empty()) {
|
||||
argHelper->printf("Failed to parse target devices from : %s\n", args[deviceArgIndex].c_str());
|
||||
return 1;
|
||||
}
|
||||
for (const auto &product : targetProducts) {
|
||||
int retVal = 0;
|
||||
argsCopy[deviceArgIndex] = product.str();
|
||||
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argsCopy.size(), argsCopy, false, retVal, argHelper)};
|
||||
if (OclocErrorCode::SUCCESS != retVal) {
|
||||
argHelper->printf("Error! Couldn't create OfflineCompiler. Exiting.\n");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
std::string product = hardwarePrefix[pCompiler->getHardwareInfo().platform.eProductFamily];
|
||||
auto stepping = pCompiler->getHardwareInfo().platform.usRevId;
|
||||
auto targetPlatforms = product + "." + std::to_string(stepping);
|
||||
|
||||
retVal = buildFatBinaryForTarget(retVal, argsCopy, pointerSizeInBits, fatbinary, pCompiler.get(), argHelper, targetPlatforms);
|
||||
if (retVal) {
|
||||
return retVal;
|
||||
}
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argsCopy.size(), argsCopy, false, retVal, argHelper)};
|
||||
if (OclocErrorCode::SUCCESS != retVal) {
|
||||
argHelper->printf("Error! Couldn't create OfflineCompiler. Exiting.\n");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
} else {
|
||||
std::vector<DeviceMapping> targetConfigs;
|
||||
targetConfigs = getTargetConfigsForFatbinary(ConstStringRef(args[deviceArgIndex]), argHelper);
|
||||
if (targetConfigs.empty()) {
|
||||
argHelper->printf("Failed to parse target devices from : %s\n", args[deviceArgIndex].c_str());
|
||||
return 1;
|
||||
}
|
||||
for (auto &targetConfig : targetConfigs) {
|
||||
int retVal = 0;
|
||||
|
||||
argHelper->setFatbinary(true);
|
||||
argHelper->setDeviceInfoForFatbinaryTarget(targetConfig);
|
||||
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argsCopy.size(), argsCopy, false, retVal, argHelper)};
|
||||
if (OclocErrorCode::SUCCESS != retVal) {
|
||||
argHelper->printf("Error! Couldn't create OfflineCompiler. Exiting.\n");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
auto targetConfigStr = ProductConfigHelper::parseMajorMinorRevisionValue(targetConfig.config);
|
||||
retVal = buildFatBinaryForTarget(retVal, argsCopy, pointerSizeInBits, fatbinary, pCompiler.get(), argHelper, targetConfigStr);
|
||||
if (retVal) {
|
||||
return retVal;
|
||||
}
|
||||
retVal = buildFatBinaryForTarget(retVal, argsCopy, pointerSizeInBits, fatbinary, pCompiler.get(), argHelper, product.str());
|
||||
if (retVal) {
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,19 +34,9 @@ inline int buildFatBinary(int argc, const char *argv[], OclocArgHelper *argHelpe
|
||||
return buildFatBinary(args, argHelper);
|
||||
}
|
||||
|
||||
bool isDeviceWithPlatformAbbreviation(ConstStringRef deviceArg, OclocArgHelper *argHelper);
|
||||
std::vector<PRODUCT_FAMILY> getAllSupportedTargetPlatforms();
|
||||
std::vector<PRODUCT_CONFIG> getAllMatchedConfigs(const std::string device, OclocArgHelper *argHelper);
|
||||
std::vector<DeviceMapping> getTargetConfigsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper);
|
||||
std::vector<ConstStringRef> getTargetPlatformsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper);
|
||||
std::vector<DeviceMapping> getProductConfigsForOpenRange(ConstStringRef openRange, OclocArgHelper *argHelper, bool rangeTo);
|
||||
std::vector<DeviceMapping> getProductConfigsForClosedRange(ConstStringRef rangeFrom, ConstStringRef rangeTo, OclocArgHelper *argHelper);
|
||||
std::vector<ConstStringRef> getPlatformsForClosedRange(ConstStringRef rangeFrom, ConstStringRef rangeTo, PRODUCT_FAMILY platformFrom, OclocArgHelper *argHelper);
|
||||
std::vector<ConstStringRef> getPlatformsForOpenRange(ConstStringRef openRange, PRODUCT_FAMILY prodId, OclocArgHelper *argHelper, bool rangeTo);
|
||||
std::vector<DeviceMapping> getProductConfigsForSpecificTargets(CompilerOptions::TokenizedString targets, OclocArgHelper *argHelper);
|
||||
std::vector<ConstStringRef> getPlatformsForSpecificTargets(CompilerOptions::TokenizedString targets, OclocArgHelper *argHelper);
|
||||
std::vector<ConstStringRef> toProductNames(const std::vector<PRODUCT_FAMILY> &productIds);
|
||||
PRODUCT_FAMILY asProductId(ConstStringRef product, const std::vector<PRODUCT_FAMILY> &allSupportedPlatforms);
|
||||
template <typename Target>
|
||||
void getProductsAcronymsForTarget(std::vector<NEO::ConstStringRef> &out, Target target, OclocArgHelper *argHelper);
|
||||
std::vector<ConstStringRef> getTargetProductsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper);
|
||||
int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy, std::string pointerSize, Ar::ArEncoder &fatbinary,
|
||||
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &deviceConfig);
|
||||
int appendGenericIr(Ar::ArEncoder &fatbinary, const std::string &inputFile, OclocArgHelper *argHelper);
|
||||
|
||||
@@ -327,75 +327,75 @@ void OfflineCompiler::setFamilyType() {
|
||||
familyNameWithType.append(hwInfo.capabilityTable.platformType);
|
||||
}
|
||||
|
||||
int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
int retVal = INVALID_DEVICE;
|
||||
int OfflineCompiler::initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId) {
|
||||
std::vector<PRODUCT_FAMILY> allSupportedProduct{ALL_SUPPORTED_PRODUCT_FAMILIES};
|
||||
for (const auto &product : allSupportedProduct) {
|
||||
if (0 == strcmp(deviceName.c_str(), hardwarePrefix[product])) {
|
||||
hwInfo = *hardwareInfoTable[product];
|
||||
if (revisionId != -1) {
|
||||
hwInfo.platform.usRevId = revisionId;
|
||||
}
|
||||
if (deviceId != -1) {
|
||||
hwInfo.platform.usDeviceID = deviceId;
|
||||
}
|
||||
auto hwInfoConfig = defaultHardwareInfoConfigTable[hwInfo.platform.eProductFamily];
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfo);
|
||||
hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
|
||||
setFamilyType();
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
return INVALID_DEVICE;
|
||||
}
|
||||
|
||||
if (deviceName.empty()) {
|
||||
return retVal;
|
||||
int OfflineCompiler::initHardwareInfoForProductConfig(std::string deviceName) {
|
||||
AheadOfTimeConfig aotConfig{AOT::UNKNOWN_ISA};
|
||||
if (deviceName.find(".") != std::string::npos) {
|
||||
aotConfig = argHelper->getMajorMinorRevision(deviceName);
|
||||
if (aotConfig.ProductConfig == AOT::UNKNOWN_ISA) {
|
||||
argHelper->printf("Could not determine device target: %s\n", deviceName.c_str());
|
||||
}
|
||||
} else if (argHelper->isProductConfig(deviceName)) {
|
||||
aotConfig.ProductConfig = ProductConfigHelper::returnProductConfigForAcronym(deviceName);
|
||||
}
|
||||
|
||||
if (argHelper->isFatbinary()) {
|
||||
argHelper->setHwInfoForFatbinaryTarget(hwInfo);
|
||||
setFamilyType();
|
||||
retVal = SUCCESS;
|
||||
if (aotConfig.ProductConfig != AOT::UNKNOWN_ISA) {
|
||||
if (argHelper->getHwInfoForProductConfig(aotConfig.ProductConfig, hwInfo)) {
|
||||
if (revisionId != -1) {
|
||||
hwInfo.platform.usRevId = revisionId;
|
||||
}
|
||||
deviceConfig = static_cast<AOT::PRODUCT_CONFIG>(aotConfig.ProductConfig);
|
||||
setFamilyType();
|
||||
return SUCCESS;
|
||||
}
|
||||
argHelper->printf("Could not determine target based on product config: %s\n", deviceName.c_str());
|
||||
}
|
||||
return INVALID_DEVICE;
|
||||
}
|
||||
|
||||
int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
int retVal = INVALID_DEVICE;
|
||||
if (deviceName.empty()) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
overridePlatformName(deviceName);
|
||||
std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower);
|
||||
const char hexPrefix = 2;
|
||||
auto deviceId = -1;
|
||||
std::string product("");
|
||||
int deviceId = -1;
|
||||
|
||||
auto numeration = argHelper->getMajorMinorRevision(deviceName);
|
||||
if (!numeration.empty()) {
|
||||
uint32_t productConfig = argHelper->getProductConfig(numeration);
|
||||
|
||||
if (argHelper->getHwInfoForProductConfig(productConfig, hwInfo)) {
|
||||
deviceConfig = static_cast<PRODUCT_CONFIG>(productConfig);
|
||||
setFamilyType();
|
||||
retVal = SUCCESS;
|
||||
return retVal;
|
||||
}
|
||||
argHelper->printf("Could not determine target based on product config: %s\n", deviceName.c_str());
|
||||
return retVal;
|
||||
} else if (deviceName.find(".") != std::string::npos) {
|
||||
argHelper->printf("Could not determine target based on product config: %s\n", deviceName.c_str());
|
||||
retVal = initHardwareInfoForProductConfig(deviceName);
|
||||
if (retVal == SUCCESS) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (deviceName.substr(0, hexPrefix) == "0x" && std::all_of(deviceName.begin() + hexPrefix, deviceName.end(), (::isxdigit))) {
|
||||
deviceId = stoi(deviceName, 0, 16);
|
||||
product = argHelper->returnProductNameForDevice(deviceId);
|
||||
if (!product.empty()) {
|
||||
argHelper->printf("Auto-detected target based on %s device id: %s\n", deviceName.c_str(), product.c_str());
|
||||
deviceName = product;
|
||||
} else {
|
||||
argHelper->printf("Could not determine target based on device id: %s\n", deviceName.c_str());
|
||||
deviceId = std::stoi(deviceName, 0, 16);
|
||||
if (!argHelper->setAcronymForDeviceId(deviceName)) {
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) {
|
||||
if (hardwarePrefix[productId] && (0 == strcmp(deviceName.c_str(), hardwarePrefix[productId]))) {
|
||||
if (hardwareInfoTable[productId]) {
|
||||
hwInfo = *hardwareInfoTable[productId];
|
||||
if (revisionId != -1) {
|
||||
hwInfo.platform.usRevId = revisionId;
|
||||
}
|
||||
if (deviceId != -1) {
|
||||
hwInfo.platform.usDeviceID = deviceId;
|
||||
}
|
||||
|
||||
auto hwInfoConfig = defaultHardwareInfoConfigTable[hwInfo.platform.eProductFamily];
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfo);
|
||||
hardwareInfoBaseSetup[hwInfo.platform.eProductFamily](&hwInfo, true);
|
||||
setFamilyType();
|
||||
retVal = SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
retVal = initHardwareInfoForDeprecatedAcronyms(deviceName, deviceId);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
@@ -756,51 +756,52 @@ std::string OfflineCompiler::getFileNameTrunk(std::string &filePath) {
|
||||
return fileTrunk;
|
||||
}
|
||||
|
||||
std::string getDevicesTypes() {
|
||||
std::list<std::string> prefixes;
|
||||
template <typename EqComparableT>
|
||||
auto findDuplicate(const EqComparableT &lhs) {
|
||||
return [&lhs](const auto &rhs) { return lhs == rhs; };
|
||||
}
|
||||
|
||||
std::string OfflineCompiler::getDeprecatedDevicesTypes() {
|
||||
std::vector<std::string> prefixes;
|
||||
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
||||
if (hardwarePrefix[j] == nullptr)
|
||||
continue;
|
||||
prefixes.push_back(hardwarePrefix[j]);
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
for (auto it = prefixes.begin(); it != prefixes.end(); it++) {
|
||||
if (it != prefixes.begin())
|
||||
os << ", ";
|
||||
os << *it;
|
||||
std::vector<NEO::ConstStringRef> enabledAcronyms{};
|
||||
auto enabledConfigs = argHelper->getAllSupportedDeviceConfigs();
|
||||
for (const auto &device : enabledConfigs) {
|
||||
enabledAcronyms.insert(enabledAcronyms.end(), device.acronyms.begin(), device.acronyms.end());
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string getDevicesFamilies() {
|
||||
std::list<std::string> prefixes;
|
||||
for (unsigned int i = 0; i < IGFX_MAX_CORE; ++i) {
|
||||
if (familyName[i] == nullptr)
|
||||
std::ostringstream os;
|
||||
for (const auto &prefix : prefixes) {
|
||||
if (std::any_of(enabledAcronyms.begin(), enabledAcronyms.end(), findDuplicate(prefix)))
|
||||
continue;
|
||||
prefixes.push_back(familyName[i]);
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
for (auto it = prefixes.begin(); it != prefixes.end(); it++) {
|
||||
if (it != prefixes.begin())
|
||||
if (os.tellp())
|
||||
os << ", ";
|
||||
os << *it;
|
||||
os << prefix;
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string OfflineCompiler::getDevicesConfigs() {
|
||||
std::list<std::string> configNum;
|
||||
auto allSupportedConfigs = argHelper->getAllSupportedProductConfigs();
|
||||
std::string OfflineCompiler::getDevicesReleasesAndFamilies() {
|
||||
auto acronyms = argHelper->getEnabledReleasesAcronyms();
|
||||
auto familiesAcronyms = argHelper->getEnabledFamiliesAcronyms();
|
||||
|
||||
for (const auto &family : familiesAcronyms) {
|
||||
if (!std::any_of(acronyms.begin(), acronyms.end(), findDuplicate(family))) {
|
||||
acronyms.push_back(family);
|
||||
}
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
for (auto it = allSupportedConfigs.begin(); it != allSupportedConfigs.end(); it++) {
|
||||
if (it != allSupportedConfigs.begin())
|
||||
for (const auto &acronym : acronyms) {
|
||||
if (os.tellp())
|
||||
os << ", ";
|
||||
os << ProductConfigHelper::parseMajorMinorRevisionValue(*it);
|
||||
os << acronym.str();
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -818,14 +819,9 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
|
||||
OpenCL C kernel language).
|
||||
|
||||
-device <device_type> Target device.
|
||||
<device_type> can be: %s, %s or hexadecimal value with 0x prefix - can be single or multiple target devices.
|
||||
The <major>[<minor>[.<revision>]] numbers:
|
||||
<major> - family of graphics products,
|
||||
<minor> - can be omitted, then ocloc will
|
||||
compile for all of the <major> matching devices.
|
||||
<revision> - can be omitted, then ocloc will
|
||||
compile for all of the <major>.<minor> matching
|
||||
devices.
|
||||
<device_type> can be: %s, %s, version or hexadecimal value with 0x prefix - can be single or multiple target devices.
|
||||
The version is a representation of the
|
||||
<major>.<minor>.<revision> value.
|
||||
The hexadecimal value represents device ID.
|
||||
If such value is provided, ocloc will try to
|
||||
match it with corresponding device type.
|
||||
@@ -836,41 +832,31 @@ Usage: ocloc [compile] -file <filename> -device <device_type> [-output <filename
|
||||
create a fatbinary archive that contains all of
|
||||
device binaries produced this way.
|
||||
Supported -device patterns examples:
|
||||
-device 0xFF20 ; will compile 1 target (tgllp)
|
||||
-device 12.0.7 ; will compile 1 target (dg1)
|
||||
-device 11 ; will compile the architecture
|
||||
(gen11)
|
||||
-device 9.0,11.0 ; will compile 2 targets
|
||||
(skl & icllp)
|
||||
-device 9.0-11.0 ; will compile all targets
|
||||
in range (inclusive)
|
||||
-device 9.0- ; will compile all targets
|
||||
newer/same as provided
|
||||
-device -9.0 ; will compile all targets
|
||||
older/same as provided
|
||||
-device * ; will compile all targets
|
||||
known to ocloc
|
||||
-device 0x4905 ; will compile 1 target (dg1)
|
||||
-device 12.10.0 ; will compile 1 target (dg1)
|
||||
-device dg1 ; will compile 1 target
|
||||
-device dg1,acm-g10 ; will compile 2 targets
|
||||
-device dg1:acm-g10 ; will compile all targets
|
||||
in range (inclusive)
|
||||
-device dg1: ; will compile all targets
|
||||
newer/same as provided
|
||||
-device :dg1 ; will compile all targets
|
||||
older/same as provided
|
||||
-device xe-hpg ; will compile all targets
|
||||
matching the same release
|
||||
-device xe ; will compile all targets
|
||||
matching the same family
|
||||
-device xe-hpg:xe-hpc ; will compile all targets
|
||||
in range (inclusive)
|
||||
-device xe-hpg: ; will compile all targets
|
||||
newer/same as provided
|
||||
-device :xe-hpg ; will compile all targets
|
||||
older/same as provided
|
||||
known to ocloc
|
||||
|
||||
Deprecated notation that is still supported:
|
||||
<device_type> can be: %s
|
||||
- can be single or multiple target devices.
|
||||
Supported -device patterns examples:
|
||||
-device skl ; will compile 1 target
|
||||
-device skl,icllp ; will compile 2 targets
|
||||
-device skl-icllp ; will compile all targets
|
||||
in range (inclusive)
|
||||
-device skl- ; will compile all targets
|
||||
newer/same as provided
|
||||
-device -skl ; will compile all targets
|
||||
older/same as provided
|
||||
-device gen9 ; will compile all targets
|
||||
matching the same gen
|
||||
-device gen9-gen11 ; will compile all targets
|
||||
in range (inclusive)
|
||||
-device gen9- ; will compile all targets
|
||||
newer/same as provided
|
||||
-device -gen9 ; will compile all targets
|
||||
older/same as provided
|
||||
- can be single target device.
|
||||
|
||||
-output <filename> Optional output file base name.
|
||||
Default is input file's base name.
|
||||
@@ -962,9 +948,9 @@ Examples :
|
||||
Compile file to Intel Compute GPU device binary (out = source_file_Gen9core.bin)
|
||||
ocloc -file source_file.cl -device skl
|
||||
)===",
|
||||
getDevicesConfigs().c_str(),
|
||||
NEO::getDevicesFamilies().c_str(),
|
||||
NEO::getDevicesTypes().c_str());
|
||||
argHelper->getAllSupportedAcronyms().c_str(),
|
||||
getDevicesReleasesAndFamilies().c_str(),
|
||||
getDeprecatedDevicesTypes().c_str());
|
||||
}
|
||||
|
||||
void OfflineCompiler::storeBinary(
|
||||
|
||||
@@ -29,7 +29,6 @@ class OsLibrary;
|
||||
std::string convertToPascalCase(const std::string &inString);
|
||||
|
||||
std::string generateFilePath(const std::string &directory, const std::string &fileNameBase, const char *extension);
|
||||
std::string getDevicesTypes();
|
||||
|
||||
class OfflineCompiler {
|
||||
public:
|
||||
@@ -39,7 +38,8 @@ class OfflineCompiler {
|
||||
MOCKABLE_VIRTUAL int build();
|
||||
std::string &getBuildLog();
|
||||
void printUsage();
|
||||
std::string getDevicesConfigs();
|
||||
std::string getDevicesReleasesAndFamilies();
|
||||
std::string getDeprecatedDevicesTypes();
|
||||
|
||||
static constexpr ConstStringRef queryHelp =
|
||||
"Depending on <query_option> will generate file\n"
|
||||
@@ -91,6 +91,9 @@ class OfflineCompiler {
|
||||
|
||||
void setFamilyType();
|
||||
int initHardwareInfo(std::string deviceName);
|
||||
int initHardwareInfoForProductConfig(std::string deviceName);
|
||||
int initHardwareInfoForDeprecatedAcronyms(std::string deviceName, int deviceId);
|
||||
|
||||
std::string getStringWithinDelimiters(const std::string &src);
|
||||
int initialize(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles);
|
||||
int parseCommandLine(size_t numArgs, const std::vector<std::string> &allArgs);
|
||||
@@ -120,7 +123,7 @@ class OfflineCompiler {
|
||||
void enforceFormat(std::string &format);
|
||||
HardwareInfo hwInfo;
|
||||
|
||||
PRODUCT_CONFIG deviceConfig = UNKNOWN_ISA;
|
||||
AOT::PRODUCT_CONFIG deviceConfig = AOT::UNKNOWN_ISA;
|
||||
std::string deviceName;
|
||||
std::string familyNameWithType;
|
||||
std::string inputFile;
|
||||
|
||||
@@ -34,8 +34,8 @@ SingleDeviceBinary unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(co
|
||||
}
|
||||
|
||||
std::string pointerSize = ((requestedTargetDevice.maxPointerSizeInBytes == 8) ? "64" : "32");
|
||||
std::string filterPointerSizeAndMajorMinorRevision = pointerSize + "." + NEO::ProductConfigHelper::parseMajorMinorRevisionValue(requestedTargetDevice.productConfig);
|
||||
std::string filterPointerSizeAndMajorMinor = pointerSize + "." + NEO::ProductConfigHelper::parseMajorMinorValue(requestedTargetDevice.productConfig);
|
||||
std::string filterPointerSizeAndMajorMinorRevision = pointerSize + "." + ProductConfigHelper::parseMajorMinorRevisionValue(requestedTargetDevice.aotConfig);
|
||||
std::string filterPointerSizeAndMajorMinor = pointerSize + "." + ProductConfigHelper::parseMajorMinorValue(requestedTargetDevice.aotConfig);
|
||||
std::string filterPointerSizeAndPlatform = pointerSize + "." + requestedProductAbbreviation.str();
|
||||
std::string filterPointerSizeAndPlatformAndStepping = filterPointerSizeAndPlatform + "." + std::to_string(requestedTargetDevice.stepping);
|
||||
ConstStringRef filterGenericIrFileName{"generic_ir"};
|
||||
|
||||
@@ -25,7 +25,7 @@ TargetDevice targetDeviceFromHwInfo(const HardwareInfo &hwInfo) {
|
||||
|
||||
targetDevice.coreFamily = hwInfo.platform.eRenderCoreFamily;
|
||||
targetDevice.productFamily = hwInfo.platform.eProductFamily;
|
||||
targetDevice.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
targetDevice.aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
targetDevice.stepping = hwInfo.platform.usRevId;
|
||||
targetDevice.maxPointerSizeInBytes = sizeof(uintptr_t);
|
||||
targetDevice.grfSize = hwInfo.capabilityTable.grfSize;
|
||||
|
||||
@@ -60,7 +60,7 @@ inline const char *asString(DecodeError err) {
|
||||
struct TargetDevice {
|
||||
GFXCORE_FAMILY coreFamily = IGFX_UNKNOWN_CORE;
|
||||
PRODUCT_FAMILY productFamily = IGFX_UNKNOWN;
|
||||
PRODUCT_CONFIG productConfig = UNKNOWN_ISA;
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
uint32_t stepping = 0U;
|
||||
uint32_t maxPointerSizeInBytes = 4U;
|
||||
uint32_t grfSize = 32U;
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN_ISA = 0,
|
||||
BDW = 0x080000,
|
||||
SKL = 0x090000,
|
||||
KBL = 0x090100,
|
||||
CML = 0x090200,
|
||||
AML = 0x090200,
|
||||
WHL = 0x090200,
|
||||
CFL = 0x090200,
|
||||
BXT = 0x090300,
|
||||
APL = 0x090300,
|
||||
GLK = 0x090400,
|
||||
ICL = 0x0b0000,
|
||||
LKF = 0x0b0100,
|
||||
JSL = 0x0b0200,
|
||||
EHL = 0x0b0200,
|
||||
DG1 = 0x0c0000,
|
||||
RPL_S = 0x0c0000,
|
||||
ADL_P = 0x0c0000,
|
||||
ADL_S = 0x0c0000,
|
||||
ADL_N = 0x0c0000,
|
||||
RKL = 0x0c0000,
|
||||
TGL = 0x0c0000,
|
||||
XEHP_SDV = 0x0c0100,
|
||||
DG2_G10_A0 = 0x0c0200,
|
||||
DG2_G11 = 0x0c0201,
|
||||
DG2_G10_B0 = 0x0c0201,
|
||||
DG2_G12 = 0x0c0202,
|
||||
PVC_XL_A0 = 0x0c0300,
|
||||
PVC_XL_A0P = 0x0c0301,
|
||||
PVC_XT_A0 = 0x0c0400,
|
||||
PVC_XT_B0 = 0x0c0401,
|
||||
PVC_XT_B1 = 0x0c0402,
|
||||
PVC_XT_C0 = 0x0c0403,
|
||||
CONFIG_MAX_PLATFORM,
|
||||
} PRODUCT_CONFIG;
|
||||
@@ -7,85 +7,86 @@
|
||||
|
||||
#if SUPPORT_XE_HPC_CORE
|
||||
#ifdef SUPPORT_PVC
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XL_A0, PvcHwConfig, PVC_XL_IDS, 0x00)
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XL_A0P, PvcHwConfig, PVC_XL_IDS, 0x01)
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_A0, PvcHwConfig, PVC_XT_IDS, 0x03)
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_B0, PvcHwConfig, PVC_XT_IDS, 0x05)
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_B1, PvcHwConfig, PVC_XT_IDS, 0x06)
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(PVC_XT_C0, PvcHwConfig, PVC_XT_IDS, 0x07)
|
||||
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)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_XE_HPG_CORE
|
||||
#ifdef SUPPORT_DG2
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(DG2_G10_A0, Dg2HwConfig, DG2_G10_IDS, 0x00)
|
||||
DEVICE_CONFIG_IDS_AND_REVISION(DG2_G10_B0, Dg2HwConfig, DG2_G10_IDS, 0x04)
|
||||
DEVICE_CONFIG_IDS(DG2_G11, Dg2HwConfig, DG2_G11_IDS)
|
||||
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)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_XE_HP_CORE
|
||||
#ifdef SUPPORT_XE_HP_SDV
|
||||
DEVICE_CONFIG(XEHP_SDV, XehpSdvHwConfig)
|
||||
DEVICE_CONFIG(XEHP_SDV, XehpSdvHwConfig, XE_FAMILY, XE_HP_RELEASE)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_GEN12LP
|
||||
#ifdef SUPPORT_TGLLP
|
||||
DEVICE_CONFIG(TGL, TgllpHw1x6x16)
|
||||
DEVICE_CONFIG(TGL, TgllpHw1x6x16, GEN12LP_FAMILY, GEN12LP_RELEASE)
|
||||
#endif
|
||||
#ifdef SUPPORT_DG1
|
||||
DEVICE_CONFIG(DG1, Dg1HwConfig)
|
||||
DEVICE_CONFIG(DG1, Dg1HwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
|
||||
#endif
|
||||
#ifdef SUPPORT_RKL
|
||||
DEVICE_CONFIG(RKL, RklHwConfig)
|
||||
DEVICE_CONFIG(RKL, RklHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
|
||||
#endif
|
||||
#ifdef SUPPORT_ADLS
|
||||
DEVICE_CONFIG(ADL_S, AdlsHwConfig)
|
||||
DEVICE_CONFIG(ADL_S, AdlsHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
|
||||
#endif
|
||||
#ifdef SUPPORT_ADLP
|
||||
DEVICE_CONFIG(ADL_P, AdlpHwConfig)
|
||||
DEVICE_CONFIG(ADL_P, AdlpHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
|
||||
#endif
|
||||
#ifdef SUPPORT_ADLN
|
||||
DEVICE_CONFIG(ADL_N, AdlnHwConfig)
|
||||
DEVICE_CONFIG(ADL_N, AdlnHwConfig, GEN12LP_FAMILY, GEN12LP_RELEASE)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_GEN11
|
||||
#ifdef SUPPORT_ICLLP
|
||||
DEVICE_CONFIG(ICL, IcllpHw1x8x8)
|
||||
DEVICE_CONFIG(ICL, IcllpHw1x8x8, GEN11_FAMILY, GEN11_RELEASE)
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_EHL
|
||||
DEVICE_CONFIG(EHL, EhlHwConfig)
|
||||
DEVICE_CONFIG(EHL, EhlHwConfig, GEN11_FAMILY, GEN11_RELEASE)
|
||||
#endif
|
||||
#ifdef SUPPORT_LKF
|
||||
DEVICE_CONFIG(LKF, LkfHw1x8x8)
|
||||
DEVICE_CONFIG(LKF, LkfHw1x8x8, GEN11_FAMILY, GEN11_RELEASE)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_GEN9
|
||||
#ifdef SUPPORT_SKL
|
||||
DEVICE_CONFIG(SKL, SklHw1x3x8)
|
||||
DEVICE_CONFIG(SKL, SklHw1x3x8, GEN9_FAMILY, GEN9_RELEASE)
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_KBL
|
||||
DEVICE_CONFIG(KBL, KblHw1x3x6)
|
||||
DEVICE_CONFIG(KBL, KblHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_CFL
|
||||
DEVICE_CONFIG(CFL, CflHw1x3x6)
|
||||
DEVICE_CONFIG(CFL, CflHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_GLK
|
||||
DEVICE_CONFIG(GLK, GlkHw1x3x6)
|
||||
DEVICE_CONFIG(GLK, GlkHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_BXT
|
||||
DEVICE_CONFIG(BXT, BxtHw1x3x6)
|
||||
DEVICE_CONFIG(APL, BxtHw1x3x6, GEN9_FAMILY, GEN9_RELEASE)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_GEN8
|
||||
DEVICE_CONFIG(BDW, BdwHw1x3x8)
|
||||
DEVICE_CONFIG(BDW, BdwHw1x3x8, GEN8_FAMILY, GEN8_RELEASE)
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::EHL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::EHL;
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/gen11/hw_cmds.h"
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -21,6 +21,6 @@ bool HwInfoConfigHw<gfxProduct>::isReturnedCmdSizeForMediaSamplerAdjustmentRequi
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::ICL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::ICL;
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::LKF;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::LKF;
|
||||
}
|
||||
@@ -15,8 +15,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::ADL_N;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::ADL_N;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -17,8 +17,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::ADL_P;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::ADL_P;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -17,8 +17,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::ADL_S;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::ADL_S;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -17,8 +17,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::DG1;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::DG1;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/gen12lp/hw_cmds.h"
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -19,8 +19,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::RKL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::RKL;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -19,8 +19,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::TGL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::TGL;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::BDW;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::BDW;
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/gen8/hw_cmds.h"
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::BXT;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::APL;
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::CFL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::CFL;
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/gen9/hw_cmds.h"
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::GLK;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::GLK;
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::KBL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::KBL;
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::SKL;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::SKL;
|
||||
}
|
||||
@@ -34,6 +34,7 @@ set(NEO_CORE_HELPERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_aot_config_bdw_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config_bdw_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_options_parser.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_options_parser.h
|
||||
@@ -105,6 +106,7 @@ set(NEO_CORE_HELPERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preamble_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preamble_bdw_and_later.inl
|
||||
${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}/ptr_math.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper.h
|
||||
|
||||
17
shared/source/helpers/compiler_aot_config_bdw_and_later.inl
Normal file
17
shared/source/helpers/compiler_aot_config_bdw_and_later.inl
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
namespace NEO {
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
void CompilerHwInfoConfigHw<gfxProduct>::setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const {
|
||||
hwInfo.platform.usRevId = config.ProductConfigID.Revision;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
|
||||
#include "igfxfmid.h"
|
||||
|
||||
@@ -28,6 +29,7 @@ class CompilerHwInfoConfig {
|
||||
virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0;
|
||||
virtual bool isForceToStatelessRequired() const = 0;
|
||||
virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0;
|
||||
virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const = 0;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
@@ -43,6 +45,7 @@ class CompilerHwInfoConfigHw : public CompilerHwInfoConfig {
|
||||
bool isStatelessToStatefulBufferOffsetSupported() const override;
|
||||
bool isForceToStatelessRequired() const override;
|
||||
void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override;
|
||||
void setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const override;
|
||||
|
||||
protected:
|
||||
CompilerHwInfoConfigHw() = default;
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace CommonConstants {
|
||||
constexpr uint64_t unsupportedPatIndex = std::numeric_limits<uint64_t>::max();
|
||||
constexpr uint32_t unspecifiedDeviceIndex = std::numeric_limits<uint32_t>::max();
|
||||
constexpr uint32_t invalidStepping = std::numeric_limits<uint32_t>::max();
|
||||
constexpr uint32_t invalidRevisionID = std::numeric_limits<uint16_t>::max();
|
||||
constexpr uint32_t maximalSimdSize = 32;
|
||||
constexpr uint32_t maximalSizeOfAtomicType = 8;
|
||||
constexpr uint32_t engineGroupCount = static_cast<uint32_t>(NEO::EngineGroupType::MaxEngineGroups);
|
||||
|
||||
50
shared/source/helpers/product_config_helper.cpp
Normal file
50
shared/source/helpers/product_config_helper.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
|
||||
AOT::RELEASE ProductConfigHelper::returnReleaseForAcronym(const std::string &device) {
|
||||
auto it = AOT::releaseAcronyms.find(device);
|
||||
if (it == AOT::releaseAcronyms.end())
|
||||
return AOT::UNKNOWN_RELEASE;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
AOT::FAMILY ProductConfigHelper::returnFamilyForAcronym(const std::string &device) {
|
||||
auto it = AOT::familyAcronyms.find(device);
|
||||
if (it == AOT::familyAcronyms.end())
|
||||
return AOT::UNKNOWN_FAMILY;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
AOT::PRODUCT_CONFIG ProductConfigHelper::returnProductConfigForAcronym(const std::string &device) {
|
||||
auto it = AOT::productConfigAcronyms.find(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) {
|
||||
return NEO::ConstStringRef(acronym);
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string ProductConfigHelper::parseMajorMinorRevisionValue(AheadOfTimeConfig config) {
|
||||
std::stringstream stringConfig;
|
||||
stringConfig << config.ProductConfigID.Major << "." << config.ProductConfigID.Minor << "." << config.ProductConfigID.Revision;
|
||||
return stringConfig.str();
|
||||
}
|
||||
|
||||
std::string ProductConfigHelper::parseMajorMinorValue(AheadOfTimeConfig config) {
|
||||
std::stringstream stringConfig;
|
||||
stringConfig << config.ProductConfigID.Major << "." << config.ProductConfigID.Minor;
|
||||
return stringConfig.str();
|
||||
}
|
||||
@@ -6,36 +6,38 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/utilities/const_stringref.h"
|
||||
|
||||
#include "platforms.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
struct ProductConfigHelper {
|
||||
static uint32_t getMajor(PRODUCT_CONFIG config) {
|
||||
return (static_cast<uint32_t>(config) & 0xff0000) >> 16;
|
||||
}
|
||||
|
||||
static uint32_t getMinor(PRODUCT_CONFIG config) {
|
||||
return (static_cast<uint32_t>(config) & 0x00ff00) >> 8;
|
||||
}
|
||||
|
||||
static uint32_t getRevision(PRODUCT_CONFIG config) {
|
||||
return static_cast<uint32_t>(config) & 0x0000ff;
|
||||
}
|
||||
|
||||
static std::string parseMajorMinorRevisionValue(PRODUCT_CONFIG config) {
|
||||
std::stringstream stringConfig;
|
||||
stringConfig << getMajor(config) << "." << getMinor(config) << "." << getRevision(config);
|
||||
return stringConfig.str();
|
||||
}
|
||||
|
||||
static std::string parseMajorMinorValue(PRODUCT_CONFIG config) {
|
||||
std::stringstream stringConfig;
|
||||
stringConfig << getMajor(config) << "." << getMinor(config);
|
||||
return stringConfig.str();
|
||||
}
|
||||
struct AheadOfTimeConfig {
|
||||
union {
|
||||
uint32_t ProductConfig;
|
||||
struct
|
||||
{
|
||||
uint32_t Revision : 6;
|
||||
uint32_t Reserved : 8;
|
||||
uint32_t Minor : 8;
|
||||
uint32_t Major : 10;
|
||||
} ProductConfigID;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
struct ProductConfigHelper {
|
||||
static std::string parseMajorMinorValue(AheadOfTimeConfig config);
|
||||
static std::string parseMajorMinorRevisionValue(AheadOfTimeConfig config);
|
||||
inline static std::string parseMajorMinorRevisionValue(AOT::PRODUCT_CONFIG config) {
|
||||
std::stringstream stringConfig;
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = config;
|
||||
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);
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ class HwInfoConfig {
|
||||
virtual bool obtainBlitterPreference(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isBlitterFullySupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual PRODUCT_CONFIG getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual AOT::PRODUCT_CONFIG getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual uint32_t getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const = 0;
|
||||
virtual uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual uint32_t getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const = 0;
|
||||
@@ -156,7 +156,7 @@ class HwInfoConfigHw : public HwInfoConfig {
|
||||
bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const override;
|
||||
bool overrideGfxPartitionLayoutForWsl() const override;
|
||||
uint32_t getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const override;
|
||||
PRODUCT_CONFIG getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const override;
|
||||
AOT::PRODUCT_CONFIG getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const override;
|
||||
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override;
|
||||
uint32_t getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const override;
|
||||
void setAdditionalPipelineSelectFields(void *pipelineSelectCmd, const PipelineSelectArgs &pipelineSelectArgs, const HardwareInfo &hwInfo) override;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -21,8 +21,8 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return PRODUCT_CONFIG::XEHP_SDV;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::XEHP_SDV;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -53,31 +53,31 @@ uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
uint32_t stepping = getSteppingFromHwRevId(hwInfo);
|
||||
if (stepping == CommonConstants::invalidStepping) {
|
||||
return PRODUCT_CONFIG::UNKNOWN_ISA;
|
||||
return AOT::UNKNOWN_ISA;
|
||||
}
|
||||
|
||||
if (PVC::isXl(hwInfo)) {
|
||||
switch (hwInfo.platform.usRevId) {
|
||||
case 0x0:
|
||||
return PRODUCT_CONFIG::PVC_XL_A0;
|
||||
return AOT::PVC_XL_A0;
|
||||
default:
|
||||
case 0x1:
|
||||
return PRODUCT_CONFIG::PVC_XL_A0P;
|
||||
return AOT::PVC_XL_A0P;
|
||||
}
|
||||
} else {
|
||||
switch (hwInfo.platform.usRevId) {
|
||||
case 0x3:
|
||||
return PRODUCT_CONFIG::PVC_XT_A0;
|
||||
case 0x5:
|
||||
return PRODUCT_CONFIG::PVC_XT_B0;
|
||||
case 0x6:
|
||||
return PRODUCT_CONFIG::PVC_XT_B1;
|
||||
return AOT::PVC_XT_A0;
|
||||
case 05:
|
||||
return AOT::PVC_XT_B0;
|
||||
case 06:
|
||||
return AOT::PVC_XT_B1;
|
||||
default:
|
||||
case 0x7:
|
||||
return PRODUCT_CONFIG::PVC_XT_C0;
|
||||
case 07:
|
||||
return AOT::PVC_XT_C0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,27 @@
|
||||
*/
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
uint32_t stepping = getSteppingFromHwRevId(hwInfo);
|
||||
if (stepping == CommonConstants::invalidStepping) {
|
||||
return PRODUCT_CONFIG::UNKNOWN_ISA;
|
||||
}
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
if (DG2::isG10(hwInfo)) {
|
||||
switch (stepping) {
|
||||
case REVISION_A0:
|
||||
case REVISION_A1:
|
||||
return PRODUCT_CONFIG::DG2_G10_A0;
|
||||
default:
|
||||
case REVISION_B:
|
||||
return PRODUCT_CONFIG::DG2_G10_B0;
|
||||
switch (hwInfo.platform.usRevId) {
|
||||
case 0x0:
|
||||
return AOT::DG2_G10_A0;
|
||||
case 0x1:
|
||||
return AOT::DG2_G10_A1;
|
||||
case 0x4:
|
||||
return AOT::DG2_G10_B0;
|
||||
case 0x8:
|
||||
return AOT::DG2_G10_C0;
|
||||
}
|
||||
} else {
|
||||
return PRODUCT_CONFIG::DG2_G11;
|
||||
switch (hwInfo.platform.usRevId) {
|
||||
case 0x0:
|
||||
return AOT::DG2_G11_A0;
|
||||
case 0x4:
|
||||
return AOT::DG2_G11_B0;
|
||||
case 0x5:
|
||||
return AOT::DG2_G11_B1;
|
||||
}
|
||||
}
|
||||
return AOT::UNKNOWN_ISA;
|
||||
}
|
||||
@@ -35,8 +35,9 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
|
||||
return 0x4;
|
||||
case REVISION_C:
|
||||
return 0x8;
|
||||
default:
|
||||
return CommonConstants::invalidStepping;
|
||||
}
|
||||
return CommonConstants::invalidStepping;
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -50,8 +51,9 @@ uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &
|
||||
return REVISION_B;
|
||||
case 0x8:
|
||||
return REVISION_C;
|
||||
default:
|
||||
return CommonConstants::invalidStepping;
|
||||
}
|
||||
return CommonConstants::invalidStepping;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
|
||||
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
|
||||
#include "shared/source/helpers/enable_product.inl"
|
||||
|
||||
@@ -7,20 +7,39 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/xe_hpc_core/hw_cmds_base.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct ProductConfigTests : public ::testing::Test {
|
||||
template <typename T>
|
||||
struct ProductConfigTest : public T {
|
||||
void SetUp() override {
|
||||
T::SetUp();
|
||||
hwInfo = *NEO::defaultHwInfo;
|
||||
hwInfoConfig = NEO::HwInfoConfig::get(productFamily);
|
||||
}
|
||||
|
||||
NEO::HwInfoConfig *hwInfoConfig = nullptr;
|
||||
NEO::HardwareInfo hwInfo = {};
|
||||
PRODUCT_CONFIG productConfig = UNKNOWN_ISA;
|
||||
};
|
||||
AOT::PRODUCT_CONFIG productConfig = AOT::UNKNOWN_ISA;
|
||||
};
|
||||
|
||||
struct ProductConfigHwInfoTests : public ProductConfigTest<::testing::TestWithParam<std::tuple<AOT::PRODUCT_CONFIG, PRODUCT_FAMILY>>> {
|
||||
void SetUp() override {
|
||||
ProductConfigTest::SetUp();
|
||||
std::tie(productConfig, prod) = GetParam();
|
||||
if (prod != productFamily) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
}
|
||||
PRODUCT_FAMILY prod = IGFX_UNKNOWN;
|
||||
const AheadOfTimeConfig invalidConfig = {CommonConstants::invalidRevisionID};
|
||||
};
|
||||
|
||||
using ProductConfigTests = ProductConfigTest<::testing::Test>;
|
||||
using ProductConfigHwInfoBadRevisionTests = ProductConfigHwInfoTests;
|
||||
using ProductConfigHwInfoBadArchTests = ProductConfigHwInfoTests;
|
||||
|
||||
@@ -107,8 +107,8 @@ uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping,
|
||||
}
|
||||
|
||||
template <>
|
||||
PRODUCT_CONFIG HwInfoConfigHw<IGFX_UNKNOWN>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return UNKNOWN_ISA;
|
||||
AOT::PRODUCT_CONFIG HwInfoConfigHw<IGFX_UNKNOWN>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
|
||||
return AOT::UNKNOWN_ISA;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
15
shared/test/common/xe_hpc_core/pvc/CMakeLists.txt
Normal file
15
shared/test/common/xe_hpc_core/pvc/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_PVC)
|
||||
set(NEO_CORE_TESTS_PVC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_configs_pvc.h
|
||||
)
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_PVC ${NEO_CORE_TESTS_PVC})
|
||||
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_PVC})
|
||||
|
||||
endif()
|
||||
19
shared/test/common/xe_hpc_core/pvc/product_configs_pvc.h
Normal file
19
shared/test/common/xe_hpc_core/pvc/product_configs_pvc.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "platforms.h"
|
||||
|
||||
namespace AOT_PVC {
|
||||
constexpr AOT::PRODUCT_CONFIG productConfigs[] = {
|
||||
AOT::PVC_XL_A0,
|
||||
AOT::PVC_XL_A0P,
|
||||
AOT::PVC_XT_A0,
|
||||
AOT::PVC_XT_B0,
|
||||
AOT::PVC_XT_B1,
|
||||
AOT::PVC_XT_C0};
|
||||
}
|
||||
@@ -13,6 +13,7 @@ if(TESTS_DG2)
|
||||
set(NEO_CORE_TESTS_XE_HPG_CORE_DG2
|
||||
${IGDRCL_SRCS_tests_xe_hpg_core_dg2_excludes}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_configs_dg2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_helper_dg2.cpp
|
||||
@@ -21,4 +22,5 @@ if(TESTS_DG2)
|
||||
)
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HPG_CORE_DG2})
|
||||
add_subdirectories()
|
||||
endif()
|
||||
|
||||
20
shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h
Normal file
20
shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "platforms.h"
|
||||
|
||||
namespace AOT_DG2 {
|
||||
constexpr AOT::PRODUCT_CONFIG productConfigs[] = {
|
||||
AOT::DG2_G10_A0,
|
||||
AOT::DG2_G10_A1,
|
||||
AOT::DG2_G10_B0,
|
||||
AOT::DG2_G10_C0,
|
||||
AOT::DG2_G11_A0,
|
||||
AOT::DG2_G11_B0,
|
||||
AOT::DG2_G11_B1};
|
||||
}
|
||||
@@ -59,11 +59,12 @@ TEST(UnpackSingleDeviceBinaryAr, WhenBinaryWithProductConfigIsFoundThenChooseItA
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
|
||||
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
|
||||
|
||||
@@ -74,7 +75,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenBinaryWithProductConfigIsFoundThenChooseItA
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = productConfig;
|
||||
target.aotConfig = aotConfig;
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
@@ -99,11 +100,12 @@ TEST(UnpackSingleDeviceBinaryAr, WhenBinaryWithProductConfigIsFoundThenPackedTar
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
|
||||
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
|
||||
|
||||
@@ -114,7 +116,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenBinaryWithProductConfigIsFoundThenPackedTar
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = productConfig;
|
||||
target.aotConfig = aotConfig;
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
@@ -129,13 +131,14 @@ TEST(UnpackSingleDeviceBinaryAr, WhenMultipleBinariesMatchedThenChooseBestMatch)
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
|
||||
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
|
||||
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
|
||||
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
|
||||
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
|
||||
@@ -144,7 +147,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenMultipleBinariesMatchedThenChooseBestMatch)
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
@@ -237,9 +240,10 @@ TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithProductConfigThenTry
|
||||
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
|
||||
programTokensWrongTokenVersion.headerMutable->Version -= 1;
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
@@ -254,7 +258,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithProductConfigThenTry
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
@@ -344,9 +348,10 @@ TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButIrWithProductConfi
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
|
||||
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
|
||||
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
|
||||
@@ -363,7 +368,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButIrWithProductConfi
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
target.aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
auto arData = encoder.encode();
|
||||
std::string unpackErrors;
|
||||
@@ -567,9 +572,10 @@ TEST(UnpackSingleDeviceBinaryAr, WhenCouldNotFindBinaryWithRightPointerSizeThenU
|
||||
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
|
||||
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig);
|
||||
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
|
||||
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
|
||||
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
|
||||
@@ -585,7 +591,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenCouldNotFindBinaryWithRightPointerSizeThenU
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
target.productConfig = productConfig;
|
||||
target.aotConfig = aotConfig;
|
||||
|
||||
auto arData = encoder.encode();
|
||||
std::string unpackErrors;
|
||||
|
||||
@@ -23,6 +23,7 @@ set(IGDRCL_SRCS_tests_helpers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gtest_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l3_range_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/raii_hw_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/static_size3.h
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using ProductConfigHelperTests = ::testing::Test;
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenProductAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
|
||||
for (const auto &product : AOT::productConfigAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnProductConfigForAcronym(product.first), product.second);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenReleaseAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
|
||||
for (const auto &release : AOT::releaseAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnReleaseForAcronym(release.first), release.second);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenFamilyAcronymWhenHelperSearchForAMatchThenCorrespondingValueIsReturned) {
|
||||
for (const auto &family : AOT::familyAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::returnFamilyForAcronym(family.first), family.second);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenFamilyEnumWhenHelperSearchForAMatchThenCorrespondingAcronymIsReturned) {
|
||||
for (const auto &family : AOT::familyAcronyms) {
|
||||
EXPECT_EQ(ProductConfigHelper::getAcronymForAFamily(family.second), family.first);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenUnknownFamilyEnumWhenHelperSearchForAMatchThenEmptyAcronymIsReturned) {
|
||||
auto acronym = ProductConfigHelper::getAcronymForAFamily(AOT::UNKNOWN_FAMILY);
|
||||
EXPECT_TRUE(acronym.empty());
|
||||
}
|
||||
|
||||
TEST_F(ProductConfigHelperTests, givenUnknownIsaEnumWhenParseMajorMinorRevisionValueThenCorrectStringIsReturned) {
|
||||
auto unknownIsa = ProductConfigHelper::parseMajorMinorRevisionValue(AOT::UNKNOWN_ISA);
|
||||
EXPECT_STREQ(unknownIsa.c_str(), "0.0.0");
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
@@ -47,11 +48,6 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenGetThreadEuRatioForScratchThen8I
|
||||
EXPECT_EQ(8u, hwInfoConfig.getThreadEuRatioForScratch(*defaultHwInfo));
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenGetProductConfigThenCorrectMatchIsFound) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_NE(hwInfoConfig.getProductConfigFromHwInfo(*defaultHwInfo), UNKNOWN_ISA);
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, whenIsGrfNumReportedWithScmIsQueriedThenTrueIsReturned) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_TRUE(hwInfoConfig.isGrfNumReportedWithScm());
|
||||
@@ -88,3 +84,17 @@ HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenIsImplicitScalingSupportedThenE
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
@@ -24,8 +24,12 @@ PVCTEST_F(PvcUnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithPvcProductCo
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
PatchTokensTestData::ValidEmptyProgram programTokensWrongTokenVersion;
|
||||
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(PVC_XL_A0);
|
||||
std::string anotherProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(PVC_XL_A0P);
|
||||
AheadOfTimeConfig aotConfig0{}, aotConfig1{};
|
||||
aotConfig0.ProductConfig = AOT::PVC_XL_A0;
|
||||
aotConfig1.ProductConfig = AOT::PVC_XL_A0P;
|
||||
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig0);
|
||||
std::string anotherProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig1);
|
||||
|
||||
programTokensWrongTokenVersion.headerMutable->Version -= 1;
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
@@ -41,7 +45,7 @@ PVCTEST_F(PvcUnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithPvcProductCo
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = PVC_XL_A0;
|
||||
target.aotConfig = aotConfig0;
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/fixtures/product_config_fixture.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
#include "shared/test/common/xe_hpc_core/pvc/product_configs_pvc.h"
|
||||
#include "shared/test/unit_test/helpers/gtest_helpers.h"
|
||||
#include "shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
|
||||
|
||||
@@ -62,3 +65,12 @@ PVCTEST_F(HwInfoConfigTestLinuxPvc, givenHwInfoConfigWhenAskedIfPatIndexProgramm
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
|
||||
EXPECT_TRUE(hwInfoConfig.isVmBindPatIndexProgrammingSupported());
|
||||
}
|
||||
|
||||
PVCTEST_F(ProductConfigTests, givenAotConfigWhenSetHwInfoRevisionIdForPvcThenCorrectValueIsSet) {
|
||||
for (const auto &config : AOT_PVC::productConfigs) {
|
||||
AheadOfTimeConfig aotConfig = {0};
|
||||
aotConfig.ProductConfig = config;
|
||||
CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig);
|
||||
EXPECT_EQ(hwInfo.platform.usRevId, aotConfig.ProductConfigID.Revision);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@ PVCTEST_F(ProductConfigTests, givenPvcXlDeviceIdWhenDifferentRevisionIsPassedThe
|
||||
|
||||
hwInfo.platform.usRevId = 0x0;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XL_A0);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XL_A0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x1;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XL_A0P);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XL_A0P);
|
||||
|
||||
hwInfo.platform.usRevId = 0x6;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XL_A0P);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XL_A0P);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,19 +39,19 @@ PVCTEST_F(ProductConfigTests, givenPvcXtDeviceIdWhenDifferentRevisionIsPassedThe
|
||||
|
||||
hwInfo.platform.usRevId = 0x3;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XT_A0);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XT_A0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x5;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XT_B0);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XT_B0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x6;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XT_B1);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XT_B1);
|
||||
|
||||
hwInfo.platform.usRevId = 0x7;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XT_C0);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XT_C0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,15 +60,15 @@ PVCTEST_F(ProductConfigTests, givenDefaultDeviceAndRevisionIdWhenGetProductConfi
|
||||
hwInfo.platform.usDeviceID = 0x0;
|
||||
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, PVC_XT_C0);
|
||||
EXPECT_EQ(productConfig, AOT::PVC_XT_C0);
|
||||
}
|
||||
|
||||
PVCTEST_F(ProductConfigTests, givenInvalidRevisionIdWhenGetProductConfigThenUnknownIsaIsReturned) {
|
||||
hwInfo.platform.usRevId = 0x2;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, UNKNOWN_ISA);
|
||||
EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA);
|
||||
|
||||
hwInfo.platform.usRevId = 0x4;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, UNKNOWN_ISA);
|
||||
}
|
||||
EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,12 @@ DG2TEST_F(Dg2UnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithDg2ProductCo
|
||||
PatchTokensTestData::ValidEmptyProgram programTokens;
|
||||
PatchTokensTestData::ValidEmptyProgram programTokensWrongTokenVersion;
|
||||
|
||||
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(DG2_G10_A0);
|
||||
std::string anotherProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(DG2_G10_B0);
|
||||
AheadOfTimeConfig aotConfig0{}, aotConfig1{};
|
||||
aotConfig0.ProductConfig = AOT::DG2_G10_A0;
|
||||
aotConfig1.ProductConfig = AOT::DG2_G10_B0;
|
||||
|
||||
std::string requiredProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig0);
|
||||
std::string anotherProductConfig = ProductConfigHelper::parseMajorMinorRevisionValue(aotConfig1);
|
||||
|
||||
programTokensWrongTokenVersion.headerMutable->Version -= 1;
|
||||
NEO::Ar::ArEncoder encoder;
|
||||
@@ -41,7 +45,7 @@ DG2TEST_F(Dg2UnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithDg2ProductCo
|
||||
|
||||
NEO::TargetDevice target;
|
||||
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||
target.productConfig = DG2_G10_A0;
|
||||
target.aotConfig = aotConfig0;
|
||||
target.stepping = programTokens.header->SteppingId;
|
||||
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#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"
|
||||
@@ -13,6 +14,7 @@
|
||||
#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/test.h"
|
||||
#include "shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -409,10 +411,10 @@ DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdsWhenConfigIsCheckedThenCorrect
|
||||
|
||||
DG2TEST_F(ProductConfigTests, givenInvalidRevisionIdWhenDeviceIdIsDefaultThenUnknownIsaIsReturned) {
|
||||
hwInfo.platform.usDeviceID = 0;
|
||||
hwInfo.platform.usRevId = 0xffff;
|
||||
hwInfo.platform.usRevId = CommonConstants::invalidRevisionID;
|
||||
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, UNKNOWN_ISA);
|
||||
EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA);
|
||||
}
|
||||
|
||||
DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
|
||||
@@ -421,19 +423,30 @@ DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedTh
|
||||
|
||||
hwInfo.platform.usRevId = 0x0;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G10_A0);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G10_A0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x1;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G10_A0);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G10_A1);
|
||||
|
||||
hwInfo.platform.usRevId = 0x4;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G10_B0);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G10_B0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x8;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G10_B0);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G10_C0);
|
||||
}
|
||||
}
|
||||
|
||||
DG2TEST_F(ProductConfigTests, givenDg2DeviceIdWhenIncorrectRevisionIsPassedThenCorrectProductConfigIsReturned) {
|
||||
for (const auto &dg2 : {DG2_G10_IDS, DG2_G11_IDS}) {
|
||||
for (const auto &deviceId : dg2) {
|
||||
hwInfo.platform.usDeviceID = deviceId;
|
||||
hwInfo.platform.usRevId = CommonConstants::invalidRevisionID;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,11 +456,24 @@ DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedTh
|
||||
|
||||
hwInfo.platform.usRevId = 0x0;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G11);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G11_A0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x4;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G11);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G11_B0);
|
||||
|
||||
hwInfo.platform.usRevId = 0x5;
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G11_B1);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
DG2TEST_F(ProductConfigTests, givenDefaultDeviceAndRevisionIdWhenGetProductConfigThenLastKnownDg2ConfigIsReturned) {
|
||||
DG2TEST_F(ProductConfigTests, givenDefaultDeviceAndRevisionIdWhenGetProductConfigThenDg2G11A0ConfigIsReturned) {
|
||||
hwInfo.platform.usRevId = 0x0;
|
||||
hwInfo.platform.usDeviceID = 0x0;
|
||||
|
||||
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
|
||||
EXPECT_EQ(productConfig, DG2_G11);
|
||||
EXPECT_EQ(productConfig, AOT::DG2_G11_A0);
|
||||
}
|
||||
127
third_party/aot_config_headers/platforms.h
vendored
Normal file
127
third_party/aot_config_headers/platforms.h
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AOT {
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN_ISA = 0,
|
||||
BDW = 0x02000000,
|
||||
SKL = 0x02400009,
|
||||
KBL = 0x02404009,
|
||||
CFL = 0x02408009,
|
||||
APL = 0x0240c000,
|
||||
GLK = 0x02410000,
|
||||
WHL = 0x02414000,
|
||||
AML = 0x02418000,
|
||||
CML = 0x0241c000,
|
||||
ICL = 0x02c00000,
|
||||
LKF = 0x02c04000,
|
||||
EHL = 0x02c08000,
|
||||
TGL = 0x03000000,
|
||||
RKL = 0x03004000,
|
||||
RPL_S = 0x03008000,
|
||||
ADL_S = 0x03008000,
|
||||
ADL_P = 0x0300c000,
|
||||
ADL_N = 0x03010000,
|
||||
DG1 = 0x03028000,
|
||||
XEHP_SDV = 0x030c8004,
|
||||
DG2_G10_A0 = 0x030dc000,
|
||||
DG2_G10_A1 = 0x030dc001,
|
||||
DG2_G10_B0 = 0x030dc004,
|
||||
DG2_G10_C0 = 0x030dc008,
|
||||
DG2_G11_A0 = 0x030e0000,
|
||||
DG2_G11_B0 = 0x030e0004,
|
||||
DG2_G11_B1 = 0x030e0005,
|
||||
DG2_G12_A0 = 0x030e4000,
|
||||
PVC_XL_A0 = 0x030f0000,
|
||||
PVC_XL_A0P = 0x030f0001,
|
||||
PVC_XT_A0 = 0x030f0003,
|
||||
PVC_XT_B0 = 0x030f0005,
|
||||
PVC_XT_B1 = 0x030f0006,
|
||||
PVC_XT_C0 = 0x030f0007,
|
||||
CONFIG_MAX_PLATFORM,
|
||||
} PRODUCT_CONFIG;
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN_RELEASE = 0,
|
||||
GEN8_RELEASE,
|
||||
GEN9_RELEASE,
|
||||
GEN11_RELEASE,
|
||||
GEN12LP_RELEASE,
|
||||
XE_HP_RELEASE,
|
||||
XE_HPG_RELEASE,
|
||||
XE_HPC_RELEASE,
|
||||
RELEASE_MAX,
|
||||
} RELEASE;
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN_FAMILY = 0,
|
||||
GEN8_FAMILY,
|
||||
GEN9_FAMILY,
|
||||
GEN11_FAMILY,
|
||||
GEN12LP_FAMILY,
|
||||
XE_FAMILY,
|
||||
FAMILY_MAX,
|
||||
} FAMILY;
|
||||
|
||||
static const std::map<std::string, FAMILY> familyAcronyms = {
|
||||
{"gen8", GEN8_FAMILY},
|
||||
{"gen9", GEN9_FAMILY},
|
||||
{"gen11", GEN11_FAMILY},
|
||||
{"gen12lp", GEN12LP_FAMILY},
|
||||
{"xe", XE_FAMILY},
|
||||
};
|
||||
|
||||
static const std::map<std::string, RELEASE> releaseAcronyms = {
|
||||
{"gen8", GEN8_RELEASE},
|
||||
{"gen9", GEN9_RELEASE},
|
||||
{"gen11", GEN11_RELEASE},
|
||||
{"gen12lp", GEN12LP_RELEASE},
|
||||
{"xe-hp", XE_HP_RELEASE},
|
||||
{"xe-hpg", XE_HPG_RELEASE},
|
||||
{"xe-hpc", XE_HPC_RELEASE},
|
||||
};
|
||||
|
||||
static const std::map<std::string, AOT::PRODUCT_CONFIG> productConfigAcronyms = {
|
||||
{"bdw", BDW},
|
||||
{"skl", SKL},
|
||||
{"kbl", KBL},
|
||||
{"cfl", CFL},
|
||||
{"apl", APL},
|
||||
{"bxt", APL},
|
||||
{"glk", GLK},
|
||||
{"whl", WHL},
|
||||
{"aml", AML},
|
||||
{"cml", CML},
|
||||
{"icllp", ICL},
|
||||
{"lkf", LKF},
|
||||
{"ehl", EHL},
|
||||
{"jsl", EHL},
|
||||
{"tgllp", TGL},
|
||||
{"rkl", RKL},
|
||||
{"rpl-s", RPL_S},
|
||||
{"adl-s", ADL_S},
|
||||
{"adl-p", ADL_P},
|
||||
{"adl-n", ADL_N},
|
||||
{"dg1", DG1},
|
||||
{"acm-g10", DG2_G10_C0},
|
||||
{"dg2-g10", DG2_G10_C0},
|
||||
{"ats-m150", DG2_G10_C0},
|
||||
{"acm-g11", DG2_G11_B1},
|
||||
{"dg2-g11", DG2_G11_B1},
|
||||
{"ats-m75", DG2_G11_B1},
|
||||
{"acm-g12", DG2_G12_A0},
|
||||
{"dg2-g12", DG2_G12_A0},
|
||||
{"pvc-sdv", PVC_XL_A0P},
|
||||
{"pvc", PVC_XT_C0},
|
||||
};
|
||||
} // namespace AOT
|
||||
Reference in New Issue
Block a user