From 67ebc5d7fefeb357830fb912971ebc8711152a27 Mon Sep 17 00:00:00 2001 From: Rafal Maziejuk Date: Tue, 17 Jan 2023 11:19:19 +0000 Subject: [PATCH] Delete redundant adjustHwInfoForIgc method Signed-off-by: Rafal Maziejuk --- level_zero/core/source/device/device.h | 1 - level_zero/core/source/device/device_imp.cpp | 4 ---- level_zero/core/source/device/device_imp.h | 1 - .../core/test/unit_tests/mocks/mock_device.h | 1 - .../unit_tests/sources/module/test_module.cpp | 22 +++++-------------- .../test/unit_test/program/program_tests.cpp | 10 +-------- .../source/ocloc_igc_facade.cpp | 11 +++------- .../device_binary_formats.cpp | 2 -- .../source/helpers/compiler_hw_info_config.h | 4 +--- .../helpers/compiler_hw_info_config_base.inl | 5 +---- .../test/common/mocks/mock_modules_zebin.cpp | 14 ++---------- .../zebin_decoder_tests.cpp | 3 --- .../helpers/compiler_hw_info_config_tests.cpp | 10 --------- 13 files changed, 14 insertions(+), 74 deletions(-) diff --git a/level_zero/core/source/device/device.h b/level_zero/core/source/device/device.h index 85f34362fa..7767c45497 100644 --- a/level_zero/core/source/device/device.h +++ b/level_zero/core/source/device/device.h @@ -95,7 +95,6 @@ struct Device : _ze_device_handle_t { virtual const NEO::GfxCoreHelper &getGfxCoreHelper() = 0; virtual const L0GfxCoreHelper &getL0GfxCoreHelper() = 0; virtual const NEO::ProductHelper &getProductHelper() = 0; - virtual const NEO::CompilerProductHelper &getCompilerProductHelper() = 0; bool isImplicitScalingCapable() const { return implicitScalingCapable; diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 520c61f74a..2ccc20b621 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -1058,10 +1058,6 @@ const NEO::ProductHelper &DeviceImp::getProductHelper() { return this->neoDevice->getProductHelper(); } -const NEO::CompilerProductHelper &DeviceImp::getCompilerProductHelper() { - return this->neoDevice->getCompilerProductHelper(); -} - NEO::OSInterface &DeviceImp::getOsInterface() { return *neoDevice->getRootDeviceEnvironment().osInterface; } uint32_t DeviceImp::getPlatformInfo() const { diff --git a/level_zero/core/source/device/device_imp.h b/level_zero/core/source/device/device_imp.h index 8aab55ca7d..a33f5a29f4 100644 --- a/level_zero/core/source/device/device_imp.h +++ b/level_zero/core/source/device/device_imp.h @@ -74,7 +74,6 @@ struct DeviceImp : public Device { const NEO::GfxCoreHelper &getGfxCoreHelper() override; const L0GfxCoreHelper &getL0GfxCoreHelper() override; const NEO::ProductHelper &getProductHelper() override; - const NEO::CompilerProductHelper &getCompilerProductHelper() override; const NEO::HardwareInfo &getHwInfo() const override; NEO::OSInterface &getOsInterface() override; uint32_t getPlatformInfo() const override; diff --git a/level_zero/core/test/unit_tests/mocks/mock_device.h b/level_zero/core/test/unit_tests/mocks/mock_device.h index aa7f261b37..61ccd9c1e7 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_device.h +++ b/level_zero/core/test/unit_tests/mocks/mock_device.h @@ -60,7 +60,6 @@ struct Mock : public Device { ADDMETHOD_NOBASE_REFRETURN(getGfxCoreHelper, NEO::GfxCoreHelper &, ()); ADDMETHOD_NOBASE_REFRETURN(getL0GfxCoreHelper, L0GfxCoreHelper &, ()); ADDMETHOD_NOBASE_REFRETURN(getProductHelper, NEO::ProductHelper &, ()); - ADDMETHOD_NOBASE_REFRETURN(getCompilerProductHelper, NEO::CompilerProductHelper &, ()); ADDMETHOD_NOBASE(getBuiltinFunctionsLib, BuiltinFunctionsLib *, nullptr, ()); ADDMETHOD_CONST_NOBASE(getMaxNumHwThreads, uint32_t, 16u, ()); ADDMETHOD_NOBASE(activateMetricGroupsDeferred, ze_result_t, ZE_RESULT_SUCCESS, (uint32_t count, zet_metric_group_handle_t *phMetricGroups)); diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index b64d515083..fd8d9774a2 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -2263,18 +2263,14 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildFlagWhenCreatingModuleFromNative HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpRequiredTargetProductProperly) { ZebinTestData::ValidEmptyProgram emptyProgram; - auto copyHwInfo = device->getNEODevice()->getHardwareInfo(); - auto &compilerProductHelper = device->getCompilerProductHelper(); + const auto &hwInfo = device->getNEODevice()->getHardwareInfo(); - compilerProductHelper.adjustHwInfoForIgc(copyHwInfo); - - emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily; + emptyProgram.elfHeader->machine = hwInfo.platform.eProductFamily; L0::ModuleTranslationUnit moduleTuValid(this->device); ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; result = moduleTuValid.createFromNativeBinary(reinterpret_cast(emptyProgram.storage.data()), emptyProgram.storage.size()); EXPECT_EQ(result, ZE_RESULT_SUCCESS); - emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily; ++emptyProgram.elfHeader->machine; L0::ModuleTranslationUnit moduleTuInvalid(this->device); result = moduleTuInvalid.createFromNativeBinary(reinterpret_cast(emptyProgram.storage.data()), emptyProgram.storage.size()); @@ -2316,12 +2312,9 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromZebinThenAppendAllowZebinFlagToBuildOptions) { ZebinTestData::ValidEmptyProgram zebin; - auto copyHwInfo = device->getNEODevice()->getHardwareInfo(); - auto &compilerProductHelper = device->getCompilerProductHelper(); + const auto &hwInfo = device->getNEODevice()->getHardwareInfo(); - compilerProductHelper.adjustHwInfoForIgc(copyHwInfo); - - zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily; + zebin.elfHeader->machine = hwInfo.platform.eProductFamily; L0::ModuleTranslationUnit moduleTu(this->device); ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; result = moduleTu.createFromNativeBinary(reinterpret_cast(zebin.storage.data()), zebin.storage.size()); @@ -3637,12 +3630,9 @@ TEST_F(ModuleWithZebinTest, givenNonZebinaryFormatWhenGettingDebugInfoThenDebugZ HWTEST_F(ModuleWithZebinTest, givenZebinWithKernelCallingExternalFunctionThenUpdateKernelsBarrierCount) { ZebinTestData::ZebinWithExternalFunctionsInfo zebin; - auto copyHwInfo = device->getHwInfo(); - auto &compilerProductHelper = device->getCompilerProductHelper(); + const auto &hwInfo = device->getNEODevice()->getHardwareInfo(); - compilerProductHelper.adjustHwInfoForIgc(copyHwInfo); - - zebin.setProductFamily(static_cast(copyHwInfo.platform.eProductFamily)); + zebin.setProductFamily(static_cast(hwInfo.platform.eProductFamily)); ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 2361054420..9d062c590f 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -1979,15 +1979,7 @@ TEST_F(ProgramTests, whenCreatingFromZebinThenAppendAllowZebinFlagToBuildOptions } ZebinTestData::ValidEmptyProgram zebin; - - auto copyHwInfo = *defaultHwInfo; - MockExecutionEnvironment mockExecutionEnvironment{}; - - auto &compilerProductHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - - compilerProductHelper.adjustHwInfoForIgc(copyHwInfo); - - zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily; + zebin.elfHeader->machine = defaultHwInfo->platform.eProductFamily; auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr, mockRootDeviceIndex)); auto program = std::make_unique(toClDeviceVector(*device)); diff --git a/shared/offline_compiler/source/ocloc_igc_facade.cpp b/shared/offline_compiler/source/ocloc_igc_facade.cpp index daa6ee0a58..22016f55bd 100644 --- a/shared/offline_compiler/source/ocloc_igc_facade.cpp +++ b/shared/offline_compiler/source/ocloc_igc_facade.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -82,13 +82,8 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) { const auto compilerProductHelper = CompilerProductHelper::get(hwInfo.platform.eProductFamily); - auto copyHwInfo = hwInfo; - if (compilerProductHelper) { - compilerProductHelper->adjustHwInfoForIgc(copyHwInfo); - } - - populateIgcPlatform(*igcPlatform, copyHwInfo); - IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), copyHwInfo.gtSystemInfo); + populateIgcPlatform(*igcPlatform, hwInfo); + IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo.gtSystemInfo); populateWithFeatures(igcFtrWa.get(), hwInfo, compilerProductHelper); diff --git a/shared/source/device_binary_format/device_binary_formats.cpp b/shared/source/device_binary_format/device_binary_formats.cpp index f700f7be40..ae2d740274 100644 --- a/shared/source/device_binary_format/device_binary_formats.cpp +++ b/shared/source/device_binary_format/device_binary_formats.cpp @@ -26,8 +26,6 @@ TargetDevice getTargetDevice(const RootDeviceEnvironment &rootDeviceEnvironment) auto hwInfo = *rootDeviceEnvironment.getHardwareInfo(); auto &productHelper = rootDeviceEnvironment.getHelper(); auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); - auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); - compilerProductHelper.adjustHwInfoForIgc(hwInfo); TargetDevice targetDevice = {}; targetDevice.coreFamily = hwInfo.platform.eRenderCoreFamily; diff --git a/shared/source/helpers/compiler_hw_info_config.h b/shared/source/helpers/compiler_hw_info_config.h index bd1d2e3160..c4c5d1eb1b 100644 --- a/shared/source/helpers/compiler_hw_info_config.h +++ b/shared/source/helpers/compiler_hw_info_config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,6 @@ class CompilerProductHelper { virtual bool isForceToStatelessRequired() const = 0; virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const = 0; virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0; - virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0; }; template @@ -47,7 +46,6 @@ class CompilerProductHelperHw : public CompilerProductHelper { bool isForceToStatelessRequired() const override; void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const override; const char *getCachingPolicyOptions(bool isDebuggerActive) const override; - void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override; protected: CompilerProductHelperHw() = default; diff --git a/shared/source/helpers/compiler_hw_info_config_base.inl b/shared/source/helpers/compiler_hw_info_config_base.inl index 1d112926b0..0ca8ca83e8 100644 --- a/shared/source/helpers/compiler_hw_info_config_base.inl +++ b/shared/source/helpers/compiler_hw_info_config_base.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,4 @@ const char *CompilerProductHelperHw::getCachingPolicyOptions(bool is return L1CachePolicyHelper::getCachingPolicyOptions(isDebuggerActive); } -template -void CompilerProductHelperHw::adjustHwInfoForIgc(HardwareInfo &hwInfo) const {} - } // namespace NEO diff --git a/shared/test/common/mocks/mock_modules_zebin.cpp b/shared/test/common/mocks/mock_modules_zebin.cpp index 61f50b3d6e..7d6d404635 100644 --- a/shared/test/common/mocks/mock_modules_zebin.cpp +++ b/shared/test/common/mocks/mock_modules_zebin.cpp @@ -187,12 +187,7 @@ ZebinWithL0TestCommonModule::ZebinWithL0TestCommonModule(const NEO::HardwareInfo if (forceRecompilation) { elfHeader.machine = NEO::Elf::EM_NONE; } else { - auto compilerProductHelper = NEO::CompilerProductHelper::get(hwInfo.platform.eProductFamily); - auto copyHwInfo = hwInfo; - - compilerProductHelper->adjustHwInfoForIgc(copyHwInfo); - - elfHeader.machine = copyHwInfo.platform.eProductFamily; + elfHeader.machine = hwInfo.platform.eProductFamily; } const uint8_t testKernelData[0xac0] = {0u}; @@ -242,12 +237,7 @@ ZebinCopyBufferSimdModule::ZebinCopyBufferSimdModule(const NEO::Hardwar auto &elfHeader = elfEncoder.getElfFileHeader(); elfHeader.type = NEO::Elf::ET_ZEBIN_EXE; - auto compilerProductHelper = NEO::CompilerProductHelper::get(hwInfo.platform.eProductFamily); - auto copyHwInfo = hwInfo; - - compilerProductHelper->adjustHwInfoForIgc(copyHwInfo); - - elfHeader.machine = copyHwInfo.platform.eProductFamily; + elfHeader.machine = hwInfo.platform.eProductFamily; const uint8_t testKernelData[0x2c0] = {0u}; diff --git a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp index 738f2ac622..af466a9b80 100644 --- a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp +++ b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp @@ -69,9 +69,6 @@ TEST(ZebinValidateTargetTest, givenTargetDeviceCreatedUsingHelperFunctionWhenVal MockExecutionEnvironment executionEnvironment; auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; auto hwInfo = *rootDeviceEnvironment.getHardwareInfo(); - auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); - compilerProductHelper.adjustHwInfoForIgc(hwInfo); - auto targetDevice = getTargetDevice(rootDeviceEnvironment); EXPECT_TRUE(validateTargetDevice(targetDevice, Elf::EI_CLASS_32, hwInfo.platform.eProductFamily, hwInfo.platform.eRenderCoreFamily, AOT::UNKNOWN_ISA, {})); diff --git a/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp b/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp index f5539c3fab..1cb579ae94 100644 --- a/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp +++ b/shared/test/unit_test/helpers/compiler_hw_info_config_tests.cpp @@ -25,16 +25,6 @@ HWTEST_F(CompilerProductHelperFixture, WhenIsMidThreadPreemptionIsSupportedIsCal EXPECT_TRUE(compilerProductHelper.isMidThreadPreemptionSupported(hwInfo)); } -HWTEST_F(CompilerProductHelperFixture, WhenAdjustHwInfoForIgcIsCalledThenHwInfoNotChanged) { - auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto adjustedHwInfo = hwInfo; - auto &compilerProductHelper = pDevice->getCompilerProductHelper(); - - compilerProductHelper.adjustHwInfoForIgc(adjustedHwInfo); - - EXPECT_EQ(hwInfo.platform.eProductFamily, adjustedHwInfo.platform.eProductFamily); -} - using IsBeforeXeHpc = IsBeforeGfxCore; HWTEST2_F(CompilerProductHelperFixture, GivenProductBeforeXeHpcWhenIsForceToStatelessRequiredThenFalseIsReturned, IsBeforeXeHpc) {