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:
Daria Hinz
2022-06-13 23:13:43 +00:00
committed by Compute-Runtime-Automation
parent 2a71266708
commit 6d365cbfc3
77 changed files with 1962 additions and 1869 deletions

View File

@@ -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;

View File

@@ -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 <>

View 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()

View 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};
}

View File

@@ -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()

View 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};
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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");
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);
}