Add adjustHwInfoForIgc support

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-06-10 11:52:43 +00:00
committed by Compute-Runtime-Automation
parent 6e3d373ef6
commit 5510dc7daa
13 changed files with 93 additions and 28 deletions

View File

@@ -248,8 +248,10 @@ bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inp
UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice())); UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice()));
auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily]; auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily];
const auto &hwInfo = device->getNEODevice()->getHardwareInfo(); auto copyHwInfo = device->getNEODevice()->getHardwareInfo();
NEO::TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(hwInfo); NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
NEO::TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(copyHwInfo);
std::string decodeErrors; std::string decodeErrors;
std::string decodeWarnings; std::string decodeWarnings;
ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(input), inputSize); ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(input), inputSize);

View File

@@ -2016,14 +2016,16 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildFlagWhenCreatingModuleFromNative
HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpRequiredTargetProductProperly) { HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpRequiredTargetProductProperly) {
ZebinTestData::ValidEmptyProgram emptyProgram; ZebinTestData::ValidEmptyProgram emptyProgram;
auto hwInfo = device->getNEODevice()->getHardwareInfo();
emptyProgram.elfHeader->machine = hwInfo.platform.eProductFamily; NEO::HardwareInfo copyHwInfo = device->getNEODevice()->getHardwareInfo();
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily;
L0::ModuleTranslationUnit moduleTuValid(this->device); L0::ModuleTranslationUnit moduleTuValid(this->device);
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size()); bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size());
EXPECT_TRUE(success); EXPECT_TRUE(success);
emptyProgram.elfHeader->machine = hwInfo.platform.eProductFamily; emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily;
++emptyProgram.elfHeader->machine; ++emptyProgram.elfHeader->machine;
L0::ModuleTranslationUnit moduleTuInvalid(this->device); L0::ModuleTranslationUnit moduleTuInvalid(this->device);
success = moduleTuInvalid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size()); success = moduleTuInvalid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size());
@@ -2062,9 +2064,11 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked
HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromZebinThenAppendAllowZebinFlagToBuildOptions) { HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromZebinThenAppendAllowZebinFlagToBuildOptions) {
ZebinTestData::ValidEmptyProgram zebin; ZebinTestData::ValidEmptyProgram zebin;
auto hwInfo = device->getNEODevice()->getHardwareInfo();
zebin.elfHeader->machine = hwInfo.platform.eProductFamily; NEO::HardwareInfo copyHwInfo = device->getNEODevice()->getHardwareInfo();
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
L0::ModuleTranslationUnit moduleTu(this->device); L0::ModuleTranslationUnit moduleTu(this->device);
bool success = moduleTu.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size()); bool success = moduleTu.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size());
EXPECT_TRUE(success); EXPECT_TRUE(success);
@@ -2089,8 +2093,10 @@ kernels:
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::textPrefix.str() + "some_kernel", {}); zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::textPrefix.str() + "some_kernel", {});
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::textPrefix.str() + "some_other_kernel", {}); zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::textPrefix.str() + "some_other_kernel", {});
auto hwInfo = device->getNEODevice()->getHardwareInfo(); NEO::HardwareInfo copyHwInfo = device->getNEODevice()->getHardwareInfo();
zebin.elfHeader->machine = hwInfo.platform.eProductFamily; NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
L0::ModuleTranslationUnit moduleTuValid(this->device); L0::ModuleTranslationUnit moduleTuValid(this->device);
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size()); bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size());
@@ -2932,7 +2938,11 @@ TEST_F(ModuleWithZebinTest, givenNonZebinaryFormatWhenGettingDebugInfoThenDebugZ
HWTEST_F(ModuleWithZebinTest, givenZebinWithKernelCallingExternalFunctionThenUpdateKernelsBarrierCount) { HWTEST_F(ModuleWithZebinTest, givenZebinWithKernelCallingExternalFunctionThenUpdateKernelsBarrierCount) {
ZebinTestData::ZebinWithExternalFunctionsInfo zebin; ZebinTestData::ZebinWithExternalFunctionsInfo zebin;
zebin.setProductFamily(static_cast<uint16_t>(device->getHwInfo().platform.eProductFamily));
NEO::HardwareInfo copyHwInfo = device->getHwInfo();
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
zebin.setProductFamily(static_cast<uint16_t>(copyHwInfo.platform.eProductFamily));
ze_module_desc_t moduleDesc = {}; ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;

View File

@@ -31,7 +31,7 @@ components:
dest_dir: kernels_bin dest_dir: kernels_bin
type: git type: git
branch: kernels_bin branch: kernels_bin
revision: 1906-181 revision: 1906-184
kmdaf: kmdaf:
branch: kmdaf branch: kmdaf
dest_dir: kmdaf dest_dir: kmdaf

View File

@@ -165,7 +165,11 @@ cl_int Program::createProgramFromBinary(
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
auto productAbbreviation = hardwarePrefix[hwInfo->platform.eProductFamily]; auto productAbbreviation = hardwarePrefix[hwInfo->platform.eProductFamily];
TargetDevice targetDevice = targetDeviceFromHwInfo(*hwInfo);
auto copyHwInfo = *hwInfo;
CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
TargetDevice targetDevice = targetDeviceFromHwInfo(copyHwInfo);
std::string decodeErrors; std::string decodeErrors;
std::string decodeWarnings; std::string decodeWarnings;
auto singleDeviceBinary = unpackSingleDeviceBinary(archive, ConstStringRef(productAbbreviation, strlen(productAbbreviation)), targetDevice, auto singleDeviceBinary = unpackSingleDeviceBinary(archive, ConstStringRef(productAbbreviation, strlen(productAbbreviation)), targetDevice,

View File

@@ -1665,7 +1665,10 @@ TEST_F(ProgramWithDebugSymbolsTests, GivenProgramCreatedWithDashGOptionWhenGetti
ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(testBinary.get()), size); ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(testBinary.get()), size);
auto productAbbreviation = hardwarePrefix[pDevice->getHardwareInfo().platform.eProductFamily]; auto productAbbreviation = hardwarePrefix[pDevice->getHardwareInfo().platform.eProductFamily];
TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(pDevice->getHardwareInfo()); HardwareInfo copyHwInfo = pDevice->getHardwareInfo();
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(copyHwInfo);
std::string decodeErrors; std::string decodeErrors;
std::string decodeWarnings; std::string decodeWarnings;
@@ -2076,8 +2079,11 @@ TEST_F(ProgramTests, whenCreatingFromZebinThenAppendAllowZebinFlagToBuildOptions
GTEST_SKIP(); GTEST_SKIP();
} }
auto copyHwInfo = *defaultHwInfo;
CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
ZebinTestData::ValidEmptyProgram zebin; ZebinTestData::ValidEmptyProgram zebin;
zebin.elfHeader->machine = defaultHwInfo->platform.eProductFamily; zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr, mockRootDeviceIndex)); auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr, mockRootDeviceIndex));
auto program = std::make_unique<MockProgram>(toClDeviceVector(*device)); auto program = std::make_unique<MockProgram>(toClDeviceVector(*device));

