Encode PRODUCT_CONFIG value into fatbinary

Change modifies the encoding entry in fatbinary for platforms.
If numbering in -device is used, the value PRODUCT_CONFIG will be encoded.
The functionality that returns the correct product config values has
also been added.

Related-To: NEO-6744
Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:
Daria Hinz
2022-03-10 17:27:38 +00:00
committed by Compute-Runtime-Automation
parent fbb5137f3e
commit ce645f13b7
87 changed files with 980 additions and 180 deletions

View File

@@ -737,13 +737,25 @@ if(MSVC)
include_directories(${NEO_SOURCE_DIR}/opencl/source/sharings/gl/windows/include)
endif()
macro(macro_for_each_platform)
string(TOLOWER ${PLATFORM_IT} PLATFORM_IT_LOWER)
foreach(PLATFORM_DIRECTORY ${NEO_SHARED_DIRECTORY}/${CORE_TYPE_LOWER}/${PLATFORM_IT_LOWER}/definitions${BRANCH_DIR_SUFFIX})
if(EXISTS ${PLATFORM_DIRECTORY})
include_directories(${PLATFORM_DIRECTORY})
endif()
endforeach()
endmacro()
macro(macro_for_each_core_type)
foreach(PLATFORM_DIRECTORY ${NEO_SHARED_DIRECTORY}/${CORE_TYPE_LOWER}/definitions${BRANCH_DIR_SUFFIX} ${NEO_SOURCE_DIR}/opencl/source/${CORE_TYPE_LOWER}/definitions${BRANCH_DIR_SUFFIX})
if(EXISTS ${PLATFORM_DIRECTORY})
include_directories(${PLATFORM_DIRECTORY})
endif()
endforeach()
apply_macro_for_each_platform()
endmacro()
apply_macro_for_each_core_type("SUPPORTED")
# Define where to put binaries

View File

@@ -14,6 +14,7 @@
#include "shared/source/device_binary_format/elf/elf_decoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/product_config_helper.h"
#include "environment.h"
#include "mock/mock_argument_helper.h"
@@ -41,8 +42,8 @@ std::string prepareTwoDevices(MockOclocArgHelper *argHelper) {
return {};
}
const auto cfg1 = argHelper->parseProductConfigFromValue(allEnabledDeviceConfigs[0].config);
const auto cfg2 = argHelper->parseProductConfigFromValue(allEnabledDeviceConfigs[1].config);
const auto cfg1 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[0].config);
const auto cfg2 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[1].config);
return cfg1 + "," + cfg2;
}
@@ -106,7 +107,7 @@ TEST(OclocFatBinaryRequestedFatBinary, GivenDeviceArgToFatBinaryWhenConfigMatche
std::unique_ptr<OclocArgHelper> argHelper = std::make_unique<OclocArgHelper>();
auto allEnabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
std::string configNum0 = argHelper->parseProductConfigFromValue(allEnabledDeviceConfigs[allEnabledDeviceConfigs.size() / 2].config);
std::string configNum0 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[allEnabledDeviceConfigs.size() / 2].config);
auto major_pos = configNum0.find(".");
auto cutMinorAndRevision = configNum0.substr(0, major_pos);
auto matchedConfigs = getAllMatchedConfigs(cutMinorAndRevision, argHelper.get());
@@ -124,7 +125,7 @@ TEST(OclocFatBinaryRequestedFatBinary, GivenDeviceArgAsSingleProductConfigThenFa
auto allEnabledDeviceConfigs = argHelper->getAllSupportedDeviceConfigs();
for (auto &deviceConfig : allEnabledDeviceConfigs) {
std::string configStr = argHelper->parseProductConfigFromValue(deviceConfig.config);
std::string configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceConfig.config);
const char *singleConfig[] = {"ocloc", "-device", configStr.c_str()};
EXPECT_FALSE(NEO::requestedFatBinary(3, singleConfig, argHelper.get()));
}
@@ -156,9 +157,9 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenDifferentDeviceArgWhenCh
ConstStringRef platformName1(hardwarePrefix[platform1], strlen(hardwarePrefix[platform1]));
auto deviceMapConfig0 = allEnabledDeviceConfigs[0];
auto configNumConvention0 = oclocArgHelperWithoutInput->parseProductConfigFromValue(deviceMapConfig0.config);
auto configNumConvention0 = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig0.config);
auto deviceMapConfig1 = allEnabledDeviceConfigs[1];
auto configNumConvention1 = oclocArgHelperWithoutInput->parseProductConfigFromValue(deviceMapConfig1.config);
auto configNumConvention1 = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig1.config);
auto twoPlatforms = platformName0.str() + "," + platformName1.str();
auto configsRange = configNumConvention0 + "-" + configNumConvention1;
@@ -217,7 +218,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigClosedRange
}
auto deviceMapConfig0 = allEnabledDeviceConfigs[0];
auto config0Str = oclocArgHelperWithoutInput->parseProductConfigFromValue(deviceMapConfig0.config);
auto config0Str = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig0.config);
auto got = NEO::getTargetConfigsForFatbinary("1.2-" + config0Str, oclocArgHelperWithoutInput.get());
EXPECT_TRUE(got.empty());
@@ -578,9 +579,9 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenClosedRangeTooExtensiveW
if (allEnabledDeviceConfigs.size() < 4) {
GTEST_SKIP();
}
std::string configNum0 = argHelper->parseProductConfigFromValue(allEnabledDeviceConfigs[0].config);
std::string configNum1 = argHelper->parseProductConfigFromValue(allEnabledDeviceConfigs[1].config);
std::string configNum2 = argHelper->parseProductConfigFromValue(allEnabledDeviceConfigs[2].config);
std::string configNum0 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[0].config);
std::string configNum1 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[1].config);
std::string configNum2 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[2].config);
std::stringstream configString;
configString << configNum0 << "-" << configNum1 << "-" << configNum2;
@@ -871,8 +872,8 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenTwoConfigsWhenFatBinaryB
auto config0 = allEnabledDeviceConfigs[0];
auto config1 = allEnabledDeviceConfigs[1];
auto configStr0 = argHelper->parseProductConfigFromValue(config0.config);
auto configStr1 = argHelper->parseProductConfigFromValue(config1.config);
auto configStr0 = ProductConfigHelper::parseMajorMinorRevisionValue(config0.config);
auto configStr1 = ProductConfigHelper::parseMajorMinorRevisionValue(config1.config);
std::vector<std::string> targets{configStr0, configStr1};
std::vector<DeviceMapping> expected;
@@ -910,7 +911,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenTwoConfigsWhenFatBinaryB
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
for (auto deviceConfig : expected) {
auto targetConfig = argHelper->parseProductConfigFromValue(deviceConfig.config);
auto targetConfig = ProductConfigHelper::parseMajorMinorRevisionValue(deviceConfig.config);
resString << "Build succeeded for : " << targetConfig + ".\n";
}
@@ -924,7 +925,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigOpenRangeFr
GTEST_SKIP();
}
auto deviceMapConfig = allEnabledDeviceConfigs[allEnabledDeviceConfigs.size() / 2];
auto configNumConvention = argHelper->parseProductConfigFromValue(deviceMapConfig.config);
auto configNumConvention = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
std::vector<DeviceMapping> expected;
auto configFrom = std::find_if(allEnabledDeviceConfigs.begin(),
@@ -955,7 +956,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigOpenRangeFr
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
for (auto deviceConfig : expected) {
auto targetConfig = argHelper->parseProductConfigFromValue(deviceConfig.config);
auto targetConfig = ProductConfigHelper::parseMajorMinorRevisionValue(deviceConfig.config);
resString << "Build succeeded for : " << targetConfig + ".\n";
}
@@ -970,7 +971,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigOpenRangeTo
}
auto deviceMapConfig = allEnabledDeviceConfigs[allEnabledDeviceConfigs.size() / 2];
auto configNumConvention = argHelper->parseProductConfigFromValue(deviceMapConfig.config);
auto configNumConvention = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
std::vector<DeviceMapping> expected;
for (auto &deviceConfig : allEnabledDeviceConfigs) {
@@ -1000,7 +1001,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigOpenRangeTo
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
for (auto deviceConfig : expected) {
auto targetConfig = argHelper->parseProductConfigFromValue(deviceConfig.config);
auto targetConfig = ProductConfigHelper::parseMajorMinorRevisionValue(deviceConfig.config);
resString << "Build succeeded for : " << targetConfig + ".\n";
}
@@ -1016,8 +1017,8 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigClosedRange
auto deviceMapConfigFrom = allEnabledDeviceConfigs[1];
auto deviceMapConfigTo = allEnabledDeviceConfigs[allEnabledDeviceConfigs.size() - 2];
auto configFromNumConvention = argHelper->parseProductConfigFromValue(deviceMapConfigFrom.config);
auto configToNumConvention = argHelper->parseProductConfigFromValue(deviceMapConfigTo.config);
auto configFromNumConvention = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfigFrom.config);
auto configToNumConvention = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfigTo.config);
std::vector<DeviceMapping> expected;
@@ -1053,7 +1054,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigClosedRange
EXPECT_EQ(retVal, NEO::OclocErrorCode::SUCCESS);
for (auto deviceConfig : expected) {
auto targetConfig = argHelper->parseProductConfigFromValue(deviceConfig.config);
auto targetConfig = ProductConfigHelper::parseMajorMinorRevisionValue(deviceConfig.config);
resString << "Build succeeded for : " << targetConfig + ".\n";
}
@@ -1066,7 +1067,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenArgsWhenCorrectDeviceNum
GTEST_SKIP();
}
std::string configNum0 = oclocArgHelperWithoutInput->parseProductConfigFromValue(allEnabledDeviceConfigs[0].config);
std::string configNum0 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[0].config);
auto major_pos = configNum0.find(".");
auto minor_pos = configNum0.find(".", ++major_pos);
auto cutRevision = configNum0.substr(0, minor_pos);
@@ -1081,7 +1082,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenArgsWhenCorrectDeviceNum
GTEST_SKIP();
}
std::string configNum0 = oclocArgHelperWithoutInput->parseProductConfigFromValue(allEnabledDeviceConfigs[0].config);
std::string configNum0 = ProductConfigHelper::parseMajorMinorRevisionValue(allEnabledDeviceConfigs[0].config);
auto major_pos = configNum0.find(".");
auto cutMinorAndRevision = configNum0.substr(0, major_pos);

