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

@@ -7,6 +7,7 @@
#include "shared/source/compiler_interface/compiler_interface.h"
#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/hw_info.h"
#include "shared/test/common/fixtures/device_fixture.h"
@@ -880,8 +881,12 @@ HWTEST_F(CompilerInterfaceTest, givenNoDbgKeyForceUseDifferentPlatformWhenReques
IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device);
auto igcPlatform = devCtx->GetPlatformHandle();
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.SubSliceCount, igcSysInfo->GetSubSliceCount());
EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.EUCount, igcSysInfo->GetEUCount());
@@ -892,7 +897,6 @@ HWTEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestF
DebugManagerStateRestore dbgRestore;
auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily;
std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]);
const PLATFORM dbgPlatform = hardwareInfoTable[dbgProdFamily]->platform;
const GT_SYSTEM_INFO dbgSystemInfo = hardwareInfoTable[dbgProdFamily]->gtSystemInfo;
DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString);
@@ -903,8 +907,11 @@ HWTEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestF
auto igcPlatform = devCtx->GetPlatformHandle();
auto igcSysInfo = devCtx->GetGTSystemInfoHandle();
EXPECT_EQ(dbgPlatform.eProductFamily, igcPlatform->GetProductFamily());
EXPECT_EQ(dbgPlatform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily());
HardwareInfo copyHwInfo = *hardwareInfoTable[dbgProdFamily];
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.SubSliceCount, 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/device_binary_format/elf/elf_encoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "patch_list.h"
@@ -25,7 +26,10 @@ template <enabledIrFormat irFormat = enabledIrFormat::NONE>
struct MockElfBinaryPatchtokens {
MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, 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.Version = iOpenCL::CURRENT_ICBE_VERSION;
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_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/unit_test/device_binary_format/patchtokens_tests.h"
@@ -125,6 +127,9 @@ TEST(ProgramDumper, GivenProgramWithPatchtokensThenProperlyCreatesDump) {
unknownToken1.Token = NUM_PATCH_TOKENS;
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::stringstream expected;
expected << R"===(Program of size : )===" << progWithConst.blobs.programInfo.size() << R"===( decoded successfully
@@ -134,7 +139,7 @@ struct SProgramBinaryHeader {
<< CURRENT_ICBE_VERSION << R"===(
uint32_t Device; // = )==="
<< renderCoreFamily << R"===(
<< copyHwInfo.platform.eRenderCoreFamily << R"===(
uint32_t GPUPointerSizeInBytes; // = )==="
<< progWithConst.header->GPUPointerSizeInBytes << R"===(
@@ -265,6 +270,10 @@ TEST(ProgramDumper, GivenProgramWithKernelThenProperlyCreatesDump) {
PatchTokensTestData::ValidProgramWithKernelUsingSlm program;
std::string generated = NEO::PatchTokenBinary::asString(program);
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
struct SProgramBinaryHeader {
uint32_t Magic; // = 1229870147
@@ -272,7 +281,7 @@ struct SProgramBinaryHeader {
<< iOpenCL::CURRENT_ICBE_VERSION << R"===(
uint32_t Device; // = )==="
<< renderCoreFamily << R"===(
<< copyHwInfo.platform.eRenderCoreFamily << R"===(
uint32_t GPUPointerSizeInBytes; // = )==="
<< program.header->GPUPointerSizeInBytes << R"===(
@@ -347,6 +356,10 @@ TEST(ProgramDumper, GivenProgramWithMultipleKerneslThenProperlyCreatesDump) {
program.kernels[2].name = ArrayRef<const char>();
std::string generated = NEO::PatchTokenBinary::asString(program);
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
struct SProgramBinaryHeader {
uint32_t Magic; // = 1229870147
@@ -354,7 +367,7 @@ struct SProgramBinaryHeader {
<< iOpenCL::CURRENT_ICBE_VERSION << R"===(
uint32_t Device; // = )==="
<< renderCoreFamily << R"===(
<< copyHwInfo.platform.eRenderCoreFamily << R"===(
uint32_t GPUPointerSizeInBytes; // = )==="
<< program.header->GPUPointerSizeInBytes << R"===(

View File

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