From eafea5e2fee65dceca8b3ae1c5e7394f314002c8 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 7 Nov 2022 14:47:17 +0000 Subject: [PATCH] Move HwInfoConfig ownership to RootDeviceEnvironment 1/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk - Added HwInfoConfig getter in RootDeviceEnvironment, which temporarily takes HwInfoConfig from the global array - use HwInfoConfig from RootDeviceEnvironment to call ConfigureHardwareCustom function - Added getHwInfoConfig in DeviceFixture - ConfigureHardwareCustom function and few others changed to const - Small code cleanup --- .../unit_test/helpers/hw_helper_tests.cpp | 16 +++++----- .../xe_hp_core/hw_helper_tests_xe_hp_core.cpp | 15 ++++----- .../xehp/test_hw_info_config_xehp.inl | 25 ++++++++------- .../hw_helper_tests_xe_hpc_core.cpp | 14 ++++----- .../root_device_environment.cpp | 5 +++ .../root_device_environment.h | 2 ++ .../source/gen11/linux/hw_info_config_ehl.cpp | 2 +- .../gen11/linux/hw_info_config_icllp.cpp | 2 +- .../source/gen11/linux/hw_info_config_lkf.cpp | 2 +- .../gen12lp/linux/hw_info_config_adlp.cpp | 2 +- .../gen12lp/linux/hw_info_config_dg1.cpp | 2 +- .../gen12lp/linux/hw_info_config_rkl.cpp | 2 +- .../gen12lp/linux/hw_info_config_tgllp.cpp | 2 +- .../source/gen8/linux/hw_info_config_bdw.cpp | 2 +- .../source/gen9/linux/hw_info_config_bxt.cpp | 2 +- .../source/gen9/linux/hw_info_config_cfl.cpp | 2 +- .../source/gen9/linux/hw_info_config_glk.cpp | 2 +- .../source/gen9/linux/hw_info_config_kbl.cpp | 2 +- .../source/gen9/linux/hw_info_config_skl.cpp | 2 +- shared/source/os_interface/device_factory.cpp | 17 +++++----- shared/source/os_interface/hw_info_config.h | 8 ++--- shared/source/os_interface/hw_info_config.inl | 4 +-- .../hw_info_config_bdw_and_later.inl | 2 +- .../hw_info_config_xehp_and_later.inl | 2 +- .../linux/hw_info_config_xe_hp_sdv.cpp | 2 +- .../windows/hw_info_config_xe_hp_sdv.cpp | 2 +- .../linux/hw_info_config_xe_hpc_core.inl | 2 +- .../windows/hw_info_config_pvc.cpp | 2 +- .../xe_hpg_core/linux/hw_info_config_dg2.cpp | 2 +- .../windows/hw_info_config_dg2.cpp | 2 +- .../test/common/fixtures/device_fixture.cpp | 5 +++ shared/test/common/fixtures/device_fixture.h | 1 + .../common/helpers/mock_hw_info_config_hw.h | 2 +- .../common/helpers/mock_hw_info_config_hw.inl | 2 +- shared/test/common/libult/CMakeLists.txt | 14 ++++----- .../test/common/mocks/mock_hw_info_config.cpp | 2 +- .../command_stream/get_devices_tests.cpp | 16 +++++----- .../dg1/linux/hw_info_config_tests_dg1.cpp | 7 +++-- .../gen12lp/dg1/test_hw_info_config_dg1.cpp | 19 ++++++------ .../gen12lp/rkl/test_hw_info_config_rkl.cpp | 11 ++++--- .../tgllp/hw_info_config_tests_tgllp.cpp | 16 +++++----- .../windows/hw_info_config_tests_gen12lp.cpp | 7 +++-- .../linux/hw_info_config_linux_tests.cpp | 7 ++--- .../linux/hw_info_config_linux_tests.h | 4 +++ .../linux/hw_info_config_tests_xe_hp_sdv.cpp | 4 +-- .../pvc/linux/hw_info_config_tests_pvc.cpp | 10 +++--- .../pvc/test_hw_info_config_pvc.cpp | 11 ++++--- .../dg2/hw_info_config_tests_dg2.cpp | 31 ++++++++++--------- .../dg2/linux/hw_info_config_tests_dg2.cpp | 4 +-- .../hw_helper_tests_xe_hpg_core.cpp | 9 +++--- 50 files changed, 177 insertions(+), 153 deletions(-) diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index b409858293..806c1d681a 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -18,6 +18,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/os_interface.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/helpers/variable_backup.h" @@ -1047,16 +1048,16 @@ HWTEST_F(PipeControlHelperTests, WhenProgrammingCacheFlushThenExpectBasicFieldsS EXPECT_TRUE(pipeControl->getTlbInvalidate()); } -using HwInfoConfigCommonTest = ::testing::Test; +using HwInfoConfigCommonTest = Test; HWTEST2_F(HwInfoConfigCommonTest, givenBlitterPreferenceWhenEnablingBlitterOperationsSupportThenHonorThePreference, IsAtLeastGen12lp) { HardwareInfo hardwareInfo = *defaultHwInfo; - auto hwInfoConfig = HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + auto &hwInfoConfig = getHwInfoConfig(); - hwInfoConfig->configureHardwareCustom(&hardwareInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hardwareInfo, nullptr); - const auto expectedBlitterSupport = hwInfoConfig->obtainBlitterPreference(hardwareInfo); + const auto expectedBlitterSupport = hwInfoConfig.obtainBlitterPreference(hardwareInfo); EXPECT_EQ(expectedBlitterSupport, hardwareInfo.capabilityTable.blitterOperationsSupported); } @@ -1092,15 +1093,14 @@ TEST_F(HwHelperTest, givenInvalidEngineTypeWhenGettingEngineGroupTypeThenThrow) HWTEST2_F(HwInfoConfigCommonTest, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenHonorTheFlag, IsAtLeastGen12lp) { DebugManagerStateRestore restore{}; HardwareInfo hardwareInfo = *defaultHwInfo; - - auto hwInfoConfig = HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + auto &hwInfoConfig = getHwInfoConfig(); DebugManager.flags.EnableBlitterOperationsSupport.set(1); - hwInfoConfig->configureHardwareCustom(&hardwareInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hardwareInfo, nullptr); EXPECT_TRUE(hardwareInfo.capabilityTable.blitterOperationsSupported); DebugManager.flags.EnableBlitterOperationsSupport.set(0); - hwInfoConfig->configureHardwareCustom(&hardwareInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hardwareInfo, nullptr); EXPECT_FALSE(hardwareInfo.capabilityTable.blitterOperationsSupported); } diff --git a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp index 4740717762..05aa0f1980 100644 --- a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp +++ b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp @@ -10,6 +10,7 @@ #include "shared/source/xe_hp_core/hw_cmds.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/cmd_parse/hw_parse.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/helpers/unit_test_helper.h" @@ -118,7 +119,7 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenRevisionEnumAndPlatformFamilyType EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo)); } else if (stepping == REVISION_A1) { EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo)); - } else if (stepping == REVISION_C || stepping == REVISION_D) { //undefined + } else if (stepping == REVISION_C || stepping == REVISION_D) { // undefined EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo)); } } else { @@ -197,31 +198,31 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXeHPAndLaterPlatformWhenCheckAssi EXPECT_FALSE(hwHelper.isAssignEngineRoundRobinSupported(*defaultHwInfo)); } -using HwInfoConfigTestXE_HP_CORE = ::testing::Test; +using HwInfoConfigTestXE_HP_CORE = Test; XE_HP_CORE_TEST_F(HwInfoConfigTestXE_HP_CORE, givenDebugVariableSetWhenConfigureIsCalledThenSetupBlitterOperationsSupportedFlag) { DebugManagerStateRestore restore; - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; DebugManager.flags.EnableBlitterOperationsSupport.set(0); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_FALSE(hwInfo.capabilityTable.blitterOperationsSupported); DebugManager.flags.EnableBlitterOperationsSupport.set(1); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_TRUE(hwInfo.capabilityTable.blitterOperationsSupported); } XE_HP_CORE_TEST_F(HwInfoConfigTestXE_HP_CORE, givenMultitileConfigWhenConfiguringHwInfoThenEnableBlitter) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; for (uint32_t tileCount = 0; tileCount <= 4; tileCount++) { hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = tileCount; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_EQ(true, hwInfo.capabilityTable.blitterOperationsSupported); } diff --git a/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl b/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl index 86c9272726..4e8c8a2299 100644 --- a/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl +++ b/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl @@ -7,6 +7,7 @@ #include "shared/source/command_stream/stream_properties.h" #include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/gtest_helpers.h" #include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/mocks/mock_device.h" @@ -20,29 +21,29 @@ using namespace NEO; -using XeHPHwInfoConfig = ::testing::Test; +using XeHPHwInfoConfig = Test; XEHPTEST_F(XeHPHwInfoConfig, givenXeHPMultiConfigWhenConfigureHardwareCustomIsCalledThenCapabilityTableIsSetProperly) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; hwInfo.featureTable.flags.ftrE2ECompression = true; hwInfo.gtSystemInfo.EUCount = 256u; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages); hwInfo.gtSystemInfo.EUCount = 512u; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedImages); } XEHPTEST_F(XeHPHwInfoConfig, givenXeHPWhenConfiguringThenDisableRcs) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_FALSE(hwInfo.featureTable.flags.ftrRcsNode); } @@ -50,10 +51,10 @@ XEHPTEST_F(XeHPHwInfoConfig, givenDebugVariableSetWhenConfiguringThenEnableRcs) DebugManagerStateRestore restore; DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_RCS)); - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode); } @@ -64,7 +65,7 @@ XEHPTEST_F(XeHPHwInfoConfig, givenXeHpWhenCallingGetDeviceMemoryNameThenHbmIsRet } XEHPTEST_F(XeHPHwInfoConfig, givenA0OrA1SteppingWhenAskingIfExtraParametersAreInvalidThenReturnTrue) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); std::array, 4> revisions = { {{REVISION_A0, true}, {REVISION_A1, true}, @@ -73,11 +74,11 @@ XEHPTEST_F(XeHPHwInfoConfig, givenA0OrA1SteppingWhenAskingIfExtraParametersAreIn for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); - EXPECT_EQ(paramBool, hwInfoConfig->extraParametersInvalid(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.extraParametersInvalid(hwInfo)); } } diff --git a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp index e0fbe12500..866f221222 100644 --- a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp @@ -8,6 +8,7 @@ #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/cmd_parse/hw_parse.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/helpers/ult_hw_config.h" @@ -650,7 +651,7 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenHwHelperWhenGettingThreadsPerEUCo EXPECT_EQ(8U, configs[1]); } -using HwInfoConfigTestXeHpcCore = ::testing::Test; +using HwInfoConfigTestXeHpcCore = Test; XE_HPC_CORETEST_F(HwInfoConfigTestXeHpcCore, givenDefaultHwInfoConfigHwWhenGettingIsBlitCopyRequiredForLocalMemoryThenFalseIsReturned) { auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); @@ -662,27 +663,26 @@ XE_HPC_CORETEST_F(HwInfoConfigTestXeHpcCore, givenDefaultHwInfoConfigHwWhenGetti XE_HPC_CORETEST_F(HwInfoConfigTestXeHpcCore, givenDebugVariableSetWhenConfigureIsCalledThenSetupBlitterOperationsSupportedFlag) { DebugManagerStateRestore restore; - auto hwInfoConfig = HwInfoConfig::get(productFamily); - + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; DebugManager.flags.EnableBlitterOperationsSupport.set(0); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_FALSE(hwInfo.capabilityTable.blitterOperationsSupported); DebugManager.flags.EnableBlitterOperationsSupport.set(1); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_TRUE(hwInfo.capabilityTable.blitterOperationsSupported); } XE_HPC_CORETEST_F(HwInfoConfigTestXeHpcCore, givenMultitileConfigWhenConfiguringHwInfoThenEnableBlitter) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; for (uint32_t tileCount = 0; tileCount <= 4; tileCount++) { hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = tileCount; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_EQ(true, hwInfo.capabilityTable.blitterOperationsSupported); } diff --git a/shared/source/execution_environment/root_device_environment.cpp b/shared/source/execution_environment/root_device_environment.cpp index 47f8552cd9..7dc003cce8 100644 --- a/shared/source/execution_environment/root_device_environment.cpp +++ b/shared/source/execution_environment/root_device_environment.cpp @@ -124,6 +124,11 @@ BindlessHeapsHelper *RootDeviceEnvironment::getBindlessHeapsHelper() const { return bindlessHeapsHelper.get(); } +const HwInfoConfig &RootDeviceEnvironment::getHwInfoConfig() const { + auto &hwInfoConfig = *HwInfoConfig::get(this->getHardwareInfo()->platform.eProductFamily); + return hwInfoConfig; +} + void RootDeviceEnvironment::createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) { bindlessHeapsHelper = std::make_unique(memoryManager, availableDevices, rootDeviceIndex, deviceBitfield); } diff --git a/shared/source/execution_environment/root_device_environment.h b/shared/source/execution_environment/root_device_environment.h index 3992894a64..44edfebc1e 100644 --- a/shared/source/execution_environment/root_device_environment.h +++ b/shared/source/execution_environment/root_device_environment.h @@ -34,6 +34,7 @@ class OSInterface; class OSTime; class SipKernel; class SWTagsManager; +class HwInfoConfig; struct HardwareInfo; struct RootDeviceEnvironment { @@ -66,6 +67,7 @@ struct RootDeviceEnvironment { void createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield); void limitNumberOfCcs(uint32_t numberOfCcs); bool isNumberOfCcsLimited() const; + const HwInfoConfig &getHwInfoConfig() const; std::unique_ptr sipKernels[static_cast(SipKernelType::COUNT)]; std::unique_ptr gmmHelper; diff --git a/shared/source/gen11/linux/hw_info_config_ehl.cpp b/shared/source/gen11/linux/hw_info_config_ehl.cpp index 3c9479adf7..1878161347 100644 --- a/shared/source/gen11/linux/hw_info_config_ehl.cpp +++ b/shared/source/gen11/linux/hw_info_config_ehl.cpp @@ -19,7 +19,7 @@ constexpr static auto gfxProduct = IGFX_ELKHARTLAKE; #include "shared/source/gen11/ehl/os_agnostic_hw_info_config_ehl.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen11/linux/hw_info_config_icllp.cpp b/shared/source/gen11/linux/hw_info_config_icllp.cpp index 51d471dbf1..b384293bd7 100644 --- a/shared/source/gen11/linux/hw_info_config_icllp.cpp +++ b/shared/source/gen11/linux/hw_info_config_icllp.cpp @@ -19,7 +19,7 @@ constexpr static auto gfxProduct = IGFX_ICELAKE_LP; #include "shared/source/gen11/icllp/os_agnostic_hw_info_config_icllp.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen11/linux/hw_info_config_lkf.cpp b/shared/source/gen11/linux/hw_info_config_lkf.cpp index 73e8c4d3a6..5e1e19b766 100644 --- a/shared/source/gen11/linux/hw_info_config_lkf.cpp +++ b/shared/source/gen11/linux/hw_info_config_lkf.cpp @@ -19,7 +19,7 @@ constexpr static auto gfxProduct = IGFX_LAKEFIELD; #include "shared/source/gen11/lkf/os_agnostic_hw_info_config_lkf.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen12lp/linux/hw_info_config_adlp.cpp b/shared/source/gen12lp/linux/hw_info_config_adlp.cpp index 1f9738e05a..762e02ad5c 100644 --- a/shared/source/gen12lp/linux/hw_info_config_adlp.cpp +++ b/shared/source/gen12lp/linux/hw_info_config_adlp.cpp @@ -22,7 +22,7 @@ constexpr static auto gfxProduct = IGFX_ALDERLAKE_P; #include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo; gtSystemInfo->SliceCount = 1; const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily); diff --git a/shared/source/gen12lp/linux/hw_info_config_dg1.cpp b/shared/source/gen12lp/linux/hw_info_config_dg1.cpp index e4fe9d659c..c228f836e0 100644 --- a/shared/source/gen12lp/linux/hw_info_config_dg1.cpp +++ b/shared/source/gen12lp/linux/hw_info_config_dg1.cpp @@ -20,7 +20,7 @@ constexpr static auto gfxProduct = IGFX_DG1; #include "shared/source/gen12lp/os_agnostic_hw_info_config_gen12lp.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo; gtSystemInfo->SliceCount = 1; diff --git a/shared/source/gen12lp/linux/hw_info_config_rkl.cpp b/shared/source/gen12lp/linux/hw_info_config_rkl.cpp index 8734ba0e75..94a09f3d3c 100644 --- a/shared/source/gen12lp/linux/hw_info_config_rkl.cpp +++ b/shared/source/gen12lp/linux/hw_info_config_rkl.cpp @@ -20,7 +20,7 @@ constexpr static auto gfxProduct = IGFX_ROCKETLAKE; #include "shared/source/gen12lp/rkl/os_agnostic_hw_info_config_rkl.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo; gtSystemInfo->SliceCount = 1; hwInfo->featureTable.flags.ftrGpGpuMidThreadLevelPreempt = false; diff --git a/shared/source/gen12lp/linux/hw_info_config_tgllp.cpp b/shared/source/gen12lp/linux/hw_info_config_tgllp.cpp index 10baf84bd3..24f4df5370 100644 --- a/shared/source/gen12lp/linux/hw_info_config_tgllp.cpp +++ b/shared/source/gen12lp/linux/hw_info_config_tgllp.cpp @@ -20,7 +20,7 @@ constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP; #include "shared/source/gen12lp/tgllp/os_agnostic_hw_info_config_tgllp.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo; gtSystemInfo->SliceCount = 1; hwInfo->featureTable.flags.ftrGpGpuMidThreadLevelPreempt = false; diff --git a/shared/source/gen8/linux/hw_info_config_bdw.cpp b/shared/source/gen8/linux/hw_info_config_bdw.cpp index 404bd26e2a..e669816cf0 100644 --- a/shared/source/gen8/linux/hw_info_config_bdw.cpp +++ b/shared/source/gen8/linux/hw_info_config_bdw.cpp @@ -19,7 +19,7 @@ constexpr static auto gfxProduct = IGFX_BROADWELL; #include "shared/source/gen8/bdw/os_agnostic_hw_info_config_bdw.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen9/linux/hw_info_config_bxt.cpp b/shared/source/gen9/linux/hw_info_config_bxt.cpp index a8eeacfa1f..edd71e86a0 100644 --- a/shared/source/gen9/linux/hw_info_config_bxt.cpp +++ b/shared/source/gen9/linux/hw_info_config_bxt.cpp @@ -21,7 +21,7 @@ constexpr static auto gfxProduct = IGFX_BROXTON; #include "shared/source/gen9/bxt/os_agnostic_hw_info_config_bxt.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen9/linux/hw_info_config_cfl.cpp b/shared/source/gen9/linux/hw_info_config_cfl.cpp index 24049b9f08..2e5753686d 100644 --- a/shared/source/gen9/linux/hw_info_config_cfl.cpp +++ b/shared/source/gen9/linux/hw_info_config_cfl.cpp @@ -16,7 +16,7 @@ constexpr static auto gfxProduct = IGFX_COFFEELAKE; namespace NEO { template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen9/linux/hw_info_config_glk.cpp b/shared/source/gen9/linux/hw_info_config_glk.cpp index 5e73c5f624..b34e722e5e 100644 --- a/shared/source/gen9/linux/hw_info_config_glk.cpp +++ b/shared/source/gen9/linux/hw_info_config_glk.cpp @@ -21,7 +21,7 @@ constexpr static auto gfxProduct = IGFX_GEMINILAKE; #include "shared/source/gen9/glk/os_agnostic_hw_info_config_glk.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen9/linux/hw_info_config_kbl.cpp b/shared/source/gen9/linux/hw_info_config_kbl.cpp index 94d9606753..58f58cec5a 100644 --- a/shared/source/gen9/linux/hw_info_config_kbl.cpp +++ b/shared/source/gen9/linux/hw_info_config_kbl.cpp @@ -16,7 +16,7 @@ constexpr static auto gfxProduct = IGFX_KABYLAKE; namespace NEO { template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/gen9/linux/hw_info_config_skl.cpp b/shared/source/gen9/linux/hw_info_config_skl.cpp index 646f77bb67..d82f6afe9a 100644 --- a/shared/source/gen9/linux/hw_info_config_skl.cpp +++ b/shared/source/gen9/linux/hw_info_config_skl.cpp @@ -19,7 +19,7 @@ constexpr static auto gfxProduct = IGFX_SKYLAKE; #include "shared/source/gen9/skl/os_agnostic_hw_info_config_skl.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (nullptr == osIface) { return 0; } diff --git a/shared/source/os_interface/device_factory.cpp b/shared/source/os_interface/device_factory.cpp index 6ebc8a3e18..4ff87531a2 100644 --- a/shared/source/os_interface/device_factory.cpp +++ b/shared/source/os_interface/device_factory.cpp @@ -50,7 +50,8 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE DebugManager.getHardwareInfoOverride(hwInfoConfigStr); for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) { - auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo(); + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get(); + auto hardwareInfo = rootDeviceEnvironment.getMutableHardwareInfo(); *hardwareInfo = *hwInfoConst; if (hwInfoConfigStr == "default") { @@ -62,8 +63,8 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE hardwareInfoSetup[hwInfoConst->platform.eProductFamily](hardwareInfo, true, hwInfoConfig); - HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily); - hwConfig->configureHardwareCustom(hardwareInfo, nullptr); + auto &hwConfig = rootDeviceEnvironment.getHwInfoConfig(); + hwConfig.configureHardwareCustom(hardwareInfo, nullptr); if (productConfigFound) { const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(hardwareInfo->platform.eProductFamily); @@ -83,17 +84,17 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE hardwareInfo->platform.usDeviceID = static_cast(std::stoi(DebugManager.flags.ForceDeviceId.get(), nullptr, 16)); } - [[maybe_unused]] bool result = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAilConfiguration(); + [[maybe_unused]] bool result = rootDeviceEnvironment.initAilConfiguration(); DEBUG_BREAK_IF(!result); auto csrType = DebugManager.flags.SetCommandStreamReceiver.get(); if (csrType > 0) { auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily); auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo); - executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initGmm(); - executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAubCenter(localMemoryEnabled, "", static_cast(csrType)); - auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get(); - executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique(aubCenter->getAubManager()); + rootDeviceEnvironment.initGmm(); + rootDeviceEnvironment.initAubCenter(localMemoryEnabled, "", static_cast(csrType)); + auto aubCenter = rootDeviceEnvironment.aubCenter.get(); + rootDeviceEnvironment.memoryOperationsInterface = std::make_unique(aubCenter->getAubManager()); } } diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index f8b783d447..90fa5f28cf 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -50,7 +50,7 @@ class HwInfoConfig { static constexpr uint32_t luidSize = 8u; int configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface); int configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface); - virtual int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) = 0; + virtual int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const = 0; virtual void adjustPlatformForProductFamily(HardwareInfo *hwInfo) = 0; virtual void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) = 0; virtual uint64_t getHostMemCapabilities(const HardwareInfo *hwInfo) = 0; @@ -186,7 +186,7 @@ class HwInfoConfigHw : public HwInfoConfig { static HwInfoConfigHw instance; return &instance; } - int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) override; + int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const override; void adjustPlatformForProductFamily(HardwareInfo *hwInfo) override; void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) override; uint64_t getHostMemCapabilities(const HardwareInfo *hwInfo) override; @@ -307,8 +307,8 @@ class HwInfoConfigHw : public HwInfoConfig { protected: HwInfoConfigHw() = default; - void enableCompression(HardwareInfo *hwInfo); - void enableBlitterOperationsSupport(HardwareInfo *hwInfo); + void enableCompression(HardwareInfo *hwInfo) const; + void enableBlitterOperationsSupport(HardwareInfo *hwInfo) const; bool getConcurrentAccessMemCapabilitiesSupported(UsmAccessCapabilities capability); uint64_t getHostMemCapabilitiesValue(); bool getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo); diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 655347ba4c..693dbe8245 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -22,7 +22,7 @@ namespace NEO { template -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { enableCompression(hwInfo); enableBlitterOperationsSupport(hwInfo); @@ -49,7 +49,7 @@ template void HwInfoConfigHw::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {} template -void HwInfoConfigHw::enableBlitterOperationsSupport(HardwareInfo *hwInfo) { +void HwInfoConfigHw::enableBlitterOperationsSupport(HardwareInfo *hwInfo) const { hwInfo->capabilityTable.blitterOperationsSupported = obtainBlitterPreference(*hwInfo); if (DebugManager.flags.EnableBlitterOperationsSupport.get() != -1) { diff --git a/shared/source/os_interface/hw_info_config_bdw_and_later.inl b/shared/source/os_interface/hw_info_config_bdw_and_later.inl index 1a51a13bee..3041db2a2f 100644 --- a/shared/source/os_interface/hw_info_config_bdw_and_later.inl +++ b/shared/source/os_interface/hw_info_config_bdw_and_later.inl @@ -20,7 +20,7 @@ uint64_t HwInfoConfigHw::getCrossDeviceSharedMemCapabilities() { } template -void HwInfoConfigHw::enableCompression(HardwareInfo *hwInfo) { +void HwInfoConfigHw::enableCompression(HardwareInfo *hwInfo) const { hwInfo->capabilityTable.ftrRenderCompressedImages = hwInfo->featureTable.flags.ftrE2ECompression; hwInfo->capabilityTable.ftrRenderCompressedBuffers = hwInfo->featureTable.flags.ftrE2ECompression; } diff --git a/shared/source/os_interface/hw_info_config_xehp_and_later.inl b/shared/source/os_interface/hw_info_config_xehp_and_later.inl index 3852fba4fb..d405d7e076 100644 --- a/shared/source/os_interface/hw_info_config_xehp_and_later.inl +++ b/shared/source/os_interface/hw_info_config_xehp_and_later.inl @@ -25,7 +25,7 @@ uint64_t HwInfoConfigHw::getCrossDeviceSharedMemCapabilities() { } template -void HwInfoConfigHw::enableCompression(HardwareInfo *hwInfo) { +void HwInfoConfigHw::enableCompression(HardwareInfo *hwInfo) const { hwInfo->capabilityTable.ftrRenderCompressedImages = hwInfo->featureTable.flags.ftrE2ECompression; hwInfo->capabilityTable.ftrRenderCompressedBuffers = hwInfo->featureTable.flags.ftrE2ECompression; } diff --git a/shared/source/xe_hp_core/linux/hw_info_config_xe_hp_sdv.cpp b/shared/source/xe_hp_core/linux/hw_info_config_xe_hp_sdv.cpp index 0a32c6eb16..abda82b257 100644 --- a/shared/source/xe_hp_core/linux/hw_info_config_xe_hp_sdv.cpp +++ b/shared/source/xe_hp_core/linux/hw_info_config_xe_hp_sdv.cpp @@ -31,7 +31,7 @@ const std::map> guidUuidOffsetMap = { #include "shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (allowCompression(*hwInfo)) { enableCompression(hwInfo); } diff --git a/shared/source/xe_hp_core/windows/hw_info_config_xe_hp_sdv.cpp b/shared/source/xe_hp_core/windows/hw_info_config_xe_hp_sdv.cpp index 1ee4e2e17d..919ee0972c 100644 --- a/shared/source/xe_hp_core/windows/hw_info_config_xe_hp_sdv.cpp +++ b/shared/source/xe_hp_core/windows/hw_info_config_xe_hp_sdv.cpp @@ -22,7 +22,7 @@ constexpr static auto gfxProduct = IGFX_XE_HP_SDV; #include "shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (allowCompression(*hwInfo)) { enableCompression(hwInfo); } diff --git a/shared/source/xe_hpc_core/linux/hw_info_config_xe_hpc_core.inl b/shared/source/xe_hpc_core/linux/hw_info_config_xe_hpc_core.inl index 4867377293..5353eff47c 100644 --- a/shared/source/xe_hpc_core/linux/hw_info_config_xe_hpc_core.inl +++ b/shared/source/xe_hpc_core/linux/hw_info_config_xe_hpc_core.inl @@ -11,7 +11,7 @@ namespace NEO { template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { enableCompression(hwInfo); hwInfo->featureTable.flags.ftr57bGPUAddressing = (hwInfo->capabilityTable.gpuAddressSpace == maxNBitValue(57)); diff --git a/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp b/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp index ff3b7a02ee..72ce0f8d0d 100644 --- a/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp +++ b/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp @@ -21,7 +21,7 @@ constexpr static auto gfxProduct = IGFX_PVC; #include "shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { enableCompression(hwInfo); enableBlitterOperationsSupport(hwInfo); diff --git a/shared/source/xe_hpg_core/linux/hw_info_config_dg2.cpp b/shared/source/xe_hpg_core/linux/hw_info_config_dg2.cpp index e4c69eba3b..973bb8d093 100644 --- a/shared/source/xe_hpg_core/linux/hw_info_config_dg2.cpp +++ b/shared/source/xe_hpg_core/linux/hw_info_config_dg2.cpp @@ -27,7 +27,7 @@ constexpr static auto gfxProduct = IGFX_DG2; #include "os_agnostic_hw_info_config_dg2_extra.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (allowCompression(*hwInfo)) { enableCompression(hwInfo); } diff --git a/shared/source/xe_hpg_core/windows/hw_info_config_dg2.cpp b/shared/source/xe_hpg_core/windows/hw_info_config_dg2.cpp index d6c4c9cf29..772b742e78 100644 --- a/shared/source/xe_hpg_core/windows/hw_info_config_dg2.cpp +++ b/shared/source/xe_hpg_core/windows/hw_info_config_dg2.cpp @@ -26,7 +26,7 @@ constexpr static auto gfxProduct = IGFX_DG2; #include "os_agnostic_hw_info_config_dg2_extra.inl" template <> -int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { if (allowCompression(*hwInfo)) { enableCompression(hwInfo); } diff --git a/shared/test/common/fixtures/device_fixture.cpp b/shared/test/common/fixtures/device_fixture.cpp index c11d358a88..72ce13a043 100644 --- a/shared/test/common/fixtures/device_fixture.cpp +++ b/shared/test/common/fixtures/device_fixture.cpp @@ -37,4 +37,9 @@ MockDevice *DeviceFixture::createWithUsDeviceIdRevId(unsigned short usDeviceId, hardwareInfo.platform.usRevId = usRevId; return MockDevice::createWithNewExecutionEnvironment(&hardwareInfo); } + +const HwInfoConfig &DeviceFixture::getHwInfoConfig() const { + return this->pDevice->getRootDeviceEnvironment().getHwInfoConfig(); +} + } // namespace NEO diff --git a/shared/test/common/fixtures/device_fixture.h b/shared/test/common/fixtures/device_fixture.h index eef9878169..7bbe02b71e 100644 --- a/shared/test/common/fixtures/device_fixture.h +++ b/shared/test/common/fixtures/device_fixture.h @@ -23,5 +23,6 @@ struct DeviceFixture { HardwareInfo hardwareInfo = {}; PLATFORM platformHelper = {}; const uint32_t rootDeviceIndex = 0u; + const HwInfoConfig &getHwInfoConfig() const; }; } // namespace NEO diff --git a/shared/test/common/helpers/mock_hw_info_config_hw.h b/shared/test/common/helpers/mock_hw_info_config_hw.h index 062dca6a5f..791ee79a76 100644 --- a/shared/test/common/helpers/mock_hw_info_config_hw.h +++ b/shared/test/common/helpers/mock_hw_info_config_hw.h @@ -17,7 +17,7 @@ struct MockHwInfoConfigHw : NEO::HwInfoConfigHw { bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override; bool getUuid(Device *device, std::array &uuid) const override; uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override; - int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) override; + int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const override; uint64_t getDeviceMemoryPhysicalSizeInBytes(const OSInterface *osIface, uint32_t subDeviceIndex) override; uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) override; uint32_t getL1CachePolicy(bool isDebuggerActive) const override; diff --git a/shared/test/common/helpers/mock_hw_info_config_hw.inl b/shared/test/common/helpers/mock_hw_info_config_hw.inl index 0f3c3cf3c4..6b54271d87 100644 --- a/shared/test/common/helpers/mock_hw_info_config_hw.inl +++ b/shared/test/common/helpers/mock_hw_info_config_hw.inl @@ -25,7 +25,7 @@ uint32_t MockHwInfoConfigHw::getSteppingFromHwRevId(const HardwareIn } template <> -int MockHwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { +int MockHwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const { FeatureTable *featureTable = &hwInfo->featureTable; featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 0; featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 0; diff --git a/shared/test/common/libult/CMakeLists.txt b/shared/test/common/libult/CMakeLists.txt index 6763c7bec9..a2fb4b3b2f 100644 --- a/shared/test/common/libult/CMakeLists.txt +++ b/shared/test/common/libult/CMakeLists.txt @@ -66,10 +66,13 @@ apply_macro_for_each_core_type("TESTED") append_sources_from_properties(neo_libult_common_SRCS_ENABLE_TESTED_HW NEO_SRCS_ENABLE_CORE) set(neo_libult_common_SRCS_LIB_ULT + ${NEO_SHARED_DIRECTORY}/gmm_helper/resource_info_impl.cpp + ${NEO_SHARED_TEST_DIRECTORY}/common/base_ult_config_listener.cpp + ${NEO_SHARED_TEST_DIRECTORY}/common/base_ult_config_listener.h ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/aub_command_stream_receiver_fixture.h ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/command_stream_receiver_fixture.cpp - ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/command_stream_receiver_fixture.inl ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/command_stream_receiver_fixture.h + ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/command_stream_receiver_fixture.inl ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/device_fixture.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/device_fixture.h ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/gmm_callbacks_fixture.h @@ -83,11 +86,12 @@ set(neo_libult_common_SRCS_LIB_ULT ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/mock_execution_environment_gmm_fixture.h ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/tbx_command_stream_fixture.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/tbx_command_stream_fixture.h + ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/debug_helpers.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/execution_environment_helper.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/execution_environment_helper.h - ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_binary_helper_hash_value.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_binary_helper.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_binary_helper.h + ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_binary_helper_hash_value.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_filename_helper.h ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_leak_listener.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_leak_listener.h @@ -115,15 +119,11 @@ set(neo_libult_common_SRCS_LIB_ULT ${NEO_SHARED_TEST_DIRECTORY}/common/libult/source_level_debugger_ult.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/libult/ult_aub_command_stream_receiver.h ${NEO_SHARED_TEST_DIRECTORY}/common/libult/ult_command_stream_receiver.h - ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_memory_manager.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_gmm_page_table_mngr.cpp + ${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_memory_manager.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/test_excludes.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/test_excludes.h - ${NEO_SHARED_TEST_DIRECTORY}/common/base_ult_config_listener.cpp - ${NEO_SHARED_TEST_DIRECTORY}/common/base_ult_config_listener.h - ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/debug_helpers.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/utilities/cpuintrinsics.cpp - ${NEO_SHARED_DIRECTORY}/gmm_helper/resource_info_impl.cpp ) if(TESTS_XEHP_AND_LATER) diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index ab04511289..fa3276182b 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -351,7 +351,7 @@ void HwInfoConfigHw::updateIddCommand(void *const commandPtr, uint } template <> -void HwInfoConfigHw::enableCompression(HardwareInfo *hwInfo) { +void HwInfoConfigHw::enableCompression(HardwareInfo *hwInfo) const { } template <> diff --git a/shared/test/unit_test/command_stream/get_devices_tests.cpp b/shared/test/unit_test/command_stream/get_devices_tests.cpp index 633de07f50..e6ed43ebd4 100644 --- a/shared/test/unit_test/command_stream/get_devices_tests.cpp +++ b/shared/test/unit_test/command_stream/get_devices_tests.cpp @@ -168,7 +168,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsForDepreca EXPECT_EQ(expectedDevices, exeEnv.rootDeviceEnvironments.size()); for (auto i = 0u; i < expectedDevices; i++) { hwInfo = exeEnv.rootDeviceEnvironments[i]->getHardwareInfo(); - + auto &hwConfig = exeEnv.rootDeviceEnvironments[i]->getHwInfoConfig(); switch (csrType) { case CSR_HW: case CSR_HW_WITH_AUB: @@ -197,8 +197,8 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsForDepreca hwInfoFromTable.workaroundTable = {}; hwInfoFromTable.gtSystemInfo = {}; hardwareInfoSetup[hwInfoFromTable.platform.eProductFamily](&hwInfoFromTable, true, 0x0); - HwInfoConfig *hwConfig = HwInfoConfig::get(hwInfoFromTable.platform.eProductFamily); - hwConfig->configureHardwareCustom(&hwInfoFromTable, nullptr); + + hwConfig.configureHardwareCustom(&hwInfoFromTable, nullptr); EXPECT_EQ(0, memcmp(&hwInfoFromTable.platform, &hwInfo->platform, sizeof(PLATFORM))); EXPECT_STREQ(hardwarePrefix[i], deprecatedAcronym.c_str()); @@ -238,6 +238,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsWhenCsrIsS EXPECT_EQ(expectedDevices, exeEnv.rootDeviceEnvironments.size()); for (auto i = 0u; i < expectedDevices; i++) { hwInfo = exeEnv.rootDeviceEnvironments[i]->getHardwareInfo(); + auto &hwConfig = exeEnv.rootDeviceEnvironments[i]->getHwInfoConfig(); switch (csrType) { case CSR_HW: @@ -256,9 +257,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsWhenCsrIsS expectedHwInfo.workaroundTable = {}; expectedHwInfo.gtSystemInfo = {}; hardwareInfoSetup[expectedHwInfo.platform.eProductFamily](&expectedHwInfo, true, 0x0); - - HwInfoConfig *hwConfig = HwInfoConfig::get(expectedHwInfo.platform.eProductFamily); - hwConfig->configureHardwareCustom(&expectedHwInfo, nullptr); + hwConfig.configureHardwareCustom(&expectedHwInfo, nullptr); const auto &compilerHwInfoConfig = *NEO::CompilerHwInfoConfig::get(expectedHwInfo.platform.eProductFamily); compilerHwInfoConfig.setProductConfigForHwInfo(expectedHwInfo, deviceAot.aotConfig); @@ -322,6 +321,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown EXPECT_EQ(expectedDevices, exeEnv.rootDeviceEnvironments.size()); for (auto i = 0u; i < expectedDevices; i++) { hwInfo = exeEnv.rootDeviceEnvironments[i]->getHardwareInfo(); + auto &hwConfig = exeEnv.rootDeviceEnvironments[i]->getHwInfoConfig(); switch (csrType) { case CSR_HW: @@ -347,8 +347,8 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown baseHwInfo.workaroundTable = {}; baseHwInfo.gtSystemInfo = {}; hardwareInfoSetup[baseHwInfo.platform.eProductFamily](&baseHwInfo, true, 0x0); - HwInfoConfig *hwConfig = HwInfoConfig::get(baseHwInfo.platform.eProductFamily); - hwConfig->configureHardwareCustom(&baseHwInfo, nullptr); + + hwConfig.configureHardwareCustom(&baseHwInfo, nullptr); EXPECT_EQ(0, memcmp(&baseHwInfo.platform, &hwInfo->platform, sizeof(PLATFORM))); break; } diff --git a/shared/test/unit_test/gen12lp/dg1/linux/hw_info_config_tests_dg1.cpp b/shared/test/unit_test/gen12lp/dg1/linux/hw_info_config_tests_dg1.cpp index a9751f4b92..aed0e505b3 100644 --- a/shared/test/unit_test/gen12lp/dg1/linux/hw_info_config_tests_dg1.cpp +++ b/shared/test/unit_test/gen12lp/dg1/linux/hw_info_config_tests_dg1.cpp @@ -9,24 +9,25 @@ #include "shared/source/gen12lp/hw_cmds_dg1.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/os_interface.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/gtest_helpers.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" #include "shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h" -using HwInfoConfigTestLinuxDg1 = ::testing::Test; +using HwInfoConfigTestLinuxDg1 = Test; using namespace NEO; DG1TEST_F(HwInfoConfigTestLinuxDg1, GivenDG1WhenConfigureHardwareCustomThenMTPIsNotSet) { HardwareInfo hardwareInfo = *defaultHwInfo; - HwInfoConfig *hwInfoConfig = HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + auto &hwInfoConfig = getHwInfoConfig(); OSInterface osIface; hardwareInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::ThreadGroup; PreemptionHelper::adjustDefaultPreemptionMode(hardwareInfo.capabilityTable, true, true, true); - hwInfoConfig->configureHardwareCustom(&hardwareInfo, &osIface); + hwInfoConfig.configureHardwareCustom(&hardwareInfo, &osIface); EXPECT_FALSE(hardwareInfo.featureTable.flags.ftrGpGpuMidThreadLevelPreempt); } diff --git a/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp b/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp index fcef4b5ff2..ad2b849879 100644 --- a/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp +++ b/shared/test/unit_test/gen12lp/dg1/test_hw_info_config_dg1.cpp @@ -8,6 +8,7 @@ #include "shared/source/gen12lp/hw_cmds_dg1.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" @@ -16,7 +17,7 @@ using namespace NEO; -using Dg1HwInfoConfig = ::testing::Test; +using Dg1HwInfoConfig = Test; DG1TEST_F(Dg1HwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) { HardwareInfo hwInfo = *defaultHwInfo; @@ -32,20 +33,20 @@ DG1TEST_F(Dg1HwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpe } DG1TEST_F(Dg1HwInfoConfig, givenA0SteppingAndDg1PlatformWhenAskingIfWAIsRequiredThenReturnTrue) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); std::array, 2> revisions = { {{REVISION_A0, true}, {REVISION_B, false}}}; for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); - EXPECT_EQ(paramBool, hwInfoConfig->pipeControlWARequired(hwInfo)); - EXPECT_EQ(paramBool, hwInfoConfig->imagePitchAlignmentWARequired(hwInfo)); - EXPECT_EQ(paramBool, hwInfoConfig->isForceEmuInt32DivRemSPWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.pipeControlWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.imagePitchAlignmentWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isForceEmuInt32DivRemSPWARequired(hwInfo)); } } @@ -109,8 +110,8 @@ DG1TEST_F(Dg1HwInfo, whenPlatformIsDg1ThenExpectSvmIsSet) { EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm); } -DG1TEST_F(Dg1HwInfo, whenConfigureHwInfoThenBlitterSupportIsEnabled) { - auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); +DG1TEST_F(Dg1HwInfoConfig, whenConfigureHwInfoThenBlitterSupportIsEnabled) { + auto &hwInfoConfig = getHwInfoConfig(); auto hardwareInfo = *defaultHwInfo; hardwareInfo.capabilityTable.blitterOperationsSupported = false; diff --git a/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp b/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp index 8bce9b5481..7d4b17b209 100644 --- a/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp +++ b/shared/test/unit_test/gen12lp/rkl/test_hw_info_config_rkl.cpp @@ -9,6 +9,7 @@ #include "shared/source/helpers/compiler_hw_info_config.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" @@ -118,10 +119,10 @@ RKLTEST_F(RklHwInfo, givenHwInfoConfigWhenGetCommandsStreamPropertiesSupportThen EXPECT_FALSE(hwInfoConfig.getPipelineSelectPropertySystolicModeSupport()); } -using RklHwInfoConfig = ::testing::Test; +using RklHwInfoConfig = Test; RKLTEST_F(RklHwInfoConfig, givenA0OrBSteppingAndRklPlatformWhenAskingIfWAIsRequiredThenReturnTrue) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); std::array, 3> revisions = { {{REVISION_A0, true}, {REVISION_B, true}, @@ -129,11 +130,11 @@ RKLTEST_F(RklHwInfoConfig, givenA0OrBSteppingAndRklPlatformWhenAskingIfWAIsRequi for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); - EXPECT_EQ(paramBool, hwInfoConfig->isForceEmuInt32DivRemSPWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isForceEmuInt32DivRemSPWARequired(hwInfo)); } } diff --git a/shared/test/unit_test/gen12lp/tgllp/hw_info_config_tests_tgllp.cpp b/shared/test/unit_test/gen12lp/tgllp/hw_info_config_tests_tgllp.cpp index 4ea4a2067b..35de855c17 100644 --- a/shared/test/unit_test/gen12lp/tgllp/hw_info_config_tests_tgllp.cpp +++ b/shared/test/unit_test/gen12lp/tgllp/hw_info_config_tests_tgllp.cpp @@ -8,6 +8,7 @@ #include "shared/source/gen12lp/hw_cmds_tgllp.h" #include "shared/source/os_interface/device_factory.h" #include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/mocks/mock_execution_environment.h" @@ -18,7 +19,7 @@ using namespace NEO; -using HwInfoConfigTestTgllp = ::testing::Test; +using HwInfoConfigTestTgllp = Test; TGLLPTEST_F(HwInfoConfigTestTgllp, givenHwInfoConfigWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { HardwareInfo hwInfo = *defaultHwInfo; @@ -90,7 +91,7 @@ TGLLPTEST_F(HwInfoConfigTestTgllp, whenUsingCorrectConfigValueThenCorrectHwInfoI } TGLLPTEST_F(HwInfoConfigTestTgllp, givenA0SteppingAndTgllpPlatformWhenAskingIfWAIsRequiredThenReturnTrue) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); std::array, 3> revisions = { {{REVISION_A0, true}, {REVISION_B, false}, @@ -98,13 +99,12 @@ TGLLPTEST_F(HwInfoConfigTestTgllp, givenA0SteppingAndTgllpPlatformWhenAskingIfWA for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); - - EXPECT_EQ(paramBool, hwInfoConfig->pipeControlWARequired(hwInfo)); - EXPECT_EQ(paramBool, hwInfoConfig->imagePitchAlignmentWARequired(hwInfo)); - EXPECT_EQ(paramBool, hwInfoConfig->isForceEmuInt32DivRemSPWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.pipeControlWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.imagePitchAlignmentWARequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isForceEmuInt32DivRemSPWARequired(hwInfo)); } } diff --git a/shared/test/unit_test/gen12lp/windows/hw_info_config_tests_gen12lp.cpp b/shared/test/unit_test/gen12lp/windows/hw_info_config_tests_gen12lp.cpp index 1caa48c5a7..ca3c206e78 100644 --- a/shared/test/unit_test/gen12lp/windows/hw_info_config_tests_gen12lp.cpp +++ b/shared/test/unit_test/gen12lp/windows/hw_info_config_tests_gen12lp.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/os_interface/os_interface.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/libult/gen12lp/special_ult_helper_gen12lp.h" @@ -17,15 +18,15 @@ using HwInfoConfigTestWindowsGen12lp = HwInfoConfigTestWindows; GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenE2ECSetByKmdWhenConfiguringHwThenAdjustInternalImageFlag) { FeatureTable &localFeatureTable = outHwInfo.featureTable; - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = rootDeviceEnvironment->getHwInfoConfig(); localFeatureTable.flags.ftrE2ECompression = true; - hwInfoConfig->configureHardwareCustom(&outHwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&outHwInfo, nullptr); EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages); localFeatureTable.flags.ftrE2ECompression = false; - hwInfoConfig->configureHardwareCustom(&outHwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&outHwInfo, nullptr); EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages); } diff --git a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp index 4d846c9560..19f0afeaf4 100644 --- a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp @@ -39,16 +39,13 @@ TEST_F(HwInfoConfigTestLinuxDummy, GivenDummyConfigWhenConfiguringHwInfoThenSucc int ret = hwConfig.configureHwInfoDrm(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); } -using HwInfoConfigCommonLinuxTest = ::testing::Test; -HWTEST2_F(HwInfoConfigCommonLinuxTest, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenIgnore, IsAtMostGen11) { +HWTEST2_F(HwInfoConfigTestLinuxDummy, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenIgnore, IsAtMostGen11) { DebugManagerStateRestore restore{}; HardwareInfo hardwareInfo = *defaultHwInfo; - auto hwInfoConfig = HwInfoConfig::get(hardwareInfo.platform.eProductFamily); - DebugManager.flags.EnableBlitterOperationsSupport.set(1); - hwInfoConfig->configureHardwareCustom(&hardwareInfo, nullptr); + hwConfig.configureHardwareCustom(&hardwareInfo, nullptr); EXPECT_FALSE(hardwareInfo.capabilityTable.blitterOperationsSupported); } diff --git a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h index 51e0a73c64..03cc6c9210 100644 --- a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h +++ b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h @@ -55,6 +55,10 @@ struct HwInfoConfigTestLinux : public HwInfoConfigTest { HwInfoConfigTest::TearDown(); } + const HwInfoConfig &getHwInfoConfig() { + return executionEnvironment->rootDeviceEnvironments[0]->getHwInfoConfig(); + } + OSInterface *osInterface; std::unique_ptr executionEnvironment; DrmMock *drm; diff --git a/shared/test/unit_test/xe_hp_core/xe_hp_sdv/linux/hw_info_config_tests_xe_hp_sdv.cpp b/shared/test/unit_test/xe_hp_core/xe_hp_sdv/linux/hw_info_config_tests_xe_hp_sdv.cpp index 97c4c78044..7477a5774f 100644 --- a/shared/test/unit_test/xe_hp_core/xe_hp_sdv/linux/hw_info_config_tests_xe_hp_sdv.cpp +++ b/shared/test/unit_test/xe_hp_core/xe_hp_sdv/linux/hw_info_config_tests_xe_hp_sdv.cpp @@ -29,9 +29,9 @@ XEHPTEST_F(HwInfoConfigTestLinuxXeHp, WhenConfiguringHwInfoThenZeroIsReturned) { } XEHPTEST_F(HwInfoConfigTestLinuxXeHp, GivenXeHpSdvWhenConfigureHardwareCustomThenKmdNotifyIsEnabled) { - HwInfoConfig *hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); - hwInfoConfig->configureHardwareCustom(&pInHwInfo, osInterface); + hwInfoConfig.configureHardwareCustom(&pInHwInfo, osInterface); EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify); EXPECT_EQ(150ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp index c9b364bb7f..9d04966ff1 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/linux/hw_info_config_tests_pvc.cpp @@ -35,27 +35,27 @@ PVCTEST_F(HwInfoConfigTestLinuxPvc, WhenConfiguringHwInfoThenZeroIsReturned) { } PVCTEST_F(HwInfoConfigTestLinuxPvc, given57bAddressSpaceWhenConfiguringHwInfoThenSetFtrFlag) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); outHwInfo.featureTable.flags.ftr57bGPUAddressing = false; outHwInfo.platform.eRenderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily; outHwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(48); - int ret = hwInfoConfig->configureHardwareCustom(&outHwInfo, osInterface); + int ret = hwInfoConfig.configureHardwareCustom(&outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_FALSE(outHwInfo.featureTable.flags.ftr57bGPUAddressing); outHwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(57); - ret = hwInfoConfig->configureHardwareCustom(&outHwInfo, osInterface); + ret = hwInfoConfig.configureHardwareCustom(&outHwInfo, osInterface); EXPECT_EQ(0, ret); auto value = outHwInfo.featureTable.flags.ftr57bGPUAddressing; EXPECT_EQ(1u, value); } PVCTEST_F(HwInfoConfigTestLinuxPvc, GivenPvcWhenConfigureHardwareCustomThenKmdNotifyIsEnabled) { - HwInfoConfig *hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); OSInterface osIface; - hwInfoConfig->configureHardwareCustom(&pInHwInfo, &osIface); + hwInfoConfig.configureHardwareCustom(&pInHwInfo, &osIface); EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify); EXPECT_EQ(150ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp index 9502eafe1d..aef8268a6e 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp @@ -9,6 +9,7 @@ #include "shared/source/helpers/constants.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/source/xe_hpc_core/hw_cmds_pvc.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/gtest_helpers.h" @@ -18,7 +19,7 @@ using namespace NEO; -using PvcHwInfoConfig = ::testing::Test; +using PvcHwInfoConfig = Test; PVCTEST_F(PvcHwInfoConfig, givenPVCRevId3AndAboveWhenGettingThreadEuRatioForScratchThen16IsReturned) { const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); @@ -185,10 +186,10 @@ PVCTEST_F(PvcHwInfoConfig, givenHwInfoConfigAndProgramExtendedPipeControlPriorTo } PVCTEST_F(PvcHwInfoConfig, givenPvcWhenConfiguringThenDisableCccs) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_FALSE(hwInfo.featureTable.flags.ftrRcsNode); } @@ -196,10 +197,10 @@ PVCTEST_F(PvcHwInfoConfig, givenDebugVariableSetWhenConfiguringThenEnableCccs) { DebugManagerStateRestore restore; DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_CCCS)); - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode); } diff --git a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp index 79676e12c0..f5e19f6df6 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp @@ -9,6 +9,7 @@ #include "shared/source/helpers/constants.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/fixtures/device_fixture.h" #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" @@ -17,7 +18,7 @@ using namespace NEO; -using HwInfoConfigTestDg2 = ::testing::Test; +using HwInfoConfigTestDg2 = Test; DG2TEST_F(HwInfoConfigTestDg2, givenDg2ConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) { HardwareInfo hwInfo = *defaultHwInfo; @@ -122,7 +123,7 @@ DG2TEST_F(HwInfoConfigTestDg2, whenAdjustingDefaultEngineTypeThenSelectEngineTyp } DG2TEST_F(HwInfoConfigTestDg2, givenA0OrA1SteppingWhenAskingIfWAIsRequiredThenReturnTrue) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); std::array, 4> revisions = { {{REVISION_A0, true}, {REVISION_A1, true}, @@ -131,13 +132,13 @@ DG2TEST_F(HwInfoConfigTestDg2, givenA0OrA1SteppingWhenAskingIfWAIsRequiredThenRe for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); - EXPECT_EQ(paramBool, hwInfoConfig->isDefaultEngineTypeAdjustmentRequired(hwInfo)); - EXPECT_EQ(paramBool, hwInfoConfig->isAllocationSizeAdjustmentRequired(hwInfo)); - EXPECT_EQ(paramBool, hwInfoConfig->isPrefetchDisablingRequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isDefaultEngineTypeAdjustmentRequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isAllocationSizeAdjustmentRequired(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isPrefetchDisablingRequired(hwInfo)); } } @@ -237,7 +238,7 @@ DG2TEST_F(HwInfoConfigTestDg2, givenDg2WhenIsBlitterForImagesSupportedIsCalledTh } DG2TEST_F(HwInfoConfigTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurfaceOnBCSIsSupportedThenReturnTrue) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); std::array, 4> revisions = { {{REVISION_A0, false}, {REVISION_A1, false}, @@ -246,32 +247,32 @@ DG2TEST_F(HwInfoConfigTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurfaceO for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); - EXPECT_EQ(paramBool, hwInfoConfig->isTile64With3DSurfaceOnBCSSupported(hwInfo)); + EXPECT_EQ(paramBool, hwInfoConfig.isTile64With3DSurfaceOnBCSSupported(hwInfo)); } } DG2TEST_F(HwInfoConfigTestDg2, givenA0SteppingAnd128EuWhenConfigureCalledThenDisableCompression) { - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); for (uint8_t revision : {REVISION_A0, REVISION_A1}) { for (uint32_t euCount : {127, 128, 129}) { HardwareInfo hwInfo = *defaultHwInfo; hwInfo.featureTable.flags.ftrE2ECompression = true; - hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); hwInfo.gtSystemInfo.EUCount = euCount; - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); auto compressionExpected = (euCount == 128) ? true : (revision != REVISION_A0); EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedImages); - EXPECT_EQ(compressionExpected, hwInfoConfig->allowCompression(hwInfo)); + EXPECT_EQ(compressionExpected, hwInfoConfig.allowCompression(hwInfo)); } } } diff --git a/shared/test/unit_test/xe_hpg_core/dg2/linux/hw_info_config_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/linux/hw_info_config_tests_dg2.cpp index dceb15edcd..e6e9c80fdc 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/linux/hw_info_config_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/linux/hw_info_config_tests_dg2.cpp @@ -29,10 +29,10 @@ DG2TEST_F(HwInfoConfigTestLinuxDg2, WhenConfiguringHwInfoThenZeroIsReturned) { } DG2TEST_F(HwInfoConfigTestLinuxDg2, GivenDg2WhenConfigureHardwareCustomThenKmdNotifyIsEnabled) { - HwInfoConfig *hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); OSInterface osIface; - hwInfoConfig->configureHardwareCustom(&pInHwInfo, &osIface); + hwInfoConfig.configureHardwareCustom(&pInHwInfo, &osIface); EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify); EXPECT_EQ(150ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission); diff --git a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp index 16fc1839c4..662a5b47ec 100644 --- a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp @@ -9,6 +9,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/cmd_parse/hw_parse.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/helpers/unit_test_helper.h" @@ -50,20 +51,20 @@ XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenDebugFlagWhenCheckingIfBufferIsSui } } -using HwInfoConfigTestXeHpgCore = ::testing::Test; +using HwInfoConfigTestXeHpgCore = Test; XE_HPG_CORETEST_F(HwInfoConfigTestXeHpgCore, givenDebugVariableSetWhenConfigureIsCalledThenSetupBlitterOperationsSupportedFlag) { DebugManagerStateRestore restore; - auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto &hwInfoConfig = getHwInfoConfig(); HardwareInfo hwInfo = *defaultHwInfo; DebugManager.flags.EnableBlitterOperationsSupport.set(0); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_FALSE(hwInfo.capabilityTable.blitterOperationsSupported); DebugManager.flags.EnableBlitterOperationsSupport.set(1); - hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr); + hwInfoConfig.configureHardwareCustom(&hwInfo, nullptr); EXPECT_TRUE(hwInfo.capabilityTable.blitterOperationsSupported); }