From 5af95098772981bc6e26bddf4b7c880368a7815e Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Thu, 23 Feb 2023 12:54:58 +0000 Subject: [PATCH] Correct scope of WA for pipecontrol before nonpipelined state - for DG2 platforms it is valid only for G10/G11/G12 - for MTL platforms it is valid only for 12.70.0 and 12.71.0 Additionally: - setup default hw ip version for each platform - merge dg2 specific product helper tests to single file Related-To: HSD-14015808183, HSD-14015812625, HSD-14016015202 Related-To: HSD-14015812559, HSD-14015816823 Signed-off-by: Mateusz Jablonski --- ...st_metric_ip_sampling_linux_pvc_prelim.cpp | 2 +- opencl/test/unit_test/device/device_tests.cpp | 4 +- .../unit_test/xe_hpg_core/mtl/CMakeLists.txt | 3 +- .../mtl/cl_gfx_core_helper_tests_mtl.cpp | 42 + .../xe_hpg_core/mtl/excludes_ocl_mtl.cpp | 3 +- shared/source/gen11/hw_info_ehl.cpp | 3 +- shared/source/gen11/hw_info_icllp.cpp | 7 +- shared/source/gen11/hw_info_lkf.cpp | 3 +- shared/source/gen12lp/hw_info_adln.cpp | 3 +- shared/source/gen12lp/hw_info_adlp.cpp | 3 +- shared/source/gen12lp/hw_info_adls.cpp | 3 +- shared/source/gen12lp/hw_info_dg1.cpp | 3 +- shared/source/gen12lp/hw_info_rkl.cpp | 3 +- shared/source/gen12lp/hw_info_tgllp.cpp | 5 +- shared/source/gen8/hw_info_bdw.cpp | 9 +- shared/source/gen9/hw_info_bxt.cpp | 5 +- shared/source/gen9/hw_info_cfl.cpp | 11 +- shared/source/gen9/hw_info_glk.cpp | 5 +- shared/source/gen9/hw_info_kbl.cpp | 11 +- shared/source/gen9/hw_info_skl.cpp | 11 +- shared/source/helpers/hw_info.cpp | 4 +- shared/source/helpers/hw_info.h | 2 +- shared/source/helpers/hw_ip_version.h | 4 +- shared/source/xe_hpc_core/hw_info_pvc.cpp | 3 +- .../definitions/hw_info_setup_mtl.inl | 6 +- .../dg2/os_agnostic_product_helper_dg2.inl | 5 +- shared/source/xe_hpg_core/hw_info_dg2.cpp | 3 +- shared/source/xe_hpg_core/hw_info_mtl.cpp | 6 +- .../mtl/os_agnostic_product_helper_mtl.inl | 2 +- .../test/unit_test/aub/aub_helper_tests.cpp | 2 +- .../unit_test/xe_hpg_core/dg2/CMakeLists.txt | 3 +- .../dg2/hw_info_config_tests_dg2.cpp | 645 ---------------- .../dg2/product_config_helper_tests_dg2.cpp | 731 +++++++++++++++++- .../mtl/gfx_core_helper_tests_mtl.cpp | 2 + .../mtl/hw_info_config_tests_mtl.cpp | 31 +- 35 files changed, 853 insertions(+), 735 deletions(-) create mode 100644 opencl/test/unit_test/xe_hpg_core/mtl/cl_gfx_core_helper_tests_mtl.cpp delete mode 100644 shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp diff --git a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp index 9bdf620d52..182680a1b1 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp @@ -44,7 +44,7 @@ class DrmPrelimMock : public DrmMock { DrmPrelimMock(RootDeviceEnvironment &rootDeviceEnvironment) : DrmPrelimMock(rootDeviceEnvironment, defaultHwInfo.get()) {} DrmPrelimMock(RootDeviceEnvironment &rootDeviceEnvironment, HardwareInfo *inputHwInfo, bool invokeQueryEngineInfo = true) : DrmMock(rootDeviceEnvironment) { customHwInfo = std::make_unique(&inputHwInfo->platform, &inputHwInfo->featureTable, - &inputHwInfo->workaroundTable, &inputHwInfo->gtSystemInfo, inputHwInfo->capabilityTable); + &inputHwInfo->workaroundTable, &inputHwInfo->gtSystemInfo, inputHwInfo->capabilityTable, 0u); customHwInfo->gtSystemInfo.MaxDualSubSlicesSupported = 64; rootDeviceEnvironment.setHwInfoAndInitHelpers(customHwInfo.get()); this->ioctlHelper = std::make_unique(*this); diff --git a/opencl/test/unit_test/device/device_tests.cpp b/opencl/test/unit_test/device/device_tests.cpp index b60f2babfb..9d2ebba04e 100644 --- a/opencl/test/unit_test/device/device_tests.cpp +++ b/opencl/test/unit_test/device/device_tests.cpp @@ -736,7 +736,7 @@ TEST(ClDeviceHelperTest, givenNonZeroNumberOfTilesWhenPrepareDeviceEnvironmentsC sysInfo.MultiTileArchInfo.IsValid = true; sysInfo.MultiTileArchInfo.TileCount = 3; PLATFORM platform = {}; - HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable}; + HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable, {}}; DebugManager.flags.CreateMultipleSubDevices.set(0); uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(&hwInfo); @@ -752,7 +752,7 @@ TEST(ClDeviceHelperTest, givenZeroNumberOfTilesWhenPrepareDeviceEnvironmentsCoun sysInfo.MultiTileArchInfo.IsValid = true; sysInfo.MultiTileArchInfo.TileCount = 0; PLATFORM platform = {}; - HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable}; + HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable, {}}; DebugManager.flags.CreateMultipleSubDevices.set(0); uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(&hwInfo); diff --git a/opencl/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt b/opencl/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt index bc090da176..f02bd0ebe3 100644 --- a/opencl/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt +++ b/opencl/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2022 Intel Corporation +# Copyright (C) 2022-2023 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -13,6 +13,7 @@ if(TESTS_MTL) set(IGDRCL_SRCS_tests_xe_hpg_core_mtl ${IGDRCL_SRCS_tests_xe_hpg_core_mtl_excludes} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/cl_gfx_core_helper_tests_mtl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_mtl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/image_tests_mtl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_cl_device_caps_mtl.cpp diff --git a/opencl/test/unit_test/xe_hpg_core/mtl/cl_gfx_core_helper_tests_mtl.cpp b/opencl/test/unit_test/xe_hpg_core/mtl/cl_gfx_core_helper_tests_mtl.cpp new file mode 100644 index 0000000000..9de26843e1 --- /dev/null +++ b/opencl/test/unit_test/xe_hpg_core/mtl/cl_gfx_core_helper_tests_mtl.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/execution_environment/root_device_environment.h" +#include "shared/source/xe_hpg_core/hw_cmds_mtl.h" +#include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/helpers/variable_backup.h" +#include "shared/test/common/test_macros/header/per_product_test_definitions.h" +#include "shared/test/common/test_macros/test.h" + +#include "opencl/extensions/public/cl_ext_private.h" +#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" +#include "opencl/test/unit_test/mocks/mock_cl_gfx_core_helper.h" + +using namespace NEO; + +using ClGfxCoreHelperTestsMtl = Test; + +MTLTEST_F(ClGfxCoreHelperTestsMtl, givenVariousMtlReleasesWhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) { + auto &hwInfo = *getRootDeviceEnvironment().getMutableHardwareInfo(); + unsigned int releases[] = {70, 71, 72, 73}; + hwInfo.ipVersion.architecture = 12; + + cl_device_feature_capabilities_intel expectedCapabilitiesIfNotLpg = CL_DEVICE_FEATURE_FLAG_DPAS_INTEL | CL_DEVICE_FEATURE_FLAG_DP4A_INTEL; + cl_device_feature_capabilities_intel expectedgCapabilitiesIfLpg = CL_DEVICE_FEATURE_FLAG_DP4A_INTEL; + auto &clGfxCoreHelper = getHelper(); + + for (auto release : releases) { + hwInfo.ipVersion.release = release; + EXPECT_EQ(MTL::isLpg(hwInfo) ? expectedgCapabilitiesIfLpg : expectedCapabilitiesIfNotLpg, clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(getRootDeviceEnvironment())); + } + + hwInfo.ipVersion.architecture = 13; + for (auto gmdRelease : releases) { + hwInfo.ipVersion.release = gmdRelease; + EXPECT_EQ(expectedCapabilitiesIfNotLpg, clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(getRootDeviceEnvironment())); + } +} diff --git a/opencl/test/unit_test/xe_hpg_core/mtl/excludes_ocl_mtl.cpp b/opencl/test/unit_test/xe_hpg_core/mtl/excludes_ocl_mtl.cpp index f5d9e8a15c..654530f70b 100644 --- a/opencl/test/unit_test/xe_hpg_core/mtl/excludes_ocl_mtl.cpp +++ b/opencl/test/unit_test/xe_hpg_core/mtl/excludes_ocl_mtl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,3 +10,4 @@ HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverFlushTaskDg2AndLaterTests, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenPerDssBackedBufferThenThereIsPipeControlPriorToIt_MatcherIsRTCapable, IGFX_METEORLAKE); HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverFlushTaskXeHPAndLaterTests, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledAndStateSipWhenItIsRequiredThenThereIsPipeControlPriorToIt, IGFX_METEORLAKE); HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverFlushTaskXeHPAndLaterTests, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledAndStateBaseAddressWhenItIsRequiredThenThereIsPipeControlPriorToIt, IGFX_METEORLAKE); +HWTEST_EXCLUDE_PRODUCT(ClGfxCoreHelperTestXeHpAndLater, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue_IsAtLeastXeHpCore, IGFX_METEORLAKE); diff --git a/shared/source/gen11/hw_info_ehl.cpp b/shared/source/gen11/hw_info_ehl.cpp index a81f166b2a..ab2467c824 100644 --- a/shared/source/gen11/hw_info_ehl.cpp +++ b/shared/source/gen11/hw_info_ehl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -135,7 +136,7 @@ const HardwareInfo EhlHwConfig::hwInfo = { &EHL::workaroundTable, &EhlHwConfig::gtSystemInfo, EHL::capabilityTable, -}; + AOT::EHL}; GT_SYSTEM_INFO EhlHwConfig::gtSystemInfo = {0}; void EhlHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen11/hw_info_icllp.cpp b/shared/source/gen11/hw_info_icllp.cpp index edc132f0c1..918715fcf5 100644 --- a/shared/source/gen11/hw_info_icllp.cpp +++ b/shared/source/gen11/hw_info_icllp.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -135,7 +136,7 @@ const HardwareInfo IcllpHw1x8x8::hwInfo = { &ICLLP::workaroundTable, &IcllpHw1x8x8::gtSystemInfo, ICLLP::capabilityTable, -}; + AOT::ICL}; GT_SYSTEM_INFO IcllpHw1x8x8::gtSystemInfo = {0}; void IcllpHw1x8x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -157,7 +158,7 @@ const HardwareInfo IcllpHw1x4x8::hwInfo = { &ICLLP::workaroundTable, &IcllpHw1x4x8::gtSystemInfo, ICLLP::capabilityTable, -}; + AOT::ICL}; GT_SYSTEM_INFO IcllpHw1x4x8::gtSystemInfo = {0}; void IcllpHw1x4x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -176,7 +177,7 @@ const HardwareInfo IcllpHw1x6x8::hwInfo = { &ICLLP::workaroundTable, &IcllpHw1x6x8::gtSystemInfo, ICLLP::capabilityTable, -}; + AOT::ICL}; GT_SYSTEM_INFO IcllpHw1x6x8::gtSystemInfo = {0}; void IcllpHw1x6x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen11/hw_info_lkf.cpp b/shared/source/gen11/hw_info_lkf.cpp index b8b1c2e711..3e2fc5b40b 100644 --- a/shared/source/gen11/hw_info_lkf.cpp +++ b/shared/source/gen11/hw_info_lkf.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -135,7 +136,7 @@ const HardwareInfo LkfHw1x8x8::hwInfo = { &LKF::workaroundTable, &LkfHw1x8x8::gtSystemInfo, LKF::capabilityTable, -}; + AOT::LKF}; GT_SYSTEM_INFO LkfHw1x8x8::gtSystemInfo = {0}; void LkfHw1x8x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { LKF::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); diff --git a/shared/source/gen12lp/hw_info_adln.cpp b/shared/source/gen12lp/hw_info_adln.cpp index 61c8e13d5f..bdc3f15026 100644 --- a/shared/source/gen12lp/hw_info_adln.cpp +++ b/shared/source/gen12lp/hw_info_adln.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -133,7 +134,7 @@ const HardwareInfo AdlnHwConfig::hwInfo = { &ADLN::workaroundTable, &AdlnHwConfig::gtSystemInfo, ADLN::capabilityTable, -}; + AOT::ADL_N}; GT_SYSTEM_INFO AdlnHwConfig::gtSystemInfo = {0}; void AdlnHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen12lp/hw_info_adlp.cpp b/shared/source/gen12lp/hw_info_adlp.cpp index 03b36ba55c..678f43ed6d 100644 --- a/shared/source/gen12lp/hw_info_adlp.cpp +++ b/shared/source/gen12lp/hw_info_adlp.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -134,7 +135,7 @@ const HardwareInfo AdlpHwConfig::hwInfo = { &ADLP::workaroundTable, &AdlpHwConfig::gtSystemInfo, ADLP::capabilityTable, -}; + AOT::ADL_P}; GT_SYSTEM_INFO AdlpHwConfig::gtSystemInfo = {0}; void AdlpHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen12lp/hw_info_adls.cpp b/shared/source/gen12lp/hw_info_adls.cpp index 340650bb7d..cd74ba867b 100644 --- a/shared/source/gen12lp/hw_info_adls.cpp +++ b/shared/source/gen12lp/hw_info_adls.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -134,7 +135,7 @@ const HardwareInfo AdlsHwConfig::hwInfo = { &ADLS::workaroundTable, &AdlsHwConfig::gtSystemInfo, ADLS::capabilityTable, -}; + AOT::ADL_S}; GT_SYSTEM_INFO AdlsHwConfig::gtSystemInfo = {0}; void AdlsHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen12lp/hw_info_dg1.cpp b/shared/source/gen12lp/hw_info_dg1.cpp index 43c18a9711..b508feb21e 100644 --- a/shared/source/gen12lp/hw_info_dg1.cpp +++ b/shared/source/gen12lp/hw_info_dg1.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -139,7 +140,7 @@ const HardwareInfo Dg1HwConfig::hwInfo = { &DG1::workaroundTable, &Dg1HwConfig::gtSystemInfo, DG1::capabilityTable, -}; + AOT::DG1}; GT_SYSTEM_INFO Dg1HwConfig::gtSystemInfo = {0}; void Dg1HwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen12lp/hw_info_rkl.cpp b/shared/source/gen12lp/hw_info_rkl.cpp index 900f9ac2a1..140adf236b 100644 --- a/shared/source/gen12lp/hw_info_rkl.cpp +++ b/shared/source/gen12lp/hw_info_rkl.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -137,7 +138,7 @@ const HardwareInfo RklHwConfig::hwInfo = { &RKL::workaroundTable, &RklHwConfig::gtSystemInfo, RKL::capabilityTable, -}; + AOT::RKL}; GT_SYSTEM_INFO RklHwConfig::gtSystemInfo = {0}; void RklHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen12lp/hw_info_tgllp.cpp b/shared/source/gen12lp/hw_info_tgllp.cpp index f942888241..1c2cb9930e 100644 --- a/shared/source/gen12lp/hw_info_tgllp.cpp +++ b/shared/source/gen12lp/hw_info_tgllp.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -134,7 +135,7 @@ const HardwareInfo TgllpHw1x6x16::hwInfo = { &TGLLP::workaroundTable, &TgllpHw1x6x16::gtSystemInfo, TGLLP::capabilityTable, -}; + AOT::TGL}; GT_SYSTEM_INFO TgllpHw1x6x16::gtSystemInfo = {0}; void TgllpHw1x6x16::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -162,7 +163,7 @@ const HardwareInfo TgllpHw1x2x16::hwInfo = { &TGLLP::workaroundTable, &TgllpHw1x2x16::gtSystemInfo, TGLLP::capabilityTable, -}; + AOT::TGL}; GT_SYSTEM_INFO TgllpHw1x2x16::gtSystemInfo = {0}; void TgllpHw1x2x16::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen8/hw_info_bdw.cpp b/shared/source/gen8/hw_info_bdw.cpp index 976e803e4c..7bd48f2d7d 100644 --- a/shared/source/gen8/hw_info_bdw.cpp +++ b/shared/source/gen8/hw_info_bdw.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -124,7 +125,7 @@ const HardwareInfo BdwHw1x2x6::hwInfo = { &BDW::workaroundTable, &BdwHw1x2x6::gtSystemInfo, BDW::capabilityTable, -}; + AOT::BDW}; GT_SYSTEM_INFO BdwHw1x2x6::gtSystemInfo = {0}; void BdwHw1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -143,7 +144,7 @@ const HardwareInfo BdwHw1x3x6::hwInfo = { &BDW::workaroundTable, &BdwHw1x3x6::gtSystemInfo, BDW::capabilityTable, -}; + AOT::BDW}; GT_SYSTEM_INFO BdwHw1x3x6::gtSystemInfo = {0}; void BdwHw1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { BDW::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -161,7 +162,7 @@ const HardwareInfo BdwHw1x3x8::hwInfo = { &BDW::workaroundTable, &BdwHw1x3x8::gtSystemInfo, BDW::capabilityTable, -}; + AOT::BDW}; GT_SYSTEM_INFO BdwHw1x3x8::gtSystemInfo = {0}; void BdwHw1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { BDW::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -179,7 +180,7 @@ const HardwareInfo BdwHw2x3x8::hwInfo = { &BDW::workaroundTable, &BdwHw2x3x8::gtSystemInfo, BDW::capabilityTable, -}; + AOT::BDW}; GT_SYSTEM_INFO BdwHw2x3x8::gtSystemInfo = {0}; void BdwHw2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { BDW::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); diff --git a/shared/source/gen9/hw_info_bxt.cpp b/shared/source/gen9/hw_info_bxt.cpp index 1a568d36d2..eb5b786678 100644 --- a/shared/source/gen9/hw_info_bxt.cpp +++ b/shared/source/gen9/hw_info_bxt.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -133,7 +134,7 @@ const HardwareInfo BxtHw1x2x6::hwInfo = { &BXT::workaroundTable, &BxtHw1x2x6::gtSystemInfo, BXT::capabilityTable, -}; + AOT::APL}; GT_SYSTEM_INFO BxtHw1x2x6::gtSystemInfo = {0}; void BxtHw1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { BXT::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -151,7 +152,7 @@ const HardwareInfo BxtHw1x3x6::hwInfo = { &BXT::workaroundTable, &BxtHw1x3x6::gtSystemInfo, BXT::capabilityTable, -}; + AOT::APL}; GT_SYSTEM_INFO BxtHw1x3x6::gtSystemInfo = {0}; void BxtHw1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { BXT::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); diff --git a/shared/source/gen9/hw_info_cfl.cpp b/shared/source/gen9/hw_info_cfl.cpp index 7fdfce6f02..5156dc0852 100644 --- a/shared/source/gen9/hw_info_cfl.cpp +++ b/shared/source/gen9/hw_info_cfl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -132,7 +133,7 @@ const HardwareInfo CflHw1x2x6::hwInfo = { &CFL::workaroundTable, &CflHw1x2x6::gtSystemInfo, CFL::capabilityTable, -}; + AOT::CFL}; GT_SYSTEM_INFO CflHw1x2x6::gtSystemInfo = {0}; void CflHw1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { CFL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -150,7 +151,7 @@ const HardwareInfo CflHw1x3x6::hwInfo = { &CFL::workaroundTable, &CflHw1x3x6::gtSystemInfo, CFL::capabilityTable, -}; + AOT::CFL}; GT_SYSTEM_INFO CflHw1x3x6::gtSystemInfo = {0}; void CflHw1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -169,7 +170,7 @@ const HardwareInfo CflHw1x3x8::hwInfo = { &CFL::workaroundTable, &CflHw1x3x8::gtSystemInfo, CFL::capabilityTable, -}; + AOT::CFL}; GT_SYSTEM_INFO CflHw1x3x8::gtSystemInfo = {0}; void CflHw1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -188,7 +189,7 @@ const HardwareInfo CflHw2x3x8::hwInfo = { &CFL::workaroundTable, &CflHw2x3x8::gtSystemInfo, CFL::capabilityTable, -}; + AOT::CFL}; GT_SYSTEM_INFO CflHw2x3x8::gtSystemInfo = {0}; void CflHw2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { CFL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -206,7 +207,7 @@ const HardwareInfo CflHw3x3x8::hwInfo = { &CFL::workaroundTable, &CflHw3x3x8::gtSystemInfo, CFL::capabilityTable, -}; + AOT::CFL}; GT_SYSTEM_INFO CflHw3x3x8::gtSystemInfo = {0}; void CflHw3x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { CFL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); diff --git a/shared/source/gen9/hw_info_glk.cpp b/shared/source/gen9/hw_info_glk.cpp index bf4c94e9e3..34756b3685 100644 --- a/shared/source/gen9/hw_info_glk.cpp +++ b/shared/source/gen9/hw_info_glk.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -134,7 +135,7 @@ const HardwareInfo GlkHw1x3x6::hwInfo = { &GLK::workaroundTable, &GlkHw1x3x6::gtSystemInfo, GLK::capabilityTable, -}; + AOT::GLK}; GT_SYSTEM_INFO GlkHw1x3x6::gtSystemInfo = {0}; void GlkHw1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -153,7 +154,7 @@ const HardwareInfo GlkHw1x2x6::hwInfo = { &GLK::workaroundTable, &GlkHw1x2x6::gtSystemInfo, GLK::capabilityTable, -}; + AOT::GLK}; GT_SYSTEM_INFO GlkHw1x2x6::gtSystemInfo = {0}; void GlkHw1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/gen9/hw_info_kbl.cpp b/shared/source/gen9/hw_info_kbl.cpp index 70b5d82020..2e5339d41d 100644 --- a/shared/source/gen9/hw_info_kbl.cpp +++ b/shared/source/gen9/hw_info_kbl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -138,7 +139,7 @@ const HardwareInfo KblHw1x2x6::hwInfo = { &KBL::workaroundTable, &KblHw1x2x6::gtSystemInfo, KBL::capabilityTable, -}; + AOT::KBL}; GT_SYSTEM_INFO KblHw1x2x6::gtSystemInfo = {0}; void KblHw1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { KBL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -156,7 +157,7 @@ const HardwareInfo KblHw1x3x6::hwInfo = { &KBL::workaroundTable, &KblHw1x3x6::gtSystemInfo, KBL::capabilityTable, -}; + AOT::KBL}; GT_SYSTEM_INFO KblHw1x3x6::gtSystemInfo = {0}; void KblHw1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -175,7 +176,7 @@ const HardwareInfo KblHw1x3x8::hwInfo = { &KBL::workaroundTable, &KblHw1x3x8::gtSystemInfo, KBL::capabilityTable, -}; + AOT::KBL}; GT_SYSTEM_INFO KblHw1x3x8::gtSystemInfo = {0}; void KblHw1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { KBL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -193,7 +194,7 @@ const HardwareInfo KblHw2x3x8::hwInfo = { &KBL::workaroundTable, &KblHw2x3x8::gtSystemInfo, KBL::capabilityTable, -}; + AOT::KBL}; GT_SYSTEM_INFO KblHw2x3x8::gtSystemInfo = {0}; void KblHw2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { KBL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -211,7 +212,7 @@ const HardwareInfo KblHw3x3x8::hwInfo = { &KBL::workaroundTable, &KblHw3x3x8::gtSystemInfo, KBL::capabilityTable, -}; + AOT::KBL}; GT_SYSTEM_INFO KblHw3x3x8::gtSystemInfo = {0}; void KblHw3x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { KBL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); diff --git a/shared/source/gen9/hw_info_skl.cpp b/shared/source/gen9/hw_info_skl.cpp index 9643287732..1e43c5ff79 100644 --- a/shared/source/gen9/hw_info_skl.cpp +++ b/shared/source/gen9/hw_info_skl.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/constants.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -145,7 +146,7 @@ const HardwareInfo SklHw1x2x6::hwInfo = { &SKL::workaroundTable, &SklHw1x2x6::gtSystemInfo, SKL::capabilityTable, -}; + AOT::SKL}; GT_SYSTEM_INFO SklHw1x2x6::gtSystemInfo = {0}; void SklHw1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -163,7 +164,7 @@ const HardwareInfo SklHw1x3x6::hwInfo = { &SKL::workaroundTable, &SklHw1x3x6::gtSystemInfo, SKL::capabilityTable, -}; + AOT::SKL}; GT_SYSTEM_INFO SklHw1x3x6::gtSystemInfo = {0}; void SklHw1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -181,7 +182,7 @@ const HardwareInfo SklHw1x3x8::hwInfo = { &SKL::workaroundTable, &SklHw1x3x8::gtSystemInfo, SKL::capabilityTable, -}; + AOT::SKL}; GT_SYSTEM_INFO SklHw1x3x8::gtSystemInfo = {0}; void SklHw1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -199,7 +200,7 @@ const HardwareInfo SklHw2x3x8::hwInfo = { &SKL::workaroundTable, &SklHw2x3x8::gtSystemInfo, SKL::capabilityTable, -}; + AOT::SKL}; GT_SYSTEM_INFO SklHw2x3x8::gtSystemInfo = {0}; void SklHw2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); @@ -217,7 +218,7 @@ const HardwareInfo SklHw3x3x8::hwInfo = { &SKL::workaroundTable, &SklHw3x3x8::gtSystemInfo, SKL::capabilityTable, -}; + AOT::SKL}; GT_SYSTEM_INFO SklHw3x3x8::gtSystemInfo = {0}; void SklHw3x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable); diff --git a/shared/source/helpers/hw_info.cpp b/shared/source/helpers/hw_info.cpp index 675954771b..a189b8c35a 100644 --- a/shared/source/helpers/hw_info.cpp +++ b/shared/source/helpers/hw_info.cpp @@ -15,8 +15,8 @@ namespace NEO { HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable, - const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable) - : platform(*platform), featureTable(*featureTable), workaroundTable(*workaroundTable), gtSystemInfo(*gtSystemInfo), capabilityTable(capabilityTable) { + const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable, HardwareIpVersion ipVersion) + : platform(*platform), featureTable(*featureTable), workaroundTable(*workaroundTable), gtSystemInfo(*gtSystemInfo), capabilityTable(capabilityTable), ipVersion(ipVersion) { } // Global table of hardware prefixes diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index 88b7e98da6..390de624d0 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -135,7 +135,7 @@ inline bool operator==(const RuntimeCapabilityTable &lhs, const RuntimeCapabilit struct HardwareInfo { HardwareInfo() = default; HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable, - const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable); + const GT_SYSTEM_INFO *gtSystemInfo, const RuntimeCapabilityTable &capabilityTable, HardwareIpVersion ipVersion); PLATFORM platform{}; FeatureTable featureTable{}; diff --git a/shared/source/helpers/hw_ip_version.h b/shared/source/helpers/hw_ip_version.h index 1ceed3c1e3..5817a688fa 100644 --- a/shared/source/helpers/hw_ip_version.h +++ b/shared/source/helpers/hw_ip_version.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,6 +10,8 @@ namespace NEO { struct HardwareIpVersion { + HardwareIpVersion() = default; + HardwareIpVersion(uint32_t ipVersion) : value(ipVersion){}; union { uint32_t value; struct diff --git a/shared/source/xe_hpc_core/hw_info_pvc.cpp b/shared/source/xe_hpc_core/hw_info_pvc.cpp index 5d716e1534..ce6457e796 100644 --- a/shared/source/xe_hpc_core/hw_info_pvc.cpp +++ b/shared/source/xe_hpc_core/hw_info_pvc.cpp @@ -13,6 +13,7 @@ #include "shared/source/xe_hpc_core/hw_cmds_pvc.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -172,7 +173,7 @@ const HardwareInfo PvcHwConfig::hwInfo = { &PVC::workaroundTable, &PvcHwConfig::gtSystemInfo, PVC::capabilityTable, -}; + AOT::PVC_XT_A0}; GT_SYSTEM_INFO PvcHwConfig::gtSystemInfo = {0}; void PvcHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { diff --git a/shared/source/xe_hpg_core/definitions/hw_info_setup_mtl.inl b/shared/source/xe_hpg_core/definitions/hw_info_setup_mtl.inl index 64d5bf645c..865ade0b7b 100644 --- a/shared/source/xe_hpg_core/definitions/hw_info_setup_mtl.inl +++ b/shared/source/xe_hpg_core/definitions/hw_info_setup_mtl.inl @@ -1,10 +1,11 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ +namespace NEO { const HardwareInfo MTL::hwInfo = MtlHwConfig::hwInfo; const uint64_t MTL::defaultHardwareInfoConfig = 0; @@ -13,4 +14,5 @@ void setupMTLHardwareInfoImpl(HardwareInfo *hwInfo, bool setupFeatureTableAndWor MtlHwConfig::setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable); } -void (*MTL::setupHardwareInfo)(HardwareInfo *, bool, const uint64_t) = setupMTLHardwareInfoImpl; \ No newline at end of file +void (*MTL::setupHardwareInfo)(HardwareInfo *, bool, const uint64_t) = setupMTLHardwareInfoImpl; +} // namespace NEO diff --git a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl index de8154fa9f..32f8ab678b 100644 --- a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl +++ b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl @@ -143,8 +143,9 @@ bool ProductHelperHw::isPrefetchDisablingRequired(const HardwareInfo template <> std::pair ProductHelperHw::isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs) const { - auto isBasicWARequired = true; - auto isExtendedWARequired = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled > 1 && !isRcs; + auto isAcm = DG2::isG10(hwInfo) || DG2::isG11(hwInfo) || DG2::isG12(hwInfo); + auto isBasicWARequired = isAcm; + auto isExtendedWARequired = isAcm && hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled > 1 && !isRcs; if (DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.get() != -1) { isExtendedWARequired = DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.get(); diff --git a/shared/source/xe_hpg_core/hw_info_dg2.cpp b/shared/source/xe_hpg_core/hw_info_dg2.cpp index 688237af3b..e48f8ead29 100644 --- a/shared/source/xe_hpg_core/hw_info_dg2.cpp +++ b/shared/source/xe_hpg_core/hw_info_dg2.cpp @@ -13,6 +13,7 @@ #include "aubstream/engine_node.h" #include "device_ids_configs_dg2.h" +#include "platforms.h" namespace NEO { @@ -147,7 +148,7 @@ const HardwareInfo Dg2HwConfig::hwInfo = { &DG2::workaroundTable, &Dg2HwConfig::gtSystemInfo, DG2::capabilityTable, -}; + AOT::DG2_G10_A0}; GT_SYSTEM_INFO Dg2HwConfig::gtSystemInfo = {0}; void Dg2HwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo; diff --git a/shared/source/xe_hpg_core/hw_info_mtl.cpp b/shared/source/xe_hpg_core/hw_info_mtl.cpp index 459f7faf99..1fa6c5ce3a 100644 --- a/shared/source/xe_hpg_core/hw_info_mtl.cpp +++ b/shared/source/xe_hpg_core/hw_info_mtl.cpp @@ -12,6 +12,7 @@ #include "shared/source/xe_hpg_core/hw_cmds_mtl.h" #include "aubstream/engine_node.h" +#include "platforms.h" namespace NEO { @@ -148,7 +149,7 @@ const HardwareInfo MtlHwConfig::hwInfo = { &MTL::workaroundTable, &MtlHwConfig::gtSystemInfo, MTL::capabilityTable, -}; + AOT::XE_LPG_MD_A0}; GT_SYSTEM_INFO MtlHwConfig::gtSystemInfo = {0}; void MtlHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { @@ -185,6 +186,5 @@ void MtlHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTable } }; -#include "hw_info_setup_mtl.inl" - } // namespace NEO +#include "hw_info_setup_mtl.inl" diff --git a/shared/source/xe_hpg_core/mtl/os_agnostic_product_helper_mtl.inl b/shared/source/xe_hpg_core/mtl/os_agnostic_product_helper_mtl.inl index 0a9feccfda..52da2395bb 100644 --- a/shared/source/xe_hpg_core/mtl/os_agnostic_product_helper_mtl.inl +++ b/shared/source/xe_hpg_core/mtl/os_agnostic_product_helper_mtl.inl @@ -80,7 +80,7 @@ uint32_t ProductHelperHw::getSteppingFromHwRevId(const HardwareInfo template <> std::pair ProductHelperHw::isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs) const { - auto isBasicWARequired = GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo, *this); + auto isBasicWARequired = getProductConfigFromHwInfo(hwInfo) == AOT::XE_LPG_MD_A0 || getProductConfigFromHwInfo(hwInfo) == AOT::XE_LPG_LG_A0; auto isExtendedWARequired = false; return {isBasicWARequired, isExtendedWARequired}; diff --git a/shared/test/unit_test/aub/aub_helper_tests.cpp b/shared/test/unit_test/aub/aub_helper_tests.cpp index 370ed1b6b0..ae7e8081cb 100644 --- a/shared/test/unit_test/aub/aub_helper_tests.cpp +++ b/shared/test/unit_test/aub/aub_helper_tests.cpp @@ -40,7 +40,7 @@ TEST(AubHelper, GivenMultipleSubDevicesWhenGettingDeviceCountThenCorrectValueIsR RuntimeCapabilityTable capTable = {}; GT_SYSTEM_INFO sysInfo = {}; PLATFORM platform = {}; - HardwareInfo hwInfo{&platform, &featureTable, &workaroundTable, &sysInfo, capTable}; + HardwareInfo hwInfo{&platform, &featureTable, &workaroundTable, &sysInfo, capTable, {}}; DebugManager.flags.CreateMultipleSubDevices.set(2); uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(&hwInfo); diff --git a/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt b/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt index b03409c106..e70d33c7ec 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt +++ b/shared/test/unit_test/xe_hpg_core/dg2/CMakeLists.txt @@ -16,7 +16,6 @@ if(TESTS_DG2) ${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_tests_dg2.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_tests_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_dg2.cpp @@ -28,4 +27,4 @@ if(TESTS_DG2) ) add_subdirectories() -endif() \ No newline at end of file +endif() 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 deleted file mode 100644 index f3384c6bf1..0000000000 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp +++ /dev/null @@ -1,645 +0,0 @@ -/* - * Copyright (C) 2021-2023 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/command_stream/stream_properties.h" -#include "shared/source/execution_environment/execution_environment.h" -#include "shared/source/execution_environment/root_device_environment.h" -#include "shared/source/helpers/constants.h" -#include "shared/source/helpers/gfx_core_helper.h" -#include "shared/source/os_interface/hw_info_config.h" -#include "shared/source/xe_hpg_core/hw_cmds_dg2.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/header/per_product_test_definitions.h" -#include "shared/test/common/test_macros/test.h" -#include "shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h" -#include "shared/test/unit_test/fixtures/product_config_fixture.h" -#include "shared/test/unit_test/os_interface/hw_info_config_tests.h" - -#include "aubstream/product_family.h" - -using namespace NEO; - -using ProductHelperTestDg2 = ProductHelperTest; - -DG2TEST_F(ProductHelperTestDg2, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) { - EXPECT_EQ(aub_stream::ProductFamily::Dg2, productHelper->getAubStreamProductFamily()); -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2ConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) { - HardwareInfo hwInfo = *defaultHwInfo; - GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; - Dg2HwConfig::setupHardwareInfoBase(&hwInfo, false); - - EXPECT_EQ(336u, gtSystemInfo.TotalVsThreads); - EXPECT_EQ(336u, gtSystemInfo.TotalHsThreads); - EXPECT_EQ(336u, gtSystemInfo.TotalDsThreads); - EXPECT_EQ(336u, gtSystemInfo.TotalGsThreads); - EXPECT_EQ(64u, gtSystemInfo.TotalPsThreadsWindowerRange); - EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb); - EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled); - EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated); -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2ConfigWhenSetupHardwareInfoThenGtSystemInfoIsCorrect) { - HardwareInfo hwInfo = *defaultHwInfo; - GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; - - Dg2HwConfig::setupHardwareInfo(&hwInfo, false); - EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb); - EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled); -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2ProductHelperWhenIsInitBuiltinAsyncSupportedThenReturnTrue) { - EXPECT_TRUE(productHelper->isInitBuiltinAsyncSupported(*defaultHwInfo)); -} - -DG2TEST_F(ProductHelperTestDg2, givenG10DevIdWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) { - HardwareInfo myHwInfo = *defaultHwInfo; - myHwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; - EXPECT_FALSE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - - FrontEndPropertiesSupport fePropertiesSupport{}; - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_FALSE(fePropertiesSupport.disableOverdispatch); - - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); -} - -DG2TEST_F(ProductHelperTestDg2, givenG11DevIdWhenIsDisableOverdispatchAvailableCalledThenTrueReturnedForAllSteppings) { - FrontEndPropertiesSupport fePropertiesSupport{}; - HardwareInfo myHwInfo = *defaultHwInfo; - - myHwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_C, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); -} - -DG2TEST_F(ProductHelperTestDg2, givenG12DevIdWhenIsDisableOverdispatchAvailableCalledThenTrueReturnedForAllSteppings) { - FrontEndPropertiesSupport fePropertiesSupport{}; - HardwareInfo myHwInfo = *defaultHwInfo; - - myHwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - - myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_C, myHwInfo); - EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); - EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); -} - -DG2TEST_F(ProductHelperTestDg2, whenAdjustingDefaultEngineTypeThenSelectEngineTypeBasedOnRevisionId) { - auto hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrCCSNode = true; - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = deviceId; - hwInfo.capabilityTable.defaultEngineType = defaultHwInfo->capabilityTable.defaultEngineType; - gfxCoreHelper.adjustDefaultEngineType(&hwInfo, productHelper); - if (DG2::isG10(hwInfo) && revision < REVISION_B) { - EXPECT_EQ(aub_stream::ENGINE_RCS, hwInfo.capabilityTable.defaultEngineType); - } else { - EXPECT_EQ(aub_stream::ENGINE_CCS, defaultHwInfo->capabilityTable.defaultEngineType); - } - } - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G11OrG12WhenAskingIfMaxThreadsForWorkgroupWAIsRequiredThenReturnFalse) { - auto hwInfo = *defaultHwInfo; - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - for (auto deviceId : {dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = deviceId; - - EXPECT_FALSE(productHelper->isMaxThreadsForWorkgroupWARequired(hwInfo)); - } - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0OrA1SteppingWhenAskingIfWAIsRequiredThenReturnTrue) { - - auto hwInfo = *defaultHwInfo; - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = deviceId; - - auto expectedValue = DG2::isG10(hwInfo) && revision < REVISION_B; - - EXPECT_EQ(expectedValue, productHelper->isDefaultEngineTypeAdjustmentRequired(hwInfo)); - EXPECT_EQ(expectedValue, productHelper->isAllocationSizeAdjustmentRequired(hwInfo)); - EXPECT_EQ(expectedValue, productHelper->isPrefetchDisablingRequired(hwInfo)); - } - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G10WhenAskingForSBAWaThenReturnSuccessOnlyForBStepping) { - auto hwInfo = *defaultHwInfo; - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; - - auto expectedValue = revision == REVISION_B; - EXPECT_EQ(expectedValue, productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G11WhenAskingForSBAWaThenReturnSuccess) { - auto hwInfo = *defaultHwInfo; - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; - - EXPECT_TRUE(productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G12WhenAskingForSBAWaThenReturnSuccess) { - auto hwInfo = *defaultHwInfo; - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; - - EXPECT_FALSE(productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { - DebugManagerStateRestore restorer; - DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true); - - auto hwInfo = *defaultHwInfo; - auto isRcs = false; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_TRUE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenTrueIsReturned) { - DebugManagerStateRestore restorer; - DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true); - - auto hwInfo = *defaultHwInfo; - auto isRcs = true; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_TRUE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenProgramPipeControlPriorToNonPipelinedStateCommandDisabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenFalseIsReturned) { - DebugManagerStateRestore restorer; - DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(0); - - auto hwInfo = *defaultHwInfo; - auto isRcs = true; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_FALSE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { - - auto hwInfo = *defaultHwInfo; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; - auto isRcs = false; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_TRUE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenFalseIsReturned) { - - auto hwInfo = *defaultHwInfo; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; - auto isRcs = true; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_FALSE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithSingleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { - - auto hwInfo = *defaultHwInfo; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; - auto isRcs = false; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_FALSE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithSingleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenTrueIsReturned) { - - auto hwInfo = *defaultHwInfo; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; - auto isRcs = true; - - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); - - EXPECT_FALSE(isExtendedWARequired); - EXPECT_TRUE(isBasicWARequired); -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2WhenIsBlitterForImagesSupportedIsCalledThenTrueIsReturned) { - - EXPECT_TRUE(productHelper->isBlitterForImagesSupported()); -} - -DG2TEST_F(ProductHelperTestDg2, WhenGetSvmCpuAlignmentThenProperValueIsReturned) { - - EXPECT_EQ(MemoryConstants::pageSize2Mb, productHelper->getSvmCpuAlignment()); -} - -DG2TEST_F(ProductHelperTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurfaceOnBCSIsSupportedThenReturnTrue) { - - std::array, 4> revisions = { - {{REVISION_A0, false}, - {REVISION_A1, false}, - {REVISION_B, false}, - {REVISION_C, true}}}; - - for (const auto &[revision, paramBool] : revisions) { - auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - - productHelper->configureHardwareCustom(&hwInfo, nullptr); - - EXPECT_EQ(paramBool, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0WhenConfigureCalledThenDisableCompression) { - - for (uint8_t revision : {REVISION_A0, REVISION_A1}) { - for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrE2ECompression = true; - - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = deviceId; - - productHelper->configureHardwareCustom(&hwInfo, nullptr); - - auto compressionExpected = DG2::isG10(hwInfo) ? (revision != REVISION_A0) : true; - - EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedBuffers); - EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedImages); - EXPECT_EQ(compressionExpected, productHelper->allowCompression(hwInfo)); - } - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G10WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccessOnlyForCStepping) { - - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; - - auto expectedValue = revision == REVISION_C; - - EXPECT_EQ(expectedValue, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G11WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccessOnlyForHigherThanAStepping) { - - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; - - auto expectedValue = revision >= REVISION_B; - - EXPECT_EQ(expectedValue, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2G12WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccess) { - - for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - hwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; - - EXPECT_TRUE(productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) { - uint32_t steppings[] = { - REVISION_A0, - REVISION_A1, - REVISION_B, - REVISION_C, - CommonConstants::invalidStepping, - }; - - auto hardwareInfo = *defaultHwInfo; - - for (auto stepping : steppings) { - hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo); - - if (stepping <= REVISION_B) { - if (stepping == REVISION_A0) { - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); - } else if (stepping == REVISION_A1) { - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); - } else { // REVISION_B - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); - } - } else { - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); - } - - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_A0, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A0, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A1, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A1, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_B, hardwareInfo, *productHelper)); - - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_D, REVISION_A0, hardwareInfo, *productHelper)); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndDisableL3CacheForDebugCalledThenCorrectValueIsReturned) { - uint32_t steppings[] = { - REVISION_A0, - REVISION_A1, - REVISION_B, - REVISION_C, - CommonConstants::invalidStepping, - }; - - auto hardwareInfo = *defaultHwInfo; - const auto &gfxCoreHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - - for (auto stepping : steppings) { - hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo); - if (stepping < REVISION_B) { - EXPECT_TRUE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper)); - } else { - EXPECT_FALSE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper)); - } - } -} - -DG2TEST_F(ProductHelperTestDg2, givenDg2WhenSetForceNonCoherentThenProperFlagSet) { - using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT; - - auto stateComputeMode = FamilyType::cmdInitStateComputeMode; - auto properties = StateComputeModeProperties{}; - - properties.isCoherencyRequired.set(false); - productHelper->setForceNonCoherent(&stateComputeMode, properties); - EXPECT_EQ(FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT, stateComputeMode.getForceNonCoherent()); - EXPECT_EQ(XeHpgCoreFamily::stateComputeModeForceNonCoherentMask, stateComputeMode.getMaskBits()); - - properties.isCoherencyRequired.set(true); - productHelper->setForceNonCoherent(&stateComputeMode, properties); - EXPECT_EQ(FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED, stateComputeMode.getForceNonCoherent()); - EXPECT_EQ(XeHpgCoreFamily::stateComputeModeForceNonCoherentMask, stateComputeMode.getMaskBits()); -} - -DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeUnitsUsedForScratchThenProperCalculationIsReturned) { - HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); - GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; - testSysInfo.IsDynamicallyPopulated = true; - for (int i = 0; i < GT_MAX_SLICE; i++) { - testSysInfo.SliceInfo[i].Enabled = false; - } - testSysInfo.SliceInfo[2].Enabled = true; - testSysInfo.SliceInfo[3].Enabled = true; - auto highestEnabledSlice = 4; - auto subSlicesPerSlice = testSysInfo.MaxSubSlicesSupported / testSysInfo.MaxSlicesSupported; - auto maxSubSlice = highestEnabledSlice * subSlicesPerSlice; - - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - - uint32_t expectedCalculation = maxSubSlice * testSysInfo.MaxEuPerSubSlice * (testSysInfo.ThreadCount / testSysInfo.EUCount); - - EXPECT_EQ(expectedCalculation, gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0])); -} - -DG2TEST_F(ProductHelperTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScratchThenThrowUnrecoverableIf) { - HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); - GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; - testSysInfo.IsDynamicallyPopulated = true; - for (int i = 0; i < GT_MAX_SLICE; i++) { - testSysInfo.SliceInfo[i].Enabled = false; - } - - auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - - EXPECT_THROW(gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0]), std::exception); -} - -DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { - - EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents()); -} - -DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { - for (const auto &deviceId : dg2G10DeviceIds) { - hwInfo.platform.usDeviceID = deviceId; - - EXPECT_TRUE(DG2::isG10(hwInfo)); - EXPECT_FALSE(DG2::isG11(hwInfo)); - EXPECT_FALSE(DG2::isG12(hwInfo)); - } -} - -DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { - for (const auto &deviceId : dg2G11DeviceIds) { - hwInfo.platform.usDeviceID = deviceId; - - EXPECT_FALSE(DG2::isG10(hwInfo)); - EXPECT_TRUE(DG2::isG11(hwInfo)); - EXPECT_FALSE(DG2::isG12(hwInfo)); - } -} - -DG2TEST_F(ProductConfigTests, givenDg2G12DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { - for (const auto &deviceId : dg2G12DeviceIds) { - hwInfo.platform.usDeviceID = deviceId; - - EXPECT_FALSE(DG2::isG10(hwInfo)); - EXPECT_FALSE(DG2::isG11(hwInfo)); - EXPECT_TRUE(DG2::isG12(hwInfo)); - } -} - -DG2TEST_F(ProductConfigTests, givenInvalidRevisionIdWhenDeviceIdIsDefaultThenUnknownIsaIsReturned) { - hwInfo.platform.usDeviceID = 0; - hwInfo.platform.usRevId = CommonConstants::invalidRevisionID; - - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA); -} - -DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) { - for (const auto &deviceId : dg2G10DeviceIds) { - hwInfo.platform.usDeviceID = deviceId; - - hwInfo.platform.usRevId = 0x0; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G10_A0); - - hwInfo.platform.usRevId = 0x1; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G10_A1); - - hwInfo.platform.usRevId = 0x4; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G10_B0); - - hwInfo.platform.usRevId = 0x8; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G10_C0); - } -} - -DG2TEST_F(ProductConfigTests, givenDg2DeviceIdWhenIncorrectRevisionIsPassedThenCorrectProductConfigIsReturned) { - for (const auto *dg2 : {&dg2G10DeviceIds, &dg2G11DeviceIds}) { - for (const auto &deviceId : *dg2) { - hwInfo.platform.usDeviceID = deviceId; - hwInfo.platform.usRevId = CommonConstants::invalidRevisionID; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA); - } - } -} - -DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) { - for (const auto &deviceId : dg2G11DeviceIds) { - hwInfo.platform.usDeviceID = deviceId; - - hwInfo.platform.usRevId = 0x0; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G11_A0); - - hwInfo.platform.usRevId = 0x4; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G11_B0); - - hwInfo.platform.usRevId = 0x5; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G11_B1); - } -} - -DG2TEST_F(ProductConfigTests, givenDg2G12DeviceIdWhenGetProductConfigThenCorrectConfigIsReturned) { - for (const auto &deviceId : dg2G12DeviceIds) { - hwInfo.platform.usDeviceID = deviceId; - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::DG2_G12_A0); - } -} - -DG2TEST_F(ProductConfigTests, givenNotSetDeviceAndRevisionIdWhenGetProductConfigThenUnknownIsaIsReturned) { - hwInfo.platform.usRevId = 0x0; - hwInfo.platform.usDeviceID = 0x0; - - productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); - EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA); -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenAskedIfStorageInfoAdjustmentIsRequiredThenTrueIsReturned) { - if constexpr (is32bit) { - EXPECT_TRUE(productHelper->isStorageInfoAdjustmentRequired()); - } else { - EXPECT_FALSE(productHelper->isStorageInfoAdjustmentRequired()); - } -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { - - EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); -} - -DG2TEST_F(ProductHelperTestDg2, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenCorrectValueIsReturned) { - DebugManagerStateRestore restorer; - - // ResolveDependenciesViaPipeControls = -1 (default) - EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); - EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true)); - - DebugManager.flags.ResolveDependenciesViaPipeControls.set(0); - EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); - EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true)); - - DebugManager.flags.ResolveDependenciesViaPipeControls.set(1); - EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); - EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true)); -} - -DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenCheckingIsBufferPoolAllocatorSupportedThenCorrectValueIsReturned) { - EXPECT_TRUE(productHelper->isBufferPoolAllocatorSupported()); -} diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp index 1b83e7c182..08f486ee31 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp @@ -5,18 +5,27 @@ * */ +#include "shared/source/command_stream/stream_properties.h" +#include "shared/source/execution_environment/execution_environment.h" +#include "shared/source/execution_environment/root_device_environment.h" +#include "shared/source/helpers/constants.h" +#include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/product_config_helper.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/source/xe_hpg_core/hw_cmds_dg2.h" #include "shared/test/common/fixtures/device_fixture.h" +#include "shared/test/common/helpers/debug_manager_state_restore.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/fixtures/product_config_fixture.h" +#include "shared/test/unit_test/os_interface/hw_info_config_tests.h" +#include "aubstream/product_family.h" #include "platforms.h" using namespace NEO; using ProductConfigHelperDg2Tests = ::testing::Test; -using ProductHelperTests = Test; +using ProductHelperTestDg2 = ProductHelperTest; DG2TEST_F(ProductConfigHelperDg2Tests, givenVariousVariantsOfXeHpgAcronymsWhenGetReleaseThenCorrectValueIsReturned) { std::vector acronymsVariants = {"xe_hpg_core", "xe_hpg", "xehpg", "XeHpg"}; @@ -32,59 +41,723 @@ DG2TEST_F(ProductConfigHelperDg2Tests, givenXeHpgReleaseWhenSearchForDeviceAcron auto aotInfos = productConfigHelper->getDeviceAotInfo(); EXPECT_TRUE(std::any_of(aotInfos.begin(), aotInfos.end(), ProductConfigHelper::findDeviceAcronymForRelease(AOT::XE_HPG_RELEASE))); } -DG2TEST_F(ProductHelperTests, givenNoDpasInstructionInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenNoDpasInstructionInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { const uint32_t lws[3] = {1, 1, 1}; const uint32_t groupCount[3] = {5, 3, 1}; bool dpasInstruction = false; - EXPECT_FALSE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionLwsAndGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { bool dpasInstruction = true; - EXPECT_TRUE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, nullptr, nullptr)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, nullptr)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionLwsIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { bool dpasInstruction = true; const uint32_t groupCount[3] = {5, 3, 1}; - EXPECT_TRUE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { bool dpasInstruction = true; const uint32_t lws[3] = {1, 1, 1}; - EXPECT_TRUE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, lws, nullptr)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, nullptr)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionLwsAndLwsIsOddWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsOddWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { const uint32_t lws[3] = {7, 3, 1}; const uint32_t groupCount[3] = {2, 1, 1}; bool dpasInstruction = true; - EXPECT_TRUE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionLwsAndLwsIsNoOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsNoOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { const uint32_t lws[3] = {8, 3, 1}; const uint32_t groupCount[3] = {2, 1, 1}; bool dpasInstruction = true; - EXPECT_FALSE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionLwsAndLwsIsOneAndXGroupCountIsOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsOneAndXGroupCountIsOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { const uint32_t lws[3] = {1, 1, 1}; const uint32_t groupCount[3] = {5, 1, 1}; bool dpasInstruction = true; - EXPECT_TRUE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); } -DG2TEST_F(ProductHelperTests, givenDpasInstructionLwsAndLwsIsOneAndXGroupCountIsNoOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { - auto &gfxCoreHelper = getHelper(); +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsOneAndXGroupCountIsNoOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { const uint32_t lws[3] = {1, 1, 1}; const uint32_t groupCount[3] = {4, 1, 1}; bool dpasInstruction = true; - EXPECT_FALSE(gfxCoreHelper.isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); +} +DG2TEST_F(ProductHelperTestDg2, givenDg2ProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenTrueReturned) { + EXPECT_TRUE(productHelper->isCalculationForDisablingEuFusionWithDpasNeeded()); +} + +DG2TEST_F(ProductHelperTestDg2, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) { + EXPECT_EQ(aub_stream::ProductFamily::Dg2, productHelper->getAubStreamProductFamily()); +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2ConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) { + HardwareInfo hwInfo = *defaultHwInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; + Dg2HwConfig::setupHardwareInfoBase(&hwInfo, false); + + EXPECT_EQ(336u, gtSystemInfo.TotalVsThreads); + EXPECT_EQ(336u, gtSystemInfo.TotalHsThreads); + EXPECT_EQ(336u, gtSystemInfo.TotalDsThreads); + EXPECT_EQ(336u, gtSystemInfo.TotalGsThreads); + EXPECT_EQ(64u, gtSystemInfo.TotalPsThreadsWindowerRange); + EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb); + EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled); + EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated); +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2ConfigWhenSetupHardwareInfoThenGtSystemInfoIsCorrect) { + HardwareInfo hwInfo = *defaultHwInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; + + Dg2HwConfig::setupHardwareInfo(&hwInfo, false); + EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb); + EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled); +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2ProductHelperWhenIsInitBuiltinAsyncSupportedThenReturnTrue) { + EXPECT_TRUE(productHelper->isInitBuiltinAsyncSupported(*defaultHwInfo)); +} + +DG2TEST_F(ProductHelperTestDg2, givenG10DevIdWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) { + HardwareInfo myHwInfo = *defaultHwInfo; + myHwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; + EXPECT_FALSE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + + FrontEndPropertiesSupport fePropertiesSupport{}; + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_FALSE(fePropertiesSupport.disableOverdispatch); + + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); +} + +DG2TEST_F(ProductHelperTestDg2, givenG11DevIdWhenIsDisableOverdispatchAvailableCalledThenTrueReturnedForAllSteppings) { + FrontEndPropertiesSupport fePropertiesSupport{}; + HardwareInfo myHwInfo = *defaultHwInfo; + + myHwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); + + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); + + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_C, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); +} + +DG2TEST_F(ProductHelperTestDg2, givenG12DevIdWhenIsDisableOverdispatchAvailableCalledThenTrueReturnedForAllSteppings) { + FrontEndPropertiesSupport fePropertiesSupport{}; + HardwareInfo myHwInfo = *defaultHwInfo; + + myHwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); + + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); + + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_C, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); +} + +DG2TEST_F(ProductHelperTestDg2, whenAdjustingDefaultEngineTypeThenSelectEngineTypeBasedOnRevisionId) { + auto hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = deviceId; + hwInfo.capabilityTable.defaultEngineType = defaultHwInfo->capabilityTable.defaultEngineType; + gfxCoreHelper.adjustDefaultEngineType(&hwInfo, productHelper); + if (DG2::isG10(hwInfo) && revision < REVISION_B) { + EXPECT_EQ(aub_stream::ENGINE_RCS, hwInfo.capabilityTable.defaultEngineType); + } else { + EXPECT_EQ(aub_stream::ENGINE_CCS, defaultHwInfo->capabilityTable.defaultEngineType); + } + } + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G11OrG12WhenAskingIfMaxThreadsForWorkgroupWAIsRequiredThenReturnFalse) { + auto hwInfo = *defaultHwInfo; + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + for (auto deviceId : {dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = deviceId; + + EXPECT_FALSE(productHelper->isMaxThreadsForWorkgroupWARequired(hwInfo)); + } + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0OrA1SteppingWhenAskingIfWAIsRequiredThenReturnTrue) { + + auto hwInfo = *defaultHwInfo; + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = deviceId; + + auto expectedValue = DG2::isG10(hwInfo) && revision < REVISION_B; + + EXPECT_EQ(expectedValue, productHelper->isDefaultEngineTypeAdjustmentRequired(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isAllocationSizeAdjustmentRequired(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isPrefetchDisablingRequired(hwInfo)); + } + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G10WhenAskingForSBAWaThenReturnSuccessOnlyForBStepping) { + auto hwInfo = *defaultHwInfo; + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; + + auto expectedValue = revision == REVISION_B; + EXPECT_EQ(expectedValue, productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G11WhenAskingForSBAWaThenReturnSuccess) { + auto hwInfo = *defaultHwInfo; + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; + + EXPECT_TRUE(productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G12WhenAskingForSBAWaThenReturnSuccess) { + auto hwInfo = *defaultHwInfo; + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; + + EXPECT_FALSE(productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { + DebugManagerStateRestore restorer; + DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true); + auto hwInfo = *defaultHwInfo; + + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = false; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_TRUE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenTrueIsReturned) { + DebugManagerStateRestore restorer; + DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true); + + auto hwInfo = *defaultHwInfo; + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = true; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_TRUE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProgramPipeControlPriorToNonPipelinedStateCommandDisabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenFalseIsReturned) { + DebugManagerStateRestore restorer; + DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(0); + + auto hwInfo = *defaultHwInfo; + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = true; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { + + auto hwInfo = *defaultHwInfo; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = false; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_TRUE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenFalseIsReturned) { + + auto hwInfo = *defaultHwInfo; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = true; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithSingleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { + + auto hwInfo = *defaultHwInfo; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = false; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithSingleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenTrueIsReturned) { + + auto hwInfo = *defaultHwInfo; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + hwInfo.platform.usDeviceID = deviceId; + auto isRcs = true; + + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenNonG10G11OrG12Dg2WhenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenNoWaIsNeededUnlessForcedByDebugFlag) { + + auto hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = 0; + + EXPECT_FALSE(DG2::isG10(hwInfo)); + EXPECT_FALSE(DG2::isG11(hwInfo)); + EXPECT_FALSE(DG2::isG12(hwInfo)); + + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; + auto isRcs = false; + { + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_FALSE(isBasicWARequired); + } + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; + { + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_FALSE(isBasicWARequired); + } + + DebugManagerStateRestore restorer; + DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(1); + + { + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + EXPECT_TRUE(isExtendedWARequired); + EXPECT_FALSE(isBasicWARequired); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2WhenIsBlitterForImagesSupportedIsCalledThenTrueIsReturned) { + + EXPECT_TRUE(productHelper->isBlitterForImagesSupported()); +} + +DG2TEST_F(ProductHelperTestDg2, WhenGetSvmCpuAlignmentThenProperValueIsReturned) { + + EXPECT_EQ(MemoryConstants::pageSize2Mb, productHelper->getSvmCpuAlignment()); +} + +DG2TEST_F(ProductHelperTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurfaceOnBCSIsSupportedThenReturnTrue) { + + std::array, 4> revisions = { + {{REVISION_A0, false}, + {REVISION_A1, false}, + {REVISION_B, false}, + {REVISION_C, true}}}; + + for (const auto &[revision, paramBool] : revisions) { + auto hwInfo = *defaultHwInfo; + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + + productHelper->configureHardwareCustom(&hwInfo, nullptr); + + EXPECT_EQ(paramBool, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0WhenConfigureCalledThenDisableCompression) { + + for (uint8_t revision : {REVISION_A0, REVISION_A1}) { + for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrE2ECompression = true; + + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = deviceId; + + productHelper->configureHardwareCustom(&hwInfo, nullptr); + + auto compressionExpected = DG2::isG10(hwInfo) ? (revision != REVISION_A0) : true; + + EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedBuffers); + EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedImages); + EXPECT_EQ(compressionExpected, productHelper->allowCompression(hwInfo)); + } + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G10WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccessOnlyForCStepping) { + + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; + + auto expectedValue = revision == REVISION_C; + + EXPECT_EQ(expectedValue, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G11WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccessOnlyForHigherThanAStepping) { + + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; + + auto expectedValue = revision >= REVISION_B; + + EXPECT_EQ(expectedValue, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2G12WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccess) { + + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; + + EXPECT_TRUE(productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) { + uint32_t steppings[] = { + REVISION_A0, + REVISION_A1, + REVISION_B, + REVISION_C, + CommonConstants::invalidStepping, + }; + + auto hardwareInfo = *defaultHwInfo; + + for (auto stepping : steppings) { + hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo); + + if (stepping <= REVISION_B) { + if (stepping == REVISION_A0) { + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); + } else if (stepping == REVISION_A1) { + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); + } else { // REVISION_B + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); + } + } else { + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); + } + + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_A0, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A0, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_B, hardwareInfo, *productHelper)); + + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_D, REVISION_A0, hardwareInfo, *productHelper)); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndDisableL3CacheForDebugCalledThenCorrectValueIsReturned) { + uint32_t steppings[] = { + REVISION_A0, + REVISION_A1, + REVISION_B, + REVISION_C, + CommonConstants::invalidStepping, + }; + + auto hardwareInfo = *defaultHwInfo; + const auto &gfxCoreHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + + for (auto stepping : steppings) { + hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo); + if (stepping < REVISION_B) { + EXPECT_TRUE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper)); + } else { + EXPECT_FALSE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper)); + } + } +} + +DG2TEST_F(ProductHelperTestDg2, givenDg2WhenSetForceNonCoherentThenProperFlagSet) { + using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT; + + auto stateComputeMode = FamilyType::cmdInitStateComputeMode; + auto properties = StateComputeModeProperties{}; + + properties.isCoherencyRequired.set(false); + productHelper->setForceNonCoherent(&stateComputeMode, properties); + EXPECT_EQ(FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT, stateComputeMode.getForceNonCoherent()); + EXPECT_EQ(XeHpgCoreFamily::stateComputeModeForceNonCoherentMask, stateComputeMode.getMaskBits()); + + properties.isCoherencyRequired.set(true); + productHelper->setForceNonCoherent(&stateComputeMode, properties); + EXPECT_EQ(FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED, stateComputeMode.getForceNonCoherent()); + EXPECT_EQ(XeHpgCoreFamily::stateComputeModeForceNonCoherentMask, stateComputeMode.getMaskBits()); +} + +DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeUnitsUsedForScratchThenProperCalculationIsReturned) { + HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); + GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; + testSysInfo.IsDynamicallyPopulated = true; + for (int i = 0; i < GT_MAX_SLICE; i++) { + testSysInfo.SliceInfo[i].Enabled = false; + } + testSysInfo.SliceInfo[2].Enabled = true; + testSysInfo.SliceInfo[3].Enabled = true; + auto highestEnabledSlice = 4; + auto subSlicesPerSlice = testSysInfo.MaxSubSlicesSupported / testSysInfo.MaxSlicesSupported; + auto maxSubSlice = highestEnabledSlice * subSlicesPerSlice; + + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + + uint32_t expectedCalculation = maxSubSlice * testSysInfo.MaxEuPerSubSlice * (testSysInfo.ThreadCount / testSysInfo.EUCount); + + EXPECT_EQ(expectedCalculation, gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0])); +} + +DG2TEST_F(ProductHelperTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScratchThenThrowUnrecoverableIf) { + HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); + GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; + testSysInfo.IsDynamicallyPopulated = true; + for (int i = 0; i < GT_MAX_SLICE; i++) { + testSysInfo.SliceInfo[i].Enabled = false; + } + + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + + EXPECT_THROW(gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0]), std::exception); +} + +DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { + + EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents()); +} + +DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { + for (const auto &deviceId : dg2G10DeviceIds) { + hwInfo.platform.usDeviceID = deviceId; + + EXPECT_TRUE(DG2::isG10(hwInfo)); + EXPECT_FALSE(DG2::isG11(hwInfo)); + EXPECT_FALSE(DG2::isG12(hwInfo)); + } +} + +DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { + for (const auto &deviceId : dg2G11DeviceIds) { + hwInfo.platform.usDeviceID = deviceId; + + EXPECT_FALSE(DG2::isG10(hwInfo)); + EXPECT_TRUE(DG2::isG11(hwInfo)); + EXPECT_FALSE(DG2::isG12(hwInfo)); + } +} + +DG2TEST_F(ProductConfigTests, givenDg2G12DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { + for (const auto &deviceId : dg2G12DeviceIds) { + hwInfo.platform.usDeviceID = deviceId; + + EXPECT_FALSE(DG2::isG10(hwInfo)); + EXPECT_FALSE(DG2::isG11(hwInfo)); + EXPECT_TRUE(DG2::isG12(hwInfo)); + } +} + +DG2TEST_F(ProductConfigTests, givenInvalidRevisionIdWhenDeviceIdIsDefaultThenUnknownIsaIsReturned) { + hwInfo.platform.usDeviceID = 0; + hwInfo.platform.usRevId = CommonConstants::invalidRevisionID; + + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA); +} + +DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) { + for (const auto &deviceId : dg2G10DeviceIds) { + hwInfo.platform.usDeviceID = deviceId; + + hwInfo.platform.usRevId = 0x0; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G10_A0); + + hwInfo.platform.usRevId = 0x1; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G10_A1); + + hwInfo.platform.usRevId = 0x4; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G10_B0); + + hwInfo.platform.usRevId = 0x8; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G10_C0); + } +} + +DG2TEST_F(ProductConfigTests, givenDg2DeviceIdWhenIncorrectRevisionIsPassedThenCorrectProductConfigIsReturned) { + for (const auto *dg2 : {&dg2G10DeviceIds, &dg2G11DeviceIds}) { + for (const auto &deviceId : *dg2) { + hwInfo.platform.usDeviceID = deviceId; + hwInfo.platform.usRevId = CommonConstants::invalidRevisionID; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA); + } + } +} + +DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedThenCorrectProductConfigIsReturned) { + for (const auto &deviceId : dg2G11DeviceIds) { + hwInfo.platform.usDeviceID = deviceId; + + hwInfo.platform.usRevId = 0x0; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G11_A0); + + hwInfo.platform.usRevId = 0x4; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G11_B0); + + hwInfo.platform.usRevId = 0x5; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G11_B1); + } +} + +DG2TEST_F(ProductConfigTests, givenDg2G12DeviceIdWhenGetProductConfigThenCorrectConfigIsReturned) { + for (const auto &deviceId : dg2G12DeviceIds) { + hwInfo.platform.usDeviceID = deviceId; + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::DG2_G12_A0); + } +} + +DG2TEST_F(ProductConfigTests, givenNotSetDeviceAndRevisionIdWhenGetProductConfigThenUnknownIsaIsReturned) { + hwInfo.platform.usRevId = 0x0; + hwInfo.platform.usDeviceID = 0x0; + + productConfig = productHelper->getProductConfigFromHwInfo(hwInfo); + EXPECT_EQ(productConfig, AOT::UNKNOWN_ISA); +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenAskedIfStorageInfoAdjustmentIsRequiredThenTrueIsReturned) { + if constexpr (is32bit) { + EXPECT_TRUE(productHelper->isStorageInfoAdjustmentRequired()); + } else { + EXPECT_FALSE(productHelper->isStorageInfoAdjustmentRequired()); + } +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { + + EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); +} + +DG2TEST_F(ProductHelperTestDg2, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenCorrectValueIsReturned) { + DebugManagerStateRestore restorer; + + // ResolveDependenciesViaPipeControls = -1 (default) + EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); + EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true)); + + DebugManager.flags.ResolveDependenciesViaPipeControls.set(0); + EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); + EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true)); + + DebugManager.flags.ResolveDependenciesViaPipeControls.set(1); + EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); + EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, true)); +} + +DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenCheckingIsBufferPoolAllocatorSupportedThenCorrectValueIsReturned) { + EXPECT_TRUE(productHelper->isBufferPoolAllocatorSupported()); } -DG2TEST_F(ProductHelperTests, givenDg2ProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenTrueReturned) { - auto &gfxCoreHelper = getHelper(); - EXPECT_TRUE(gfxCoreHelper.isCalculationForDisablingEuFusionWithDpasNeeded()); -} \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp index bd9936b168..dd5c627519 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp @@ -26,6 +26,7 @@ MTLTEST_F(GfxCoreHelperTestMtl, givenVariousMtlReleasesWhenGetExtensionsIsCalled MockExecutionEnvironment mockExecutionEnvironment{}; auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0]; auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); + auto &productHelper = rootDeviceEnvironment.getHelper(); auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); unsigned int gmdReleases[] = {70, 71, 72, 73}; hwInfo.ipVersion.architecture = 12; @@ -36,6 +37,7 @@ MTLTEST_F(GfxCoreHelperTestMtl, givenVariousMtlReleasesWhenGetExtensionsIsCalled EXPECT_EQ(!MTL::isLpg(hwInfo), hasSubstr(extensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate"))); EXPECT_EQ(!MTL::isLpg(hwInfo), hasSubstr(extensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate"))); + EXPECT_EQ(!MTL::isLpg(hwInfo), productHelper.isMatrixMultiplyAccumulateSupported(hwInfo)); } } diff --git a/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp index dc894c7955..f1d6501f59 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/hw_info_config_tests_mtl.cpp @@ -134,20 +134,43 @@ MTLTEST_F(MtlProductHelper, givenCompressionFtrEnabledWhenAskingForPageTableMana EXPECT_TRUE(productHelper->isPageTableManagerSupported(hwInfo)); } -MTLTEST_F(MtlProductHelper, givenSteppingWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenThenAllowOnA0) { +MTLTEST_F(MtlProductHelper, givenHwIpVersionWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenAllowOnlyOn12700And12710) { HardwareInfo hwInfo = *defaultHwInfo; auto isRcs = false; + hwInfo.ipVersion.architecture = 12; + hwInfo.ipVersion.release = 70; + hwInfo.ipVersion.revision = 0; + { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, hwInfo); const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_FALSE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); } + hwInfo.ipVersion.revision = 4; + + { + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_FALSE(isBasicWARequired); + } + + hwInfo.ipVersion.release = 71; + hwInfo.ipVersion.revision = 0; + + { + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + + EXPECT_FALSE(isExtendedWARequired); + EXPECT_TRUE(isBasicWARequired); + } + + hwInfo.ipVersion.revision = 4; + { - hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, hwInfo); const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_FALSE(isExtendedWARequired); @@ -226,4 +249,4 @@ MTLTEST_F(MtlProductHelper, givenMtlLpgLgB0WhengetProductMaxPreferredSlmSizeThen compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig); preferredEnumValue = static_cast(productHelper->getProductMaxPreferredSlmSize(hwInfo, preferredEnumValue)); EXPECT_EQ(preferredEnumValue, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K); -} \ No newline at end of file +}