View File

@@ -80,8 +80,13 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
const auto compilerHwInfoConfig = CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily); const auto compilerHwInfoConfig = CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), hwInfo.platform); auto copyHwInfo = hwInfo;
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo.gtSystemInfo); if (compilerHwInfoConfig) {
compilerHwInfoConfig->adjustHwInfoForIgc(copyHwInfo);
}
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), copyHwInfo.platform);
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), copyHwInfo.gtSystemInfo);
populateWithFeatures(igcFtrWa.get(), hwInfo, compilerHwInfoConfig); populateWithFeatures(igcFtrWa.get(), hwInfo, compilerHwInfoConfig);

View File

@@ -436,8 +436,11 @@ IGC::IgcOclDeviceCtxTagOCL *CompilerInterface::getIgcDeviceCtx(const Device &dev
getHwInfoForPlatformString(productFamily, hwInfo); getHwInfoForPlatformString(productFamily, hwInfo);
} }
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, hwInfo->platform); auto copyHwInfo = *hwInfo;
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, hwInfo->gtSystemInfo); CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, copyHwInfo.platform);
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, copyHwInfo.gtSystemInfo);
igcFtrWa->SetFtrDesktop(device.getHardwareInfo().featureTable.flags.ftrDesktop); igcFtrWa->SetFtrDesktop(device.getHardwareInfo().featureTable.flags.ftrDesktop);
igcFtrWa->SetFtrChannelSwizzlingXOREnabled(device.getHardwareInfo().featureTable.flags.ftrChannelSwizzlingXOREnabled); igcFtrWa->SetFtrChannelSwizzlingXOREnabled(device.getHardwareInfo().featureTable.flags.ftrChannelSwizzlingXOREnabled);

