From c82038565e7abfc49ba8c7466c641e718900e6f5 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Wed, 9 Nov 2022 13:01:21 +0000 Subject: [PATCH] Unify isTimestampWaitSupportedForEvents helper function Related-To: NEO-6853 Signed-off-by: Kamil Kopryk No need to keep isTimestampWaitSupportedForEvents function in hwHelper and in hwInfoConfig helper, move it to hwInfoConfig instead. --- opencl/source/event/event.cpp | 5 ++--- opencl/test/unit_test/event/event_tests.cpp | 5 ++--- shared/source/helpers/hw_helper.h | 4 ---- shared/source/helpers/hw_helper_bdw_and_later.inl | 5 ----- shared/source/helpers/hw_helper_xehp_and_later.inl | 5 ----- shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp | 5 ----- .../os_agnostic_hw_info_config_xe_hpc_core.inl | 5 +++++ shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp | 6 ------ .../test/common/test_macros/header/common_matchers.h | 1 + .../unit_test/os_interface/hw_info_config_tests.cpp | 8 +++++--- .../xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp | 8 +++++++- .../xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp | 1 + .../xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp | 11 ++++------- .../xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp | 11 ++++++++--- 14 files changed, 35 insertions(+), 45 deletions(-) diff --git a/opencl/source/event/event.cpp b/opencl/source/event/event.cpp index 90eaae3cf2..1f687f678c 100644 --- a/opencl/source/event/event.cpp +++ b/opencl/source/event/event.cpp @@ -688,10 +688,9 @@ bool Event::isCompleted() { } bool Event::isWaitForTimestampsEnabled() const { - const auto &hwInfo = cmdQueue->getDevice().getHardwareInfo(); - const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); + const auto &productHelper = cmdQueue->getDevice().getRootDeviceEnvironment().getHelper(); auto enabled = cmdQueue->isTimestampWaitEnabled(); - enabled &= hwHelper.isTimestampWaitSupportedForEvents(hwInfo); + enabled &= productHelper.isTimestampWaitSupportedForEvents(); switch (DebugManager.flags.EnableTimestampWaitForEvents.get()) { case 0: diff --git a/opencl/test/unit_test/event/event_tests.cpp b/opencl/test/unit_test/event/event_tests.cpp index 0955a3b483..8cc757efca 100644 --- a/opencl/test/unit_test/event/event_tests.cpp +++ b/opencl/test/unit_test/event/event_tests.cpp @@ -1843,9 +1843,8 @@ TEST(EventTimestampTest, givenEnableTimestampWaitWhenCheckIsTimestampWaitEnabled { DebugManager.flags.EnableTimestampWaitForEvents.set(-1); - const auto &hwInfo = mockDevice->getHardwareInfo(); - const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - EXPECT_EQ(event.isWaitForTimestampsEnabled(), hwHelper.isTimestampWaitSupportedForEvents(hwInfo)); + const auto &productHelper = mockDevice->getRootDeviceEnvironment().getHelper(); + EXPECT_EQ(event.isWaitForTimestampsEnabled(), productHelper.isTimestampWaitSupportedForEvents()); } { diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index ec036e7c88..296f128cad 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -60,7 +60,6 @@ class HwHelper { static uint32_t getHighestEnabledSlice(const HardwareInfo &hwInfo); virtual bool timestampPacketWriteSupported() const = 0; virtual bool isTimestampWaitSupportedForQueues() const = 0; - virtual bool isTimestampWaitSupportedForEvents(const HardwareInfo &hwInfo) const = 0; virtual bool isUpdateTaskCountFromWaitSupported() const = 0; virtual size_t getRenderSurfaceStateSize() const = 0; virtual void setRenderSurfaceStateForScratchResource(const RootDeviceEnvironment &rootDeviceEnvironment, @@ -222,9 +221,6 @@ class HwHelperHw : public HwHelper { bool timestampPacketWriteSupported() const override; bool isTimestampWaitSupportedForQueues() const override; - - bool isTimestampWaitSupportedForEvents(const HardwareInfo &hwInfo) const override; - bool isUpdateTaskCountFromWaitSupported() const override; bool is1MbAlignmentSupported(const HardwareInfo &hwInfo, bool isCompressionEnabled) const override; diff --git a/shared/source/helpers/hw_helper_bdw_and_later.inl b/shared/source/helpers/hw_helper_bdw_and_later.inl index fb830e0eac..0f08c3a6f0 100644 --- a/shared/source/helpers/hw_helper_bdw_and_later.inl +++ b/shared/source/helpers/hw_helper_bdw_and_later.inl @@ -45,11 +45,6 @@ bool HwHelperHw::isTimestampWaitSupportedForQueues() const { return false; } -template -bool HwHelperHw::isTimestampWaitSupportedForEvents(const HardwareInfo &hwInfo) const { - return false; -} - template bool HwHelperHw::isUpdateTaskCountFromWaitSupported() const { return false; diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index 7be162a10f..3dbc62e451 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -60,11 +60,6 @@ bool HwHelperHw::isTimestampWaitSupportedForQueues() const { return false; } -template -bool HwHelperHw::isTimestampWaitSupportedForEvents(const HardwareInfo &hwInfo) const { - return false; -} - template bool HwHelperHw::isUpdateTaskCountFromWaitSupported() const { return false; diff --git a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp index 0747957269..0396628580 100644 --- a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp @@ -406,11 +406,6 @@ bool HwHelperHw::isTimestampWaitSupportedForQueues() const { return true; } -template <> -bool HwHelperHw::isTimestampWaitSupportedForEvents(const HardwareInfo &hwInfo) const { - return true; -} - template <> uint64_t HwHelperHw::getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const { /* diff --git a/shared/source/xe_hpc_core/os_agnostic_hw_info_config_xe_hpc_core.inl b/shared/source/xe_hpc_core/os_agnostic_hw_info_config_xe_hpc_core.inl index aab0ab55c7..8f7eb90bcd 100644 --- a/shared/source/xe_hpc_core/os_agnostic_hw_info_config_xe_hpc_core.inl +++ b/shared/source/xe_hpc_core/os_agnostic_hw_info_config_xe_hpc_core.inl @@ -25,6 +25,11 @@ bool HwInfoConfigHw::isFlushTaskAllowed() const { return true; } +template <> +bool HwInfoConfigHw::isTimestampWaitSupportedForEvents() const { + return true; +} + template <> std::pair HwInfoConfigHw::isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs) const { auto isBasicWARequired = false; diff --git a/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp b/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp index 7c6a6a08ee..736afd4ef4 100644 --- a/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/hw_helper_xe_hpg_core.cpp @@ -142,12 +142,6 @@ bool HwHelperHw::disableL3CacheForDebug(const HardwareInfo &hwInfo) cons return isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo); } -template <> -bool HwHelperHw::isTimestampWaitSupportedForEvents(const HardwareInfo &hwInfo) const { - auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - return hwInfoConfig.isTimestampWaitSupportedForEvents(); -} - template class HwHelperHw; template class FlatBatchBufferHelperHw; template struct MemorySynchronizationCommands; diff --git a/shared/test/common/test_macros/header/common_matchers.h b/shared/test/common/test_macros/header/common_matchers.h index 05a11505d2..3bfd37b448 100644 --- a/shared/test/common/test_macros/header/common_matchers.h +++ b/shared/test/common/test_macros/header/common_matchers.h @@ -41,6 +41,7 @@ using IsXeHpcOrXeHpgCore = IsAnyGfxCores; using IsNotXeHpOrXeHpgCore = IsNotAnyGfxCores; using IsNotXeHpOrXeHpcCore = IsNotAnyGfxCores; +using IsNotXeHpgOrXeHpcCore = IsNotAnyGfxCores; using IsSKL = IsProduct; using IsKBL = IsProduct; diff --git a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp index 788878dac3..95203f1e2e 100644 --- a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -10,6 +10,7 @@ #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/source/unified_memory/usm_memory_support.h" +#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/gtest_helpers.h" #include "shared/test/common/helpers/mock_hw_info_config_hw.h" @@ -21,6 +22,7 @@ #include "gtest/gtest.h" using namespace NEO; +using ProductHelperTest = Test; HWTEST_F(HwInfoConfigTest, givenDebugFlagSetWhenAskingForHostMemCapabilitesThenReturnCorrectValue) { DebugManagerStateRestore restore; @@ -405,9 +407,9 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfPatIndexProgrammingSuppor EXPECT_FALSE(hwInfoConfig.isVmBindPatIndexProgrammingSupported()); } -HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfIsTimestampWaitSupportedForEventsThenFalseIsReturned, IsNotXeHpgCore) { - const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily); - EXPECT_FALSE(hwInfoConfig.isTimestampWaitSupportedForEvents()); +HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTimestampWaitSupportedForEventsThenFalseIsReturned, IsNotXeHpgOrXeHpcCore) { + const auto &productHelper = getHelper(); + EXPECT_FALSE(productHelper.isTimestampWaitSupportedForEvents()); } HWTEST_F(HwInfoConfigTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) { diff --git a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp index fc375ad805..f431e7a0f0 100644 --- a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp @@ -65,7 +65,13 @@ XE_HPC_CORETEST_F(HwHelperXeHpcCoreTest, givenHwHelperWhenGettingIfRevisionSpeci XE_HPC_CORETEST_F(HwHelperXeHpcCoreTest, givenHwHelperWhenCheckTimestampWaitSupportThenReturnTrue) { auto &helper = HwHelper::get(renderCoreFamily); EXPECT_TRUE(helper.isTimestampWaitSupportedForQueues()); - EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents(*defaultHwInfo)); +} + +using ProductHelperTestXeHpcCore = Test; + +XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckTimestampWaitSupportForEventsThenReturnTrue) { + auto &helper = getHelper(); + EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents()); } XE_HPC_CORETEST_F(HwHelperXeHpcCoreTest, givenXeHPCPlatformWhenCheckAssignEngineRoundRobinSupportedThenReturnTrue) { diff --git a/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp index 79efb0cf9c..87d4804254 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp @@ -29,3 +29,4 @@ HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateKe HWTEST_EXCLUDE_PRODUCT(SbaTest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSettingsThenProgramCorrectL1CachePolicy_IsAtLeastXeHpgCore, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(XeHpgSbaTest, givenSpecificProductFamilyWhenAppendingSbaThenProgramWBPL1CachePolicy, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(HwHelperTest, GivenZeroSlmSizeWhenComputeSlmSizeIsCalledThenCorrectValueIsReturned, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckTimestampWaitSupportForEventsThenReturnFalse, IGFX_DG2); diff --git a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp index 5d32737e68..0ae5d62180 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp @@ -19,6 +19,7 @@ using namespace NEO; using HwInfoConfigTestDg2 = Test; +using ProductHelperTestDg2 = Test; DG2TEST_F(HwInfoConfigTestDg2, givenDg2ConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) { HardwareInfo hwInfo = *defaultHwInfo; @@ -412,13 +413,9 @@ DG2TEST_F(HwInfoConfigTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScratc EXPECT_THROW(hwHelper.getComputeUnitsUsedForScratch(&hwInfo), std::exception); } -HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHpgCore, givenHwHelperWhenCheckTimestampWaitSupportThenReturnFalse, IGFX_DG2); -DG2TEST_F(HwInfoConfigTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { - HardwareInfo hwInfo = *defaultHwInfo; - auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - auto &hwInfoConfig = *HwInfoConfig::get(productFamily); - EXPECT_TRUE(hwInfoConfig.isTimestampWaitSupportedForEvents()); - EXPECT_TRUE(hwHelper.isTimestampWaitSupportedForEvents(hwInfo)); +DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { + auto &helper = getHelper(); + EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents()); } DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { diff --git a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp index a6b6c9d811..fce9312a2b 100644 --- a/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/hw_helper_tests_xe_hpg_core.cpp @@ -18,6 +18,7 @@ #include "hw_cmds_xe_hpg_core_base.h" using HwHelperTestXeHpgCore = HwHelperTest; +using ProductHelperTestXeHpgCore = Test; XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenDifferentBufferSizesWhenEnableStatelessCompressionThenEveryBufferSizeIsSuitableForCompression) { DebugManagerStateRestore restore; @@ -154,10 +155,14 @@ XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenXeHPAndLaterPlatformWhenCheckAssig EXPECT_FALSE(hwHelper.isAssignEngineRoundRobinSupported(*defaultHwInfo)); } -XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenHwHelperWhenCheckTimestampWaitSupportThenReturnFalse) { - auto &helper = HwHelper::get(renderCoreFamily); +XE_HPG_CORETEST_F(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckTimestampWaitSupportForEventsThenReturnFalse) { + auto &helper = getHelper(); + EXPECT_FALSE(helper.isTimestampWaitSupportedForEvents()); +} + +XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenCoreHelperWhenCheckTimestampWaitSupportForQueuesThenReturnFalse) { + auto &helper = getHelper(); EXPECT_FALSE(helper.isTimestampWaitSupportedForQueues()); - EXPECT_FALSE(helper.isTimestampWaitSupportedForEvents(*defaultHwInfo)); } XE_HPG_CORETEST_F(HwHelperTestXeHpgCore, givenDisablePipeControlFlagIsEnabledWhenLocalMemoryIsEnabledThenReturnTrueAndProgramPipeControl) {