View File

@@ -7,6 +7,8 @@
#include "opencl/test/unit_test/offline_compiler/ocloc_product_config_tests.h"
#include "shared/source/helpers/product_config_helper.h"
namespace NEO {
TEST_P(OclocProductConfigTests, GivenProductConfigValuesWhenInitHardwareInfoThenCorrectValuesAreSet) {
auto deviceId = 0u;
@@ -23,7 +25,7 @@ TEST_P(OclocProductConfigTests, GivenProductConfigValuesWhenInitHardwareInfoThen
}
}
mockOfflineCompiler->deviceName = mockOfflineCompiler->argHelper->parseProductConfigFromValue(productConfig);
mockOfflineCompiler->deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
mockOfflineCompiler->initHardwareInfo(mockOfflineCompiler->deviceName);
EXPECT_EQ(mockOfflineCompiler->hwInfo.platform.eProductFamily, productFamily);

View File

@@ -15,6 +15,7 @@
#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/product_config_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_compilers.h"
@@ -193,7 +194,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
std::string configStr;
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
configStr = oclocArgHelperWithoutInput->parseProductConfigFromValue(deviceMapConfig.config);
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
break;
}
}
@@ -529,7 +530,7 @@ TEST(MockOfflineCompilerTests, givenProductConfigValueWhenInitHwInfoThenResetGtS
auto expectedRevId = 0u;
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
mockOfflineCompiler.deviceName = mockOfflineCompiler.argHelper->parseProductConfigFromValue(deviceMapConfig.config);
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
expectedRevId = deviceMapConfig.revId;
}
}
@@ -872,7 +873,7 @@ TEST_F(OfflineCompilerTests, givenInitHardwareInfowhenDeviceConfigContainsDevice
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
mockOfflineCompiler.deviceName = mockOfflineCompiler.argHelper->parseProductConfigFromValue(deviceMapConfig.config);
mockOfflineCompiler.deviceName = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
deviceMapConfig.deviceIds = &deviceIdsForTests;
break;
}
@@ -1265,7 +1266,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
std::string configStr;
for (auto &deviceMapConfig : allEnabledDeviceConfigs) {
if (productFamily == deviceMapConfig.hwInfo->platform.eProductFamily) {
configStr = oclocArgHelperWithoutInput->parseProductConfigFromValue(deviceMapConfig.config);
configStr = ProductConfigHelper::parseMajorMinorRevisionValue(deviceMapConfig.config);
break;
}
}

View File

