From a75fcb6de02deb5c679ca71d73774ef4c5c72f1d Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Mon, 18 Sep 2023 12:28:40 +0000 Subject: [PATCH] fix: correct adjusting hw info for IGC, cover all cases Related-To: NEO-8203 Signed-off-by: Mateusz Jablonski --- .../source/ocloc_igc_facade.cpp | 11 +++----- .../igc_platform_helper.cpp | 10 +++++-- .../compiler_interface_tests.cpp | 27 ++++++++++++------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/shared/offline_compiler/source/ocloc_igc_facade.cpp b/shared/offline_compiler/source/ocloc_igc_facade.cpp index ec1241d373..be2621718d 100644 --- a/shared/offline_compiler/source/ocloc_igc_facade.cpp +++ b/shared/offline_compiler/source/ocloc_igc_facade.cpp @@ -98,15 +98,10 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) { } auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily); - auto copyHwInfo = hwInfo; - if (compilerProductHelper) { - compilerProductHelper->adjustHwInfoForIgc(copyHwInfo); - } + populateIgcPlatform(*igcPlatform, hwInfo); + IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo.gtSystemInfo); - populateIgcPlatform(*igcPlatform, copyHwInfo); - IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), copyHwInfo.gtSystemInfo); - - populateWithFeatures(igcFtrWa.get(), copyHwInfo, compilerProductHelper.get()); + populateWithFeatures(igcFtrWa.get(), hwInfo, compilerProductHelper.get()); initialized = true; return OCLOC_SUCCESS; diff --git a/shared/source/compiler_interface/igc_platform_helper.cpp b/shared/source/compiler_interface/igc_platform_helper.cpp index b63aab1b73..ddbdce74d5 100644 --- a/shared/source/compiler_interface/igc_platform_helper.cpp +++ b/shared/source/compiler_interface/igc_platform_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #include "shared/source/compiler_interface/igc_platform_helper.h" +#include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/helpers/hw_info.h" #include "ocl_igc_interface/gt_system_info.h" @@ -21,7 +22,12 @@ void populateIgcPlatform<>(IGC::Platform<1> &igcPlatform, const HardwareInfo &hw } template <> -void populateIgcPlatform<>(IGC::Platform<2> &igcPlatform, const HardwareInfo &hwInfo) { +void populateIgcPlatform<>(IGC::Platform<2> &igcPlatform, const HardwareInfo &inputHwInfo) { + auto hwInfo = inputHwInfo; + auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); + if (compilerProductHelper) { + compilerProductHelper->adjustHwInfoForIgc(hwInfo); + } igcPlatform.SetProductFamily(hwInfo.platform.eProductFamily); igcPlatform.SetPCHProductFamily(hwInfo.platform.ePCHProductFamily); igcPlatform.SetDisplayCoreFamily(hwInfo.platform.eDisplayCoreFamily); diff --git a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp index 48df955c08..9dedb872ba 100644 --- a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp +++ b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp @@ -905,30 +905,39 @@ HWTEST_F(CompilerInterfaceTest, givenNoDbgKeyForceUseDifferentPlatformWhenReques auto igcPlatform = devCtx->GetPlatformHandle(); auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); - EXPECT_EQ(device->getHardwareInfo().platform.eProductFamily, igcPlatform->GetProductFamily()); - EXPECT_EQ(device->getHardwareInfo().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()); - EXPECT_EQ(device->getHardwareInfo().gtSystemInfo.ThreadCount, igcSysInfo->GetThreadCount()); + auto hwInfo = device->getHardwareInfo(); + device->getCompilerProductHelper().adjustHwInfoForIgc(hwInfo); + + EXPECT_EQ(hwInfo.platform.eProductFamily, igcPlatform->GetProductFamily()); + EXPECT_EQ(hwInfo.platform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); + EXPECT_EQ(hwInfo.gtSystemInfo.SliceCount, igcSysInfo->GetSliceCount()); + EXPECT_EQ(hwInfo.gtSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount()); + EXPECT_EQ(hwInfo.gtSystemInfo.EUCount, igcSysInfo->GetEUCount()); + EXPECT_EQ(hwInfo.gtSystemInfo.ThreadCount, igcSysInfo->GetThreadCount()); } HWTEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestForNewTranslationCtxThenUseDbgKeyPlatform) { DebugManagerStateRestore dbgRestore; - auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily; + auto dbgProdFamily = defaultHwInfo->platform.eProductFamily; std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]); const GT_SYSTEM_INFO dbgSystemInfo = hardwareInfoTable[dbgProdFamily]->gtSystemInfo; DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString); auto device = this->pDevice; + device->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.eProductFamily = IGFX_UNKNOWN; + device->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.eRenderCoreFamily = IGFX_UNKNOWN_CORE; + auto retIgc = pCompilerInterface->createIgcTranslationCtx(*device, IGC::CodeType::spirV, IGC::CodeType::oclGenBin); EXPECT_NE(nullptr, retIgc); IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device); auto igcPlatform = devCtx->GetPlatformHandle(); auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); - EXPECT_EQ(hardwareInfoTable[dbgProdFamily]->platform.eProductFamily, igcPlatform->GetProductFamily()); - EXPECT_EQ(hardwareInfoTable[dbgProdFamily]->platform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); + auto hwInfo = *hardwareInfoTable[dbgProdFamily]; + device->getCompilerProductHelper().adjustHwInfoForIgc(hwInfo); + + EXPECT_EQ(hwInfo.platform.eProductFamily, igcPlatform->GetProductFamily()); + EXPECT_EQ(hwInfo.platform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); EXPECT_EQ(dbgSystemInfo.SliceCount, igcSysInfo->GetSliceCount()); EXPECT_EQ(dbgSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount()); EXPECT_EQ(dbgSystemInfo.DualSubSliceCount, igcSysInfo->GetSubSliceCount());