View File

@@ -27,6 +27,7 @@ class CompilerHwInfoConfig {
virtual bool isForceEmuInt32DivRemSPRequired() const = 0; virtual bool isForceEmuInt32DivRemSPRequired() const = 0;
virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0; virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0;
virtual bool isForceToStatelessRequired() const = 0; virtual bool isForceToStatelessRequired() const = 0;
virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0;
}; };
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>
@@ -41,6 +42,7 @@ class CompilerHwInfoConfigHw : public CompilerHwInfoConfig {
bool isForceEmuInt32DivRemSPRequired() const override; bool isForceEmuInt32DivRemSPRequired() const override;
bool isStatelessToStatefulBufferOffsetSupported() const override; bool isStatelessToStatefulBufferOffsetSupported() const override;
bool isForceToStatelessRequired() const override; bool isForceToStatelessRequired() const override;
void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override;
protected: protected:
CompilerHwInfoConfigHw() = default; CompilerHwInfoConfigHw() = default;

View File

@@ -20,4 +20,8 @@ bool CompilerHwInfoConfigHw<gfxProduct>::isStatelessToStatefulBufferOffsetSuppor
return true; return true;
} }
template <PRODUCT_FAMILY gfxProduct>
void CompilerHwInfoConfigHw<gfxProduct>::adjustHwInfoForIgc(HardwareInfo &hwInfo) const {
}
} // namespace NEO } // namespace NEO

View File