@@ -246,16 +246,6 @@ std::vector<DeviceMapping> &OclocArgHelper::getAllSupportedDeviceConfigs() {
return deviceMap;
}
const std::string OclocArgHelper::parseProductConfigFromValue(PRODUCT_CONFIG config) {
auto configValue = static_cast<uint32_t>(config);
std::stringstream stringConfig;
uint32_t major = (configValue & 0xff0000) >> 16;
uint32_t minor = (configValue & 0x00ff00) >> 8;
uint32_t revision = configValue & 0x0000ff;
stringConfig << major << "." << minor << "." << revision;
return stringConfig.str();
}
std::vector<PRODUCT_CONFIG> OclocArgHelper::getAllSupportedProductConfigs() {
std::vector<PRODUCT_CONFIG> allConfigs;
for (auto &deviceConfig : deviceMap) {

View File

@@ -105,7 +105,6 @@ class OclocArgHelper {
};
MOCKABLE_VIRTUAL bool fileExists(const std::string &filename) const;
int parseProductConfigFromString(const std::string &device, size_t begin, size_t end);
const std::string parseProductConfigFromValue(PRODUCT_CONFIG config);
bool getHwInfoForProductConfig(uint32_t config, NEO::HardwareInfo &hwInfo);
void getProductConfigsForGfxCoreFamily(GFXCORE_FAMILY core, std::vector<DeviceMapping> &out);
void setDeviceInfoForFatbinaryTarget(const DeviceMapping &device);

View File

@@ -14,6 +14,7 @@
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "igfxfmid.h"
@@ -311,8 +312,6 @@ std::vector<DeviceMapping> getTargetConfigsForFatbinary(ConstStringRef deviceArg
int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy, std::string pointerSize, Ar::ArEncoder &fatbinary,
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &deviceConfig) {
std::string product = hardwarePrefix[pCompiler->getHardwareInfo().platform.eProductFamily];
auto stepping = pCompiler->getHardwareInfo().platform.usRevId;
if (retVal == 0) {
retVal = buildWithSafetyGuard(pCompiler);
@@ -334,7 +333,7 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
if (retVal) {
return retVal;
}
fatbinary.appendFileEntry(pointerSize + "." + product + "." + std::to_string(stepping), pCompiler->getPackedDeviceBinaryOutput());
fatbinary.appendFileEntry(pointerSize + "." + deviceConfig, pCompiler->getPackedDeviceBinaryOutput());
return retVal;
}
@@ -426,7 +425,7 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
return retVal;
}
auto targetConfigStr = argHelper->parseProductConfigFromValue(targetConfig.config);
auto targetConfigStr = ProductConfigHelper::parseMajorMinorRevisionValue(targetConfig.config);
retVal = buildFatBinaryForTarget(retVal, argsCopy, pointerSizeInBits, fatbinary, pCompiler.get(), argHelper, targetConfigStr);
if (retVal) {
return retVal;

View File

@@ -21,6 +21,7 @@
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/helpers/string.h"
#include "shared/source/helpers/validators.h"
#include "shared/source/os_interface/os_inc_base.h"
@@ -881,16 +882,11 @@ std::string OfflineCompiler::getDevicesConfigs() {
std::list<std::string> configNum;
auto allSupportedConfigs = argHelper->getAllSupportedProductConfigs();
for (auto &config : allSupportedConfigs) {
auto numeration = argHelper->parseProductConfigFromValue(config);
configNum.push_back(numeration);
}
std::ostringstream os;
for (auto it = configNum.begin(); it != configNum.end(); it++) {
if (it != configNum.begin())
for (auto it = allSupportedConfigs.begin(); it != allSupportedConfigs.end(); it++) {
if (it != allSupportedConfigs.begin())
os << ", ";
os << *it;
os << ProductConfigHelper::parseMajorMinorRevisionValue(*it);
}
return os.str();

View File

@@ -10,6 +10,14 @@
#include "shared/source/device_binary_format/device_binary_formats.h"
namespace NEO {
void searchForBinary(Ar::Ar &archiveData, const ConstStringRef filter, Ar::ArFileEntryHeaderAndData *&matched) {
for (auto &file : archiveData.files) {
if (file.fileName.startsWith(filter.str().c_str())) {
matched = &file;
return;
}
}
}
template <>
bool isDeviceBinaryFormat<NEO::DeviceBinaryFormat::Archive>(const ArrayRef<const uint8_t> binary) {
@@ -25,29 +33,24 @@ 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 filterPointerSizeAndPlatform = pointerSize + "." + requestedProductAbbreviation.str();
std::string filterPointerSizeAndPlatformAndStepping = filterPointerSizeAndPlatform + "." + std::to_string(requestedTargetDevice.stepping);
ConstStringRef genericIrFileName{"generic_ir"};
ConstStringRef filterGenericIrFileName{"generic_ir"};
Ar::ArFileEntryHeaderAndData *matchedFiles[3] = {};
Ar::ArFileEntryHeaderAndData *&matchedPointerSizeAndPlatformAndStepping = matchedFiles[0]; // best match
Ar::ArFileEntryHeaderAndData *&matchedPointerSizeAndPlatform = matchedFiles[1];
Ar::ArFileEntryHeaderAndData *&matchedGenericIr = matchedFiles[2];
Ar::ArFileEntryHeaderAndData *matchedFiles[5] = {};
Ar::ArFileEntryHeaderAndData *&matchedPointerSizeAndMajorMinorRevision = matchedFiles[0];
Ar::ArFileEntryHeaderAndData *&matchedPointerSizeAndPlatformAndStepping = matchedFiles[1];
Ar::ArFileEntryHeaderAndData *&matchedPointerSizeAndMajorMinor = matchedFiles[2];
Ar::ArFileEntryHeaderAndData *&matchedPointerSizeAndPlatform = matchedFiles[3];
Ar::ArFileEntryHeaderAndData *&matchedGenericIr = matchedFiles[4];
for (auto &file : archiveData.files) {
const auto &filename = file.fileName;
constexpr std::string::size_type zeroIndex{0};
if (filename.size() >= filterPointerSizeAndPlatformAndStepping.size() &&
filename.substr(zeroIndex, filterPointerSizeAndPlatformAndStepping.size()) == filterPointerSizeAndPlatformAndStepping) {
matchedPointerSizeAndPlatformAndStepping = &file;
} else if (filename.size() >= filterPointerSizeAndPlatform.size() &&
filename.substr(zeroIndex, filterPointerSizeAndPlatform.size()) == filterPointerSizeAndPlatform) {
matchedPointerSizeAndPlatform = &file;
} else if (file.fileName == genericIrFileName) {
matchedGenericIr = &file;
}
}
searchForBinary(archiveData, ConstStringRef(filterPointerSizeAndMajorMinorRevision), matchedPointerSizeAndMajorMinorRevision);
searchForBinary(archiveData, ConstStringRef(filterPointerSizeAndPlatformAndStepping), matchedPointerSizeAndPlatformAndStepping);
searchForBinary(archiveData, ConstStringRef(filterPointerSizeAndMajorMinor), matchedPointerSizeAndMajorMinor);
searchForBinary(archiveData, ConstStringRef(filterPointerSizeAndPlatform), matchedPointerSizeAndPlatform);
searchForBinary(archiveData, filterGenericIrFileName, matchedGenericIr);
std::string unpackErrors;
std::string unpackWarnings;
@@ -58,10 +61,9 @@ SingleDeviceBinary unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(co
}
auto unpacked = unpackSingleDeviceBinary(matchedFile->fileData, requestedProductAbbreviation, requestedTargetDevice, unpackErrors, unpackWarnings);
if (false == unpacked.deviceBinary.empty()) {
if (matchedFile != matchedPointerSizeAndPlatformAndStepping) {
outWarning = "Couldn't find perfectly matched binary (right stepping) in AR, using best usable";
if ((matchedFile != matchedPointerSizeAndPlatformAndStepping) && (matchedFile != matchedPointerSizeAndMajorMinorRevision)) {
outWarning = "Couldn't find perfectly matched binary in AR, using best usable";
}
if (unpacked.intermediateRepresentation.empty() && matchedGenericIr) {
auto unpackedGenericIr = unpackSingleDeviceBinary(matchedGenericIr->fileData, requestedProductAbbreviation, requestedTargetDevice, unpackErrors, unpackWarnings);
if (!unpackedGenericIr.intermediateRepresentation.empty()) {

View File

@@ -8,6 +8,7 @@
#include "shared/source/device_binary_format/device_binary_formats.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/hw_info_config.h"
namespace NEO {
@@ -20,8 +21,11 @@ std::vector<uint8_t> packDeviceBinary(const SingleDeviceBinary binary, std::stri
TargetDevice targetDeviceFromHwInfo(const HardwareInfo &hwInfo) {
TargetDevice targetDevice = {};
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
targetDevice.coreFamily = hwInfo.platform.eRenderCoreFamily;
targetDevice.productFamily = hwInfo.platform.eProductFamily;
targetDevice.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
targetDevice.stepping = hwInfo.platform.usRevId;
targetDevice.maxPointerSizeInBytes = sizeof(uintptr_t);
targetDevice.grfSize = hwInfo.capabilityTable.grfSize;

View File

@@ -7,9 +7,12 @@
#pragma once
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/const_stringref.h"
#include "platforms.h"
#include <cstddef>
#include <cstdint>
#include <igfxfmid.h>
@@ -57,6 +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;
uint32_t stepping = 0U;
uint32_t maxPointerSizeInBytes = 4U;
uint32_t grfSize = 32U;

View File

@@ -1,10 +1,12 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
typedef enum {
UNKNOWN_ISA = 0,
BDW = 0x080000,

View File

@@ -49,33 +49,34 @@ macro(macro_for_each_platform)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_CPP_BASE ${SRC_FILE})
endif()
foreach(BRANCH ${BRANCH_DIR_LIST})
set(PATH_TO_CORE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH})
set(PLATFORM_FILE "hw_cmds_${PLATFORM_IT_LOWER}.h")
set(PATH_TO_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}${PLATFORM_FILE})
if(EXISTS ${PATH_TO_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${PATH_TO_FILE})
set(SRC_FILE ${PATH_TO_CORE}hw_cmds_${PLATFORM_IT_LOWER}.h)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}linux/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
set(SRC_FILE ${PATH_TO_CORE}linux/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_CPP_LINUX ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}windows/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
set(SRC_FILE ${PATH_TO_CORE}windows/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_CPP_WINDOWS ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}linux/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
set(SRC_FILE ${PATH_TO_CORE}linux/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_CPP_LINUX ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}windows/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
set(SRC_FILE ${PATH_TO_CORE}windows/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_CPP_WINDOWS ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}enable_hw_info_config_${PLATFORM_IT_LOWER}.cpp)
set(SRC_FILE ${PATH_TO_CORE}enable_hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND ${CORE_TYPE}_SRC_LINK_BASE ${SRC_FILE})
endif()
@@ -93,13 +94,22 @@ macro(macro_for_each_platform)
list(APPEND ${CORE_TYPE}_SRC_LINK_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}os_agnostic_hw_info_config_${PLATFORM_IT_LOWER}.inl)
set(SRC_FILE ${PATH_TO_CORE}${PLATFORM_IT_LOWER}/os_agnostic_hw_info_config_${PLATFORM_IT_LOWER}.inl)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(PLATFORM_FILE "hw_info_${PLATFORM_IT_LOWER}.cpp")
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}${PLATFORM_FILE})
set(SRC_FILE ${PATH_TO_CORE}${PLATFORM_IT_LOWER}/definitions${BRANCH_DIR_SUFFIX}os_agnostic_hw_info_config_${PLATFORM_IT_LOWER}_extra.inl)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${PATH_TO_CORE}${PLATFORM_IT_LOWER}/definitions${BRANCH_DIR_SUFFIX}device_ids_configs_${PLATFORM_IT_LOWER}.h)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_H_BASE ${SRC_FILE})
endif()
set(SRC_FILE ${PATH_TO_CORE}hw_info_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${CORE_TYPE}_CPP_BASE ${SRC_FILE})
endif()

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::EHL;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,3 +19,8 @@ template <>
bool HwInfoConfigHw<gfxProduct>::isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const {
return true;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::ICL;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,9 +11,12 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ELKHARTLAKE;
#include "shared/source/gen11/ehl/os_agnostic_hw_info_config_ehl.inl"
template <>
int HwInfoConfigHw<IGFX_ELKHARTLAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -24,5 +27,5 @@ int HwInfoConfigHw<IGFX_ELKHARTLAKE>::configureHardwareCustom(HardwareInfo *hwIn
return 0;
}
template class HwInfoConfigHw<IGFX_ELKHARTLAKE>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,7 +13,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_ICELAKE_LP;
#include "shared/source/gen11/os_agnostic_hw_info_config_icllp.inl"
#include "shared/source/gen11/icllp/os_agnostic_hw_info_config_icllp.inl"
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,9 +11,12 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_LAKEFIELD;
#include "shared/source/gen11/lkf/os_agnostic_hw_info_config_lkf.inl"
template <>
int HwInfoConfigHw<IGFX_LAKEFIELD>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -25,5 +28,5 @@ int HwInfoConfigHw<IGFX_LAKEFIELD>::configureHardwareCustom(HardwareInfo *hwInfo
return 0;
}
template class HwInfoConfigHw<IGFX_LAKEFIELD>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::LKF;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,10 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ELKHARTLAKE;
template class HwInfoConfigHw<IGFX_ELKHARTLAKE>;
#include "shared/source/gen11/ehl/os_agnostic_hw_info_config_ehl.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,7 +12,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_ICELAKE_LP;
#include "shared/source/gen11/os_agnostic_hw_info_config_icllp.inl"
#include "shared/source/gen11/icllp/os_agnostic_hw_info_config_icllp.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,9 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_LAKEFIELD;
template class HwInfoConfigHw<IGFX_LAKEFIELD>;
#include "shared/source/gen11/lkf/os_agnostic_hw_info_config_lkf.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,6 +16,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::ADL_P;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,6 +16,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::ADL_S;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {

View File

@@ -16,6 +16,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::DG1;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {

View File

@@ -15,7 +15,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_P;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_adlp.inl"
#include "shared/source/gen12lp/adlp/os_agnostic_hw_info_config_adlp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template <>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,7 +13,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_S;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_adls.inl"
#include "shared/source/gen12lp/adls/os_agnostic_hw_info_config_adls.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template class HwInfoConfigHw<gfxProduct>;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,7 +13,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG1;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_dg1.inl"
#include "shared/source/gen12lp/dg1/os_agnostic_hw_info_config_dg1.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template <>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,7 @@ namespace NEO {
constexpr static auto gfxProduct = IGFX_ROCKETLAKE;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_rkl.inl"
#include "shared/source/gen12lp/rkl/os_agnostic_hw_info_config_rkl.inl"
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,7 @@ namespace NEO {
constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_tgllp.inl"
#include "shared/source/gen12lp/tgllp/os_agnostic_hw_info_config_tgllp.inl"
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,6 +18,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::RKL;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,6 +18,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::TGL;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {

View File

@@ -15,7 +15,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_P;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_adlp.inl"
#include "shared/source/gen12lp/adlp/os_agnostic_hw_info_config_adlp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template class HwInfoConfigHw<gfxProduct>;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,7 +13,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_S;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_adls.inl"
#include "shared/source/gen12lp/adls/os_agnostic_hw_info_config_adls.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template class HwInfoConfigHw<gfxProduct>;

View File

@@ -13,7 +13,7 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG1;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_dg1.inl"
#include "shared/source/gen12lp/dg1/os_agnostic_hw_info_config_dg1.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
template <>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,7 @@ namespace NEO {
constexpr static auto gfxProduct = IGFX_ROCKETLAKE;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_rkl.inl"
#include "shared/source/gen12lp/rkl/os_agnostic_hw_info_config_rkl.inl"
template class HwInfoConfigHw<gfxProduct>;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,7 @@ namespace NEO {
constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP;
#include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl"
#include "shared/source/gen12lp/os_agnostic_hw_info_config_tgllp.inl"
#include "shared/source/gen12lp/tgllp/os_agnostic_hw_info_config_tgllp.inl"
template <>
void HwInfoConfigHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::BDW;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,9 +11,12 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROADWELL;
#include "shared/source/gen8/bdw/os_agnostic_hw_info_config_bdw.inl"
template <>
int HwInfoConfigHw<IGFX_BROADWELL>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -35,6 +38,6 @@ int HwInfoConfigHw<IGFX_BROADWELL>::configureHardwareCustom(HardwareInfo *hwInfo
return 0;
}
template class HwInfoConfigHw<IGFX_BROADWELL>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,16 +1,20 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROADWELL;
template class HwInfoConfigHw<IGFX_BROADWELL>;
#include "shared/source/gen8/bdw/os_agnostic_hw_info_config_bdw.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::BXT;
}

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::CFL;
}

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::GLK;
}

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::KBL;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,9 +13,12 @@
#include "shared/source/os_interface/os_interface.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROXTON;
#include "shared/source/gen9/bxt/os_agnostic_hw_info_config_bxt.inl"
template <>
int HwInfoConfigHw<IGFX_BROXTON>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -64,5 +67,5 @@ int HwInfoConfigHw<IGFX_BROXTON>::configureHardwareCustom(HardwareInfo *hwInfo,
return 0;
}
template class HwInfoConfigHw<IGFX_BROXTON>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,9 +11,12 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
#include "shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl"
template <>
int HwInfoConfigHw<IGFX_COFFEELAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -44,5 +47,5 @@ int HwInfoConfigHw<IGFX_COFFEELAKE>::configureHardwareCustom(HardwareInfo *hwInf
return 0;
}
template class HwInfoConfigHw<IGFX_COFFEELAKE>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,9 +13,12 @@
#include "shared/source/os_interface/os_interface.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_GEMINILAKE;
#include "shared/source/gen9/glk/os_agnostic_hw_info_config_glk.inl"
template <>
int HwInfoConfigHw<IGFX_GEMINILAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -62,5 +65,5 @@ int HwInfoConfigHw<IGFX_GEMINILAKE>::configureHardwareCustom(HardwareInfo *hwInf
return 0;
}
template class HwInfoConfigHw<IGFX_GEMINILAKE>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,9 +11,12 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_KABYLAKE;
#include "shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl"
template <>
int HwInfoConfigHw<IGFX_KABYLAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -44,5 +47,5 @@ int HwInfoConfigHw<IGFX_KABYLAKE>::configureHardwareCustom(HardwareInfo *hwInfo,
return 0;
}
template class HwInfoConfigHw<IGFX_KABYLAKE>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,9 +13,12 @@
#include "hw_cmds.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_SKYLAKE;
#include "shared/source/gen9/skl/os_agnostic_hw_info_config_skl.inl"
template <>
int HwInfoConfigHw<IGFX_SKYLAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (nullptr == osIface) {
return 0;
}
@@ -47,5 +50,5 @@ int HwInfoConfigHw<IGFX_SKYLAKE>::configureHardwareCustom(HardwareInfo *hwInfo,
return 0;
}
template class HwInfoConfigHw<IGFX_SKYLAKE>;
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::SKL;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,10 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROXTON;
template class HwInfoConfigHw<IGFX_BROXTON>;
#include "shared/source/gen9/bxt/os_agnostic_hw_info_config_bxt.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,10 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
template class HwInfoConfigHw<IGFX_COFFEELAKE>;
#include "shared/source/gen9/cfl/os_agnostic_hw_info_config_cfl.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,10 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_GEMINILAKE;
template class HwInfoConfigHw<IGFX_GEMINILAKE>;
#include "shared/source/gen9/glk/os_agnostic_hw_info_config_glk.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,10 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_KABYLAKE;
template class HwInfoConfigHw<IGFX_KABYLAKE>;
#include "shared/source/gen9/kbl/os_agnostic_hw_info_config_kbl.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,10 @@
#include "shared/source/os_interface/hw_info_config_bdw_and_later.inl"
namespace NEO {
constexpr static auto gfxProduct = IGFX_SKYLAKE;
template class HwInfoConfigHw<IGFX_SKYLAKE>;
#include "shared/source/gen9/skl/os_agnostic_hw_info_config_skl.inl"
template class HwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -103,6 +103,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.h
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math.h
${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper.h
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ray_tracing_helper.cpp

View File

@@ -9,12 +9,12 @@
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_DG2
#include "shared/source/xe_hpg_core/definitions/device_ids_configs_dg2.h"
#include "shared/source/xe_hpg_core/dg2/definitions/device_ids_configs_dg2.h"
#endif
#endif
#if SUPPORT_XE_HPC_CORE
#ifdef SUPPORT_PVC
#include "shared/source/xe_hpc_core/definitions/device_ids_configs_pvc.h"
#include "shared/source/xe_hpc_core/pvc/definitions/device_ids_configs_pvc.h"
#endif
#endif

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#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();
}
};
} // namespace NEO

View File

@@ -12,6 +12,7 @@
#include "shared/source/unified_memory/usm_memory_support.h"
#include "igfxfmid.h"
#include "platforms.h"
namespace NEO {
@@ -52,6 +53,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 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;
@@ -132,6 +134,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;
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;

View File

@@ -20,6 +20,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, c
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return PRODUCT_CONFIG::XEHP_SDV;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {

View File

@@ -8,8 +8,6 @@ if(SUPPORT_XE_HPC_CORE)
set(HW_DEFINITIONS_XE_HPC_CORE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}hw_cmds_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}os_agnostic_hw_info_config_pvc_extra.inl
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}device_ids_configs_pvc.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}hw_cmds_pvc.inl
${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config_pvc.inl
)

View File

@@ -34,18 +34,12 @@ struct PVC : public XE_HPC_COREFamily {
static bool isXl(const HardwareInfo &hwInfo) {
auto it = std::find(PVC_XL_IDS.begin(), PVC_XL_IDS.end(), hwInfo.platform.usDeviceID);
if (it != PVC_XL_IDS.end()) {
return true;
}
return false;
return it != PVC_XL_IDS.end();
}
static bool isXt(const HardwareInfo &hwInfo) {
auto it = std::find(PVC_XT_IDS.begin(), PVC_XT_IDS.end(), hwInfo.platform.usDeviceID);
if (it != PVC_XT_IDS.end()) {
return true;
}
return false;
return it != PVC_XT_IDS.end();
}
static constexpr uint32_t pvcSteppingBits = 0b111;

View File

@@ -26,8 +26,8 @@ const std::map<std::string, std::pair<uint32_t, uint32_t>> guidUuidOffsetMap = {
{"0x0", {0x0, 0}}};
#include "shared/source/os_interface/linux/hw_info_config_uuid_xehp_and_later.inl"
#include "shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl"
#include "shared/source/xe_hpc_core/os_agnostic_hw_info_config_xe_hpc_core.inl"
#include "shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl"
#include "os_agnostic_hw_info_config_pvc_extra.inl"

View File

@@ -52,6 +52,32 @@ uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
uint32_t stepping = getSteppingFromHwRevId(hwInfo);
if (stepping == CommonConstants::invalidStepping) {
return PRODUCT_CONFIG::UNKNOWN_ISA;
}
if (PVC::isXl(hwInfo)) {
switch (hwInfo.platform.usRevId) {
case 0x0:
return PRODUCT_CONFIG::PVC_XL_A0;
default:
case 0x1:
return PRODUCT_CONFIG::PVC_XL_B0;
}
} else {
switch (stepping) {
case REVISION_A0:
return PRODUCT_CONFIG::PVC_XT_A0;
default:
case REVISION_B:
return PRODUCT_CONFIG::PVC_XT_B0;
}
}
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) {
bool isBaseDieA0 = (hwInfo->platform.usRevId & XE_HPC_COREFamily::pvcBaseDieRevMask) == XE_HPC_COREFamily::pvcBaseDieA0Masked;

View File

@@ -16,8 +16,8 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_PVC;
#include "shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl"
#include "shared/source/xe_hpc_core/os_agnostic_hw_info_config_xe_hpc_core.inl"
#include "shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl"
#include "os_agnostic_hw_info_config_pvc_extra.inl"

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
PRODUCT_CONFIG HwInfoConfigHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
uint32_t stepping = getSteppingFromHwRevId(hwInfo);
if (stepping == CommonConstants::invalidStepping) {
return PRODUCT_CONFIG::UNKNOWN_ISA;
}
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;
}
} else {
return PRODUCT_CONFIG::DG2_G11;
}
}

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/xe_hpg_core/hw_info.h"
#include "device_ids_configs_dg2.h"
#include "igfxfmid.h"
#include <cstddef>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,6 +24,16 @@ struct DG2 : public XE_HPG_COREFamily {
static const RuntimeCapabilityTable capabilityTable;
static void (*setupHardwareInfo)(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig);
static void setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo);
static bool isG10(const HardwareInfo &hwInfo) {
auto it = std::find(DG2_G10_IDS.begin(), DG2_G10_IDS.end(), hwInfo.platform.usDeviceID);
return it != DG2_G10_IDS.end();
}
static bool isG11(const HardwareInfo &hwInfo) {
auto it = std::find(DG2_G11_IDS.begin(), DG2_G11_IDS.end(), hwInfo.platform.usDeviceID);
return it != DG2_G11_IDS.end();
}
};
class DG2_CONFIG : public DG2 {

View File

@@ -18,9 +18,11 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG2;
#include "shared/source/xe_hpg_core/os_agnostic_hw_info_config_dg2.inl"
#include "shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl"
#include "shared/source/xe_hpg_core/os_agnostic_hw_info_config_xe_hpg_core.inl"
#include "os_agnostic_hw_info_config_dg2_extra.inl"
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (allowCompression(*hwInfo)) {

View File

@@ -17,9 +17,11 @@
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG2;
#include "shared/source/xe_hpg_core/os_agnostic_hw_info_config_dg2.inl"
#include "shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl"
#include "shared/source/xe_hpg_core/os_agnostic_hw_info_config_xe_hpg_core.inl"
#include "os_agnostic_hw_info_config_dg2_extra.inl"
template <>
int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
if (allowCompression(*hwInfo)) {

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2021 Intel Corporation
# Copyright (C) 2019-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -15,6 +15,7 @@ target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/linear_stream_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/preemption_fixture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/preemption_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/product_config_fixture.h
)
add_subdirectories()

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#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 {
void SetUp() override {
hwInfo = *NEO::defaultHwInfo;
hwInfoConfig = NEO::HwInfoConfig::get(productFamily);
}
NEO::HwInfoConfig *hwInfoConfig = nullptr;
NEO::HardwareInfo hwInfo = {};
PRODUCT_CONFIG productConfig = UNKNOWN_ISA;
};

View File

@@ -106,6 +106,11 @@ uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping,
return CommonConstants::invalidStepping;
}
template <>
PRODUCT_CONFIG HwInfoConfigHw<IGFX_UNKNOWN>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
return UNKNOWN_ISA;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2021 Intel Corporation
# Copyright (C) 2020-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -25,3 +25,15 @@ target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/zebin_tests.h
)
if(TESTS_PVC)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_pvc.cpp
)
endif()
if(TESTS_DG2)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_dg2.cpp
)
endif()

