From 18af46296df715e7971558bc42bd8c0b3a5697dd Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Fri, 2 Sep 2022 14:23:24 +0000 Subject: [PATCH] Optimize programming of front end by selecting correct hardware Related-To: NEO-5019 Signed-off-by: Zbigniew Zdanowicz --- .../test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp | 6 +++--- .../sources/cmdlist/test_cmdlist_xehp_and_later.cpp | 8 ++++---- shared/source/command_stream/stream_properties.cpp | 4 ++-- shared/source/os_interface/hw_info_config.h | 4 ++-- shared/source/os_interface/hw_info_config.inl | 6 +++--- shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp | 9 ++------- .../xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl | 2 +- shared/test/common/mocks/mock_hw_info_config.cpp | 5 ----- .../command_stream/stream_properties_tests_common.cpp | 4 ++-- .../test/unit_test/os_interface/hw_info_config_tests.cpp | 4 ++-- .../unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp | 2 +- 11 files changed, 22 insertions(+), 32 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index 960654d987..1891f45488 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -52,8 +52,8 @@ HWTEST2_F(MultiTileCopyEngineCommandListTest, GivenMultiTileDeviceWhenCreatingCo using CommandListExecuteImmediate = Test; HWTEST2_F(CommandListExecuteImmediate, whenExecutingCommandListImmediateWithFlushTaskThenRequiredStreamStateIsCorrectlyReported, IsAtLeastSkl) { - auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - auto &hwInfoConfig = *NEO::HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + auto &hwHelper = NEO::HwHelper::get(device->getHwInfo().platform.eRenderCoreFamily); + auto &hwInfoConfig = *NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily); std::unique_ptr commandList; const ze_command_queue_desc_t desc = {}; ze_result_t returnValue; @@ -73,7 +73,7 @@ HWTEST2_F(CommandListExecuteImmediate, whenExecutingCommandListImmediateWithFlus NEO::StateComputeModePropertiesSupport scmPropertiesSupport = {}; hwInfoConfig.fillScmPropertiesSupportStructure(scmPropertiesSupport); NEO::FrontEndPropertiesSupport frontEndPropertiesSupport = {}; - hwInfoConfig.fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport); + hwInfoConfig.fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport, device->getHwInfo()); int expectedDisableOverdispatch = hwInfoConfig.isDisableOverdispatchAvailable(*defaultHwInfo); int32_t expectedIsCoherencyRequired = scmPropertiesSupport.coherencyRequired ? hwHelper.forceNonGpuCoherencyWA(true) : -1; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp index a2b1afce49..5415e7ed36 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp @@ -210,8 +210,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenVariousKernelsWhenUpdateStreamProp EXPECT_EQ(-1, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value); EXPECT_EQ(0u, pCommandList->commandsToPatch.size()); - auto &hwInfoConfig = *NEO::HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - int32_t expectedDispatchAllWalkerEnable = hwInfoConfig.getFrontEndPropertyComputeDispatchAllWalkerSupport() ? 0 : -1; + auto &hwInfoConfig = *NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily); + int32_t expectedDispatchAllWalkerEnable = hwInfoConfig.isComputeDispatchAllWalkerEnableInCfeStateRequired(device->getHwInfo()) ? 0 : -1; pCommandList->updateStreamProperties(defaultKernel, false, false); @@ -288,8 +288,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenVariousKernelsAndPatchingDisallowe pCommandList->updateStreamProperties(defaultKernel, false, false); pCommandList->updateStreamProperties(cooperativeKernel, false, true); - const auto &hwInfoConfig = *NEO::HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - size_t expectedCmdsToPatch = hwInfoConfig.getFrontEndPropertyComputeDispatchAllWalkerSupport() ? 1 : 0; + const auto &hwInfoConfig = *NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily); + size_t expectedCmdsToPatch = hwInfoConfig.isComputeDispatchAllWalkerEnableInCfeStateRequired(device->getHwInfo()) ? 1 : 0; EXPECT_EQ(expectedCmdsToPatch, pCommandList->commandsToPatch.size()); pCommandList->reset(); diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index a9c397d07b..55e539ebd5 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -105,7 +105,7 @@ void StateComputeModeProperties::clearIsDirty() { void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableEUFusion, bool disableOverdispatch, int32_t engineInstancedDevice, const HardwareInfo &hwInfo) { if (this->propertiesSupportLoaded == false) { auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - hwInfoConfig.fillFrontEndPropertiesSupportStructure(this->frontEndPropertiesSupport); + hwInfoConfig.fillFrontEndPropertiesSupportStructure(this->frontEndPropertiesSupport, hwInfo); this->propertiesSupportLoaded = true; } @@ -131,7 +131,7 @@ void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableEUF void FrontEndProperties::setPropertySingleSliceDispatchCcsMode(int32_t engineInstancedDevice, const HardwareInfo &hwInfo) { if (this->propertiesSupportLoaded == false) { auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - hwInfoConfig.fillFrontEndPropertiesSupportStructure(this->frontEndPropertiesSupport); + hwInfoConfig.fillFrontEndPropertiesSupportStructure(this->frontEndPropertiesSupport, hwInfo); this->propertiesSupportLoaded = true; } this->singleSliceDispatchCcsMode.isDirty = false; diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index 9a71e9195c..2b3bc04d5c 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -161,7 +161,7 @@ class HwInfoConfig { virtual bool getPreemptionDbgPropertyCsrSurfaceSupport() const = 0; virtual void fillScmPropertiesSupportStructure(StateComputeModePropertiesSupport &propertiesSupport) = 0; - virtual void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport) = 0; + virtual void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) = 0; MOCKABLE_VIRTUAL ~HwInfoConfig() = default; @@ -292,7 +292,7 @@ class HwInfoConfigHw : public HwInfoConfig { bool getPreemptionDbgPropertyCsrSurfaceSupport() const override; void fillScmPropertiesSupportStructure(StateComputeModePropertiesSupport &propertiesSupport) override; - void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport) override; + void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) override; protected: HwInfoConfigHw() = default; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 799d4cadbd..be27dc02d3 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -393,7 +393,7 @@ uint32_t HwInfoConfigHw::getThreadEuRatioForScratch(const HardwareIn template bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { - return false; + return getFrontEndPropertyComputeDispatchAllWalkerSupport(); } template @@ -617,8 +617,8 @@ bool HwInfoConfigHw::getFrontEndPropertySingleSliceDispatchCcsModeSu } template -void HwInfoConfigHw::fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport) { - propertiesSupport.computeDispatchAllWalker = getFrontEndPropertyComputeDispatchAllWalkerSupport(); +void HwInfoConfigHw::fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) { + propertiesSupport.computeDispatchAllWalker = isComputeDispatchAllWalkerEnableInCfeStateRequired(hwInfo); propertiesSupport.disableEuFusion = getFrontEndPropertyDisableEuFusionSupport(); propertiesSupport.disableOverdispatch = getFrontEndPropertyDisableOverDispatchSupport(); propertiesSupport.singleSliceDispatchCcsMode = getFrontEndPropertySingleSliceDispatchCcsModeSupport(); diff --git a/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp b/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp index f390ad9129..8f2f9232c4 100644 --- a/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp @@ -26,13 +26,8 @@ void PreambleHelper::appendProgramVFEState(const HardwareInfo &hwInfo, c command->setComputeOverdispatchDisable(streamProperties.frontEndState.disableOverdispatch.value == 1); command->setSingleSliceDispatchCcsMode(streamProperties.frontEndState.singleSliceDispatchCcsMode.value == 1); - const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - - if (hwInfoConfig.getSteppingFromHwRevId(hwInfo) >= REVISION_B) { - const auto programComputeDispatchAllWalkerEnableInCfeState = hwInfoConfig.isComputeDispatchAllWalkerEnableInCfeStateRequired(hwInfo); - if (programComputeDispatchAllWalkerEnableInCfeState && streamProperties.frontEndState.computeDispatchAllWalkerEnable.value > 0) { - command->setComputeDispatchAllWalkerEnable(true); - } + if (streamProperties.frontEndState.computeDispatchAllWalkerEnable.value > 0) { + command->setComputeDispatchAllWalkerEnable(true); } if (DebugManager.flags.CFEComputeDispatchAllWalkerEnable.get() != -1) { diff --git a/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl b/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl index 878696c52f..abacedff06 100644 --- a/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl +++ b/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl @@ -192,7 +192,7 @@ uint32_t HwInfoConfigHw::getThreadEuRatioForScratch(const HardwareIn template <> bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { - return true; + return getSteppingFromHwRevId(hwInfo) >= REVISION_B; } template <> diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index f4f17fdf20..65743f0dc4 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -335,11 +335,6 @@ uint32_t HwInfoConfigHw::getThreadEuRatioForScratch(const Hardware return 8u; } -template <> -bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { - return false; -} - template <> bool HwInfoConfigHw::isIpSamplingSupported(const HardwareInfo &hwInfo) const { return false; diff --git a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp index a996f655f7..3f31600e3a 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp @@ -54,7 +54,7 @@ TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectVal FrontEndPropertiesSupport frontEndPropertiesSupport = {}; auto hwInfoConfig = HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - hwInfoConfig->fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport); + hwInfoConfig->fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport, *defaultHwInfo); for (auto isEngineInstanced : ::testing::Bool()) { for (auto isCooperativeKernel : ::testing::Bool()) { @@ -245,7 +245,7 @@ TEST(StreamPropertiesTests, givenOtherFrontEndPropertiesStructWhenSetPropertiesI TEST(StreamPropertiesTests, givenSingleDispatchCcsFrontEndPropertyWhenSettingPropertyAndCheckIfSupportedThenExpectCorrectState) { FrontEndPropertiesSupport fePropertiesSupport{}; auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - hwInfoConfig.fillFrontEndPropertiesSupportStructure(fePropertiesSupport); + hwInfoConfig.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, *defaultHwInfo); MockFrontEndProperties feProperties{}; EXPECT_FALSE(feProperties.propertiesSupportLoaded); 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 4e8d99ab42..f93a2f7664 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 @@ -526,8 +526,8 @@ HWTEST_F(HwInfoConfigTest, WhenFillingFrontEndPropertiesSupportThenExpectUseCorr auto hwInfoConfig = HwInfoConfig::get(pInHwInfo.platform.eProductFamily); - hwInfoConfig->fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport); - EXPECT_EQ(hwInfoConfig->getFrontEndPropertyComputeDispatchAllWalkerSupport(), frontEndPropertiesSupport.computeDispatchAllWalker); + hwInfoConfig->fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport, pInHwInfo); + EXPECT_EQ(hwInfoConfig->isComputeDispatchAllWalkerEnableInCfeStateRequired(pInHwInfo), frontEndPropertiesSupport.computeDispatchAllWalker); EXPECT_EQ(hwInfoConfig->getFrontEndPropertyDisableEuFusionSupport(), frontEndPropertiesSupport.disableEuFusion); EXPECT_EQ(hwInfoConfig->getFrontEndPropertyDisableOverDispatchSupport(), frontEndPropertiesSupport.disableOverdispatch); EXPECT_EQ(hwInfoConfig->getFrontEndPropertySingleSliceDispatchCcsModeSupport(), frontEndPropertiesSupport.singleSliceDispatchCcsMode); diff --git a/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp index e3052ca941..5b348e0b9d 100644 --- a/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp @@ -55,7 +55,7 @@ XE_HPC_CORETEST_F(PreambleCfeState, givenKernelExecutionTypeConcurrentAndRevisio ASSERT_NE(cmdList.end(), cfeStateIt); auto cfeState = reinterpret_cast(*cfeStateIt); - uint32_t expectedValue = hwInfoConfig.isComputeDispatchAllWalkerEnableInCfeStateRequired(hwInfo); + uint32_t expectedValue = streamProperties.frontEndState.computeDispatchAllWalkerEnable.isDirty ? streamProperties.frontEndState.computeDispatchAllWalkerEnable.value : 0; EXPECT_EQ(expectedValue, cfeState->getComputeDispatchAllWalkerEnable()); EXPECT_FALSE(cfeState->getSingleSliceDispatchCcsMode()); }