@@ -7,6 +7,7 @@
#include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/compiler_interface/compiler_interface.inl" #include "shared/source/compiler_interface/compiler_interface.inl"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/fixtures/device_fixture.h"
@@ -880,8 +881,12 @@ HWTEST_F(CompilerInterfaceTest, givenNoDbgKeyForceUseDifferentPlatformWhenReques
IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device); IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device);
auto igcPlatform = devCtx->GetPlatformHandle(); auto igcPlatform = devCtx->GetPlatformHandle();
auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); auto igcSysInfo = devCtx->GetGTSystemInfoHandle();
EXPECT_EQ(device->getHardwareInfo().platform.eProductFamily, igcPlatform->GetProductFamily());
EXPECT_EQ(device->getHardwareInfo().platform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); HardwareInfo copyHwInfo = device->getHardwareInfo();
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
EXPECT_EQ(copyHwInfo.platform.eProductFamily, igcPlatform->GetProductFamily());
EXPECT_EQ(copyHwInfo.platform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily());
EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.SliceCount, igcSysInfo->GetSliceCount()); EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.SliceCount, igcSysInfo->GetSliceCount());
EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount()); EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount());
EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.EUCount, igcSysInfo->GetEUCount()); EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.EUCount, igcSysInfo->GetEUCount());
@@ -892,7 +897,6 @@ HWTEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestF
DebugManagerStateRestore dbgRestore; DebugManagerStateRestore dbgRestore;
auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily; auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily;
std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]); std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]);
const PLATFORM dbgPlatform = hardwareInfoTable[dbgProdFamily]->platform;
const GT_SYSTEM_INFO dbgSystemInfo = hardwareInfoTable[dbgProdFamily]->gtSystemInfo; const GT_SYSTEM_INFO dbgSystemInfo = hardwareInfoTable[dbgProdFamily]->gtSystemInfo;
DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString); DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString);
@@ -903,8 +907,11 @@ HWTEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestF
auto igcPlatform = devCtx->GetPlatformHandle(); auto igcPlatform = devCtx->GetPlatformHandle();
auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); auto igcSysInfo = devCtx->GetGTSystemInfoHandle();
EXPECT_EQ(dbgPlatform.eProductFamily, igcPlatform->GetProductFamily()); HardwareInfo copyHwInfo = *hardwareInfoTable[dbgProdFamily];
EXPECT_EQ(dbgPlatform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
EXPECT_EQ(copyHwInfo.platform.eProductFamily, igcPlatform->GetProductFamily());
EXPECT_EQ(copyHwInfo.platform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily());
EXPECT_EQ(dbgSystemInfo.SliceCount, igcSysInfo->GetSliceCount()); EXPECT_EQ(dbgSystemInfo.SliceCount, igcSysInfo->GetSliceCount());
EXPECT_EQ(dbgSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount()); EXPECT_EQ(dbgSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount());
EXPECT_EQ(dbgSystemInfo.DualSubSliceCount, igcSysInfo->GetSubSliceCount()); EXPECT_EQ(dbgSystemInfo.DualSubSliceCount, igcSysInfo->GetSubSliceCount());

View File

@@ -10,6 +10,7 @@
#include "shared/source/compiler_interface/intermediate_representations.h" #include "shared/source/compiler_interface/intermediate_representations.h"
#include "shared/source/device_binary_format/elf/elf_encoder.h" #include "shared/source/device_binary_format/elf/elf_encoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h" #include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "patch_list.h" #include "patch_list.h"
@@ -25,7 +26,10 @@ template <enabledIrFormat irFormat = enabledIrFormat::NONE>
struct MockElfBinaryPatchtokens { struct MockElfBinaryPatchtokens {
MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, hwInfo){}; MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, hwInfo){};
MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &hwInfo) { MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &hwInfo) {
mockDevBinaryHeader.Device = hwInfo.platform.eRenderCoreFamily; auto copyHwInfo = hwInfo;
CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
mockDevBinaryHeader.Device = copyHwInfo.platform.eRenderCoreFamily;
mockDevBinaryHeader.GPUPointerSizeInBytes = sizeof(void *); mockDevBinaryHeader.GPUPointerSizeInBytes = sizeof(void *);
mockDevBinaryHeader.Version = iOpenCL::CURRENT_ICBE_VERSION; mockDevBinaryHeader.Version = iOpenCL::CURRENT_ICBE_VERSION;
constexpr size_t mockDevBinaryDataSize = sizeof(mockDevBinaryHeader) + mockDataSize; constexpr size_t mockDevBinaryDataSize = sizeof(mockDevBinaryHeader) + mockDataSize;

View File

@@ -7,6 +7,8 @@
#include "shared/source/device_binary_format/patchtokens_decoder.h" #include "shared/source/device_binary_format/patchtokens_decoder.h"
#include "shared/source/device_binary_format/patchtokens_dumper.h" #include "shared/source/device_binary_format/patchtokens_dumper.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h" #include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
@@ -125,6 +127,9 @@ TEST(ProgramDumper, GivenProgramWithPatchtokensThenProperlyCreatesDump) {
unknownToken1.Token = NUM_PATCH_TOKENS; unknownToken1.Token = NUM_PATCH_TOKENS;
progWithConst.unhandledTokens.push_back(&unknownToken1); progWithConst.unhandledTokens.push_back(&unknownToken1);
NEO::HardwareInfo copyHwInfo = *NEO::defaultHwInfo;
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
std::string generated = NEO::PatchTokenBinary::asString(progWithConst); std::string generated = NEO::PatchTokenBinary::asString(progWithConst);
std::stringstream expected; std::stringstream expected;
expected << R"===(Program of size : )===" << progWithConst.blobs.programInfo.size() << R"===( decoded successfully expected << R"===(Program of size : )===" << progWithConst.blobs.programInfo.size() << R"===( decoded successfully
@@ -134,7 +139,7 @@ struct SProgramBinaryHeader {
<< CURRENT_ICBE_VERSION << R"===( << CURRENT_ICBE_VERSION << R"===(
uint32_t Device; // = )===" uint32_t Device; // = )==="
<< renderCoreFamily << R"===( << copyHwInfo.platform.eRenderCoreFamily << R"===(
uint32_t GPUPointerSizeInBytes; // = )===" uint32_t GPUPointerSizeInBytes; // = )==="
<< progWithConst.header->GPUPointerSizeInBytes << R"===( << progWithConst.header->GPUPointerSizeInBytes << R"===(
@@ -265,6 +270,10 @@ TEST(ProgramDumper, GivenProgramWithKernelThenProperlyCreatesDump) {
PatchTokensTestData::ValidProgramWithKernelUsingSlm program; PatchTokensTestData::ValidProgramWithKernelUsingSlm program;
std::string generated = NEO::PatchTokenBinary::asString(program); std::string generated = NEO::PatchTokenBinary::asString(program);
std::stringstream expected; std::stringstream expected;
NEO::HardwareInfo copyHwInfo = *NEO::defaultHwInfo;
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
expected << R"===(Program of size : )===" << program.blobs.programInfo.size() << R"===( decoded successfully expected << R"===(Program of size : )===" << program.blobs.programInfo.size() << R"===( decoded successfully
struct SProgramBinaryHeader { struct SProgramBinaryHeader {
uint32_t Magic; // = 1229870147 uint32_t Magic; // = 1229870147
@@ -272,7 +281,7 @@ struct SProgramBinaryHeader {
<< iOpenCL::CURRENT_ICBE_VERSION << R"===( << iOpenCL::CURRENT_ICBE_VERSION << R"===(
uint32_t Device; // = )===" uint32_t Device; // = )==="
<< renderCoreFamily << R"===( << copyHwInfo.platform.eRenderCoreFamily << R"===(
uint32_t GPUPointerSizeInBytes; // = )===" uint32_t GPUPointerSizeInBytes; // = )==="
<< program.header->GPUPointerSizeInBytes << R"===( << program.header->GPUPointerSizeInBytes << R"===(
@@ -347,6 +356,10 @@ TEST(ProgramDumper, GivenProgramWithMultipleKerneslThenProperlyCreatesDump) {
program.kernels[2].name = ArrayRef<const char>(); program.kernels[2].name = ArrayRef<const char>();
std::string generated = NEO::PatchTokenBinary::asString(program); std::string generated = NEO::PatchTokenBinary::asString(program);
std::stringstream expected; std::stringstream expected;
NEO::HardwareInfo copyHwInfo = *NEO::defaultHwInfo;
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
expected << R"===(Program of size : )===" << program.blobs.programInfo.size() << R"===( decoded successfully expected << R"===(Program of size : )===" << program.blobs.programInfo.size() << R"===( decoded successfully
struct SProgramBinaryHeader { struct SProgramBinaryHeader {
uint32_t Magic; // = 1229870147 uint32_t Magic; // = 1229870147
@@ -354,7 +367,7 @@ struct SProgramBinaryHeader {
<< iOpenCL::CURRENT_ICBE_VERSION << R"===( << iOpenCL::CURRENT_ICBE_VERSION << R"===(
uint32_t Device; // = )===" uint32_t Device; // = )==="
<< renderCoreFamily << R"===( << copyHwInfo.platform.eRenderCoreFamily << R"===(
uint32_t GPUPointerSizeInBytes; // = )===" uint32_t GPUPointerSizeInBytes; // = )==="
<< program.header->GPUPointerSizeInBytes << R"===( << program.header->GPUPointerSizeInBytes << R"===(

View File

@@ -9,7 +9,9 @@
#include "shared/source/device_binary_format/patchtokens_decoder.h" #include "shared/source/device_binary_format/patchtokens_decoder.h"
#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/string.h" #include "shared/source/helpers/string.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "igfxfmid.h" #include "igfxfmid.h"
@@ -81,10 +83,13 @@ inline uint32_t pushBackArgInfoToken(std::vector<uint8_t> &outStream,
struct ValidEmptyProgram : NEO::PatchTokenBinary::ProgramFromPatchtokens { struct ValidEmptyProgram : NEO::PatchTokenBinary::ProgramFromPatchtokens {
ValidEmptyProgram() { ValidEmptyProgram() {
auto copyHwInfo = *NEO::defaultHwInfo;
NEO::CompilerHwInfoConfig::get(copyHwInfo.platform.eProductFamily)->adjustHwInfoForIgc(copyHwInfo);
iOpenCL::SProgramBinaryHeader headerTok = {}; iOpenCL::SProgramBinaryHeader headerTok = {};
headerTok.Magic = iOpenCL::MAGIC_CL; headerTok.Magic = iOpenCL::MAGIC_CL;
headerTok.Version = iOpenCL::CURRENT_ICBE_VERSION; headerTok.Version = iOpenCL::CURRENT_ICBE_VERSION;
headerTok.Device = renderCoreFamily; headerTok.Device = copyHwInfo.platform.eRenderCoreFamily;
headerTok.GPUPointerSizeInBytes = sizeof(uintptr_t); headerTok.GPUPointerSizeInBytes = sizeof(uintptr_t);
this->decodeStatus = NEO::DecodeError::Success; this->decodeStatus = NEO::DecodeError::Success;