View File

@@ -12,6 +12,9 @@
#include "shared/source/device_binary_format/elf/elf_encoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
@@ -52,19 +55,26 @@ TEST(UnpackSingleDeviceBinaryAr, WhenFailedToFindMatchingBinariesThenUnpackingFa
EXPECT_STREQ("Couldn't find matching binary in AR archive", unpackErrors.c_str());
}
TEST(UnpackSingleDeviceBinaryAr, WhenMultipleBinariesMatchedThenChooseBestMatch) {
TEST(UnpackSingleDeviceBinaryAr, WhenBinaryWithProductConfigIsFoundThenChooseItAsABestMatch) {
PatchTokensTestData::ValidEmptyProgram programTokens;
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
NEO::Ar::ArEncoder encoder;
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProductConfig, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct + "." + requiredStepping, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.productConfig = productConfig;
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
@@ -80,12 +90,52 @@ TEST(UnpackSingleDeviceBinaryAr, WhenMultipleBinariesMatchedThenChooseBestMatch)
auto decodedAr = NEO::Ar::decodeAr(arData, unpackErrors, unpackWarnings);
EXPECT_NE(nullptr, decodedAr.magic);
ASSERT_EQ(4U, decodedAr.files.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[2].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[2].fileData.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[1].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[1].fileData.size());
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}
TEST(UnpackSingleDeviceBinaryAr, WhenBestMatchIsntFullMatchThenChooseBestMatchButEmitWarnings) {
TEST(UnpackSingleDeviceBinaryAr, WhenMultipleBinariesMatchedThenChooseBestMatch) {
PatchTokensTestData::ValidEmptyProgram programTokens;
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
auto 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);
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProductConfig, programTokens.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
auto arData = encoder.encode();
std::string unpackErrors;
std::string unpackWarnings;
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_TRUE(unpackWarnings.empty()) << unpackWarnings;
unpackErrors.clear();
unpackWarnings.clear();
auto decodedAr = NEO::Ar::decodeAr(arData, unpackErrors, unpackWarnings);
EXPECT_NE(nullptr, decodedAr.magic);
ASSERT_EQ(4U, decodedAr.files.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[3].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[3].fileData.size());
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}
TEST(UnpackSingleDeviceBinaryAr, WhenBestMatchWithProductFamilyIsntFullMatchThenChooseBestMatchButEmitWarnings) {
PatchTokensTestData::ValidEmptyProgram programTokens;
NEO::Ar::ArEncoder encoder;
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
@@ -106,7 +156,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenBestMatchIsntFullMatchThenChooseBestMatchBu
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_FALSE(unpackWarnings.empty());
EXPECT_STREQ("Couldn't find perfectly matched binary (right stepping) in AR, using best usable", unpackWarnings.c_str());
EXPECT_STREQ("Couldn't find perfectly matched binary in AR, using best usable", unpackWarnings.c_str());
unpackErrors.clear();
unpackWarnings.clear();
@@ -118,7 +168,84 @@ TEST(UnpackSingleDeviceBinaryAr, WhenBestMatchIsntFullMatchThenChooseBestMatchBu
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}
TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackBestMatchThenTryUnpackingAnyUsable) {
TEST(UnpackSingleDeviceBinaryAr, WhenBestMatchWithProductConfigIsntFullMatchThenChooseBestMatchButEmitWarnings) {
PatchTokensTestData::ValidEmptyProgram programTokens;
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";
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
auto arData = encoder.encode();
std::string unpackErrors;
std::string unpackWarnings;
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_FALSE(unpackWarnings.empty());
EXPECT_STREQ("Couldn't find perfectly matched binary in AR, using best usable", unpackWarnings.c_str());
unpackErrors.clear();
unpackWarnings.clear();
auto decodedAr = NEO::Ar::decodeAr(arData, unpackErrors, unpackWarnings);
EXPECT_NE(nullptr, decodedAr.magic);
ASSERT_EQ(3U, decodedAr.files.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[1].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[1].fileData.size());
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}
TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithProductConfigThenTryUnpackAnyUsable) {
PatchTokensTestData::ValidEmptyProgram programTokens;
PatchTokensTestData::ValidEmptyProgram programTokensWrongTokenVersion;
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
programTokensWrongTokenVersion.headerMutable->Version -= 1;
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";
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProductConfig, programTokensWrongTokenVersion.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct + "." + requiredStepping, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
auto arData = encoder.encode();
std::string unpackErrors;
std::string unpackWarnings;
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_TRUE(unpackWarnings.empty());
unpackErrors.clear();
unpackWarnings.clear();
auto decodedAr = NEO::Ar::decodeAr(arData, unpackErrors, unpackWarnings);
EXPECT_NE(nullptr, decodedAr.magic);
ASSERT_EQ(5U, decodedAr.files.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[3].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[3].fileData.size());
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}
TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackBestMatchWithProductFamilyThenTryUnpackingAnyUsable) {
PatchTokensTestData::ValidEmptyProgram programTokens;
PatchTokensTestData::ValidEmptyProgram programTokensWrongTokenVersion;
programTokensWrongTokenVersion.headerMutable->Version -= 1;
@@ -142,7 +269,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackBestMatchThenTryUnpackingAnyU
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_FALSE(unpackWarnings.empty());
EXPECT_STREQ("Couldn't find perfectly matched binary (right stepping) in AR, using best usable", unpackWarnings.c_str());
EXPECT_STREQ("Couldn't find perfectly matched binary in AR, using best usable", unpackWarnings.c_str());
unpackErrors.clear();
unpackWarnings.clear();
@@ -154,7 +281,7 @@ TEST(UnpackSingleDeviceBinaryAr, WhenFailedToUnpackBestMatchThenTryUnpackingAnyU
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}
TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButIrAvailableThenUseIr) {
TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButIrWithProductFamilyAvailableThenUseIr) {
PatchTokensTestData::ValidEmptyProgram programTokens;
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
@@ -183,6 +310,41 @@ TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButIrAvailableThenUse
EXPECT_FALSE(unpacked.intermediateRepresentation.empty());
}
TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButIrWithProductConfigAvailableThenUseIr) {
PatchTokensTestData::ValidEmptyProgram programTokens;
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
std::string requiredStepping = std::to_string(programTokens.header->SteppingId);
std::string requiredPointerSize = (programTokens.header->GPUPointerSizeInBytes == 4) ? "32" : "64";
NEO::Elf::ElfEncoder<NEO::Elf::EI_CLASS_64> elfEnc64;
elfEnc64.getElfFileHeader().type = NEO::Elf::ET_OPENCL_EXECUTABLE;
elfEnc64.appendSection(NEO::Elf::SHT_OPENCL_SPIRV, NEO::Elf::SectionNamesOpenCl::spirvObject, ArrayRef<const uint8_t>::fromAny(NEO::spirvMagic.begin(), NEO::spirvMagic.size()));
auto elfData = elfEnc64.encode();
NEO::Ar::ArEncoder encoder{true};
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProductConfig, ArrayRef<const uint8_t>(elfData)));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
target.productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
auto arData = encoder.encode();
std::string unpackErrors;
std::string unpackWarnings;
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_TRUE(unpackWarnings.empty()) << unpackWarnings;
EXPECT_FALSE(unpacked.intermediateRepresentation.empty());
}
TEST(UnpackSingleDeviceBinaryAr, WhenDeviceBinaryNotMatchedButGenericIrFileAvailableThenUseGenericIr) {
PatchTokensTestData::ValidEmptyProgram programTokens;
std::string requiredProduct = NEO::hardwarePrefix[productFamily];
@@ -372,19 +534,28 @@ TEST(UnpackSingleDeviceBinaryAr, WhenOnlyIrIsAvailableThenUseOneFromBestMatchedB
TEST(UnpackSingleDeviceBinaryAr, WhenCouldNotFindBinaryWithRightPointerSizeThenUnpackingFails) {
PatchTokensTestData::ValidEmptyProgram programTokens;
NEO::Ar::ArEncoder encoder;
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
auto productConfig = hwInfoConfig.getProductConfigFromHwInfo(hwInfo);
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(productConfig);
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 wrongPointerSize = (programTokens.header->GPUPointerSizeInBytes == 8) ? "32" : "64";
ASSERT_TRUE(encoder.appendFileEntry(wrongPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(wrongPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(wrongPointerSize + "." + requiredProduct + "." + requiredStepping, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(wrongPointerSize + requiredProductConfig, programTokens.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
target.productConfig = productConfig;
auto arData = encoder.encode();
std::string unpackErrors;

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device_binary_format/ar/ar.h"
#include "shared/source/device_binary_format/ar/ar_decoder.h"
#include "shared/source/device_binary_format/ar/ar_encoder.h"
#include "shared/source/device_binary_format/device_binary_formats.h"
#include "shared/source/device_binary_format/elf/elf_encoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
using Dg2UnpackSingleDeviceBinaryAr = ::testing::Test;
DG2TEST_F(Dg2UnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithDg2ProductConfigThenTryUnpackAnotherBestMatch) {
PatchTokensTestData::ValidEmptyProgram programTokens;
PatchTokensTestData::ValidEmptyProgram programTokensWrongTokenVersion;
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(DG2_G10_A0);
std::string anotherProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(DG2_G10_B0);
programTokensWrongTokenVersion.headerMutable->Version -= 1;
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";
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + anotherProductConfig, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProductConfig, programTokensWrongTokenVersion.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.productConfig = DG2_G10_A0;
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
auto arData = encoder.encode();
std::string unpackErrors;
std::string unpackWarnings;
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_FALSE(unpackWarnings.empty());
EXPECT_STREQ("Couldn't find perfectly matched binary in AR, using best usable", unpackWarnings.c_str());
unpackErrors.clear();
unpackWarnings.clear();
auto decodedAr = NEO::Ar::decodeAr(arData, unpackErrors, unpackWarnings);
EXPECT_NE(nullptr, decodedAr.magic);
ASSERT_EQ(5U, decodedAr.files.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[3].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[3].fileData.size());
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device_binary_format/ar/ar.h"
#include "shared/source/device_binary_format/ar/ar_decoder.h"
#include "shared/source/device_binary_format/ar/ar_encoder.h"
#include "shared/source/device_binary_format/device_binary_formats.h"
#include "shared/source/device_binary_format/elf/elf_encoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/product_config_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
using PvcUnpackSingleDeviceBinaryAr = ::testing::Test;
PVCTEST_F(PvcUnpackSingleDeviceBinaryAr, WhenFailedToUnpackMatchWithPvcProductConfigThenTryUnpackAnotherBestMatch) {
PatchTokensTestData::ValidEmptyProgram programTokens;
PatchTokensTestData::ValidEmptyProgram programTokensWrongTokenVersion;
std::string requiredProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(PVC_XL_A0);
std::string anotherProductConfig = NEO::ProductConfigHelper::parseMajorMinorRevisionValue(PVC_XL_B0);
programTokensWrongTokenVersion.headerMutable->Version -= 1;
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";
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProduct, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + anotherProductConfig, programTokens.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "." + requiredProductConfig, programTokensWrongTokenVersion.storage));
ASSERT_TRUE(encoder.appendFileEntry(requiredPointerSize + "unk." + requiredStepping, programTokens.storage));
NEO::TargetDevice target;
target.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
target.productConfig = PVC_XL_A0;
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
auto arData = encoder.encode();
std::string unpackErrors;
std::string unpackWarnings;
auto unpacked = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(arData, requiredProduct, target, unpackErrors, unpackWarnings);
EXPECT_TRUE(unpackErrors.empty()) << unpackErrors;
EXPECT_FALSE(unpackWarnings.empty());
EXPECT_STREQ("Couldn't find perfectly matched binary in AR, using best usable", unpackWarnings.c_str());
unpackErrors.clear();
unpackWarnings.clear();
auto decodedAr = NEO::Ar::decodeAr(arData, unpackErrors, unpackWarnings);
EXPECT_NE(nullptr, decodedAr.magic);
ASSERT_EQ(5U, decodedAr.files.size());
EXPECT_EQ(unpacked.deviceBinary.begin(), decodedAr.files[2].fileData.begin());
EXPECT_EQ(unpacked.deviceBinary.size(), decodedAr.files[2].fileData.size());
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, unpacked.format);
}

View File

@@ -47,3 +47,8 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenGetThreadEuRatioForScratchThen8I
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
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);
}

View File

@@ -9,6 +9,7 @@ if(TESTS_PVC)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_walker_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/product_config_tests_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_pvc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_pvc.cpp

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/xe_hpc_core/hw_cmds_base.h"
#include "shared/test/common/fixtures/product_config_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "device_ids_configs_pvc.h"
using namespace NEO;
PVCTEST_F(ProductConfigTests, givenPvcXlDeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : PVC_XL_IDS) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XL_A0);
hwInfo.platform.usRevId = 0x1;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XL_B0);
hwInfo.platform.usRevId = 0x6;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XL_B0);
}
}
PVCTEST_F(ProductConfigTests, givenPvcXtDeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : PVC_XT_IDS) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x3;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XT_A0);
hwInfo.platform.usRevId = 0x5;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XT_B0);
hwInfo.platform.usRevId = 0x7;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XT_B0);
}
}
PVCTEST_F(ProductConfigTests, givenDefaultDeviceAndRevisionIdWhenGetProductConfigThenPvcXtA0ConfigIsReturned) {
hwInfo.platform.usRevId = 0x0;
hwInfo.platform.usDeviceID = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, PVC_XT_A0);
}
PVCTEST_F(ProductConfigTests, givenInvalidRevisionIdWhenGetProductConfigThenUnknownIsaIsReturned) {
hwInfo.platform.usRevId = 0x2;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, UNKNOWN_ISA);
}

View File

@@ -9,6 +9,8 @@ if(TESTS_DG2)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_dg2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_dg2.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}product_config_tests_dg2.cpp
)
add_subdirectories()
endif()

View File

@@ -8,10 +8,10 @@
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/fixtures/product_config_fixture.h"
#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"
using namespace NEO;
using HwInfoConfigTestDg2 = ::testing::Test;
@@ -362,3 +362,65 @@ DG2TEST_F(HwInfoConfigTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScratc
EXPECT_THROW(hwHelper.getComputeUnitsUsedForScratch(&hwInfo), std::exception);
}
DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) {
for (const auto &deviceId : DG2_G10_IDS) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_TRUE(DG2::isG10(hwInfo));
EXPECT_FALSE(DG2::isG11(hwInfo));
}
}
DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) {
for (const auto &deviceId : DG2_G11_IDS) {
hwInfo.platform.usDeviceID = deviceId;
EXPECT_FALSE(DG2::isG10(hwInfo));
EXPECT_TRUE(DG2::isG11(hwInfo));
}
}
DG2TEST_F(ProductConfigTests, givenInvalidRevisionIdWhenDeviceIdIsDefaultThenUnknownIsaIsReturned) {
hwInfo.platform.usDeviceID = 0;
hwInfo.platform.usRevId = 0xffff;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, UNKNOWN_ISA);
}
DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : DG2_G10_IDS) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G10_A0);
hwInfo.platform.usRevId = 0x1;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G10_A0);
hwInfo.platform.usRevId = 0x4;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G10_B0);
hwInfo.platform.usRevId = 0x8;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G10_B0);
}
}
DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) {
for (const auto &deviceId : DG2_G11_IDS) {
hwInfo.platform.usDeviceID = deviceId;
hwInfo.platform.usRevId = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G11);
hwInfo.platform.usRevId = 0x4;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G11);
}
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/xe_hpc_core/hw_cmds_base.h"
#include "shared/test/common/fixtures/product_config_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include "device_ids_configs_dg2.h"
using namespace NEO;
DG2TEST_F(ProductConfigTests, givenDefaultDeviceAndRevisionIdWhenGetProductConfigThenLastKnownDg2ConfigIsReturned) {
hwInfo.platform.usRevId = 0x0;
hwInfo.platform.usDeviceID = 0x0;
productConfig = hwInfoConfig->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(productConfig, DG2_G11);
}