diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper.h b/level_zero/core/source/hw_helpers/l0_hw_helper.h index 8986561021..bf835a5ec2 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper.h +++ b/level_zero/core/source/hw_helpers/l0_hw_helper.h @@ -35,7 +35,6 @@ class L0HwHelper { virtual bool imageCompressionSupported(const NEO::HardwareInfo &hwInfo) const = 0; virtual bool usmCompressionSupported(const NEO::HardwareInfo &hwInfo) const = 0; virtual bool forceDefaultUsmCompressionSupport() const = 0; - virtual bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const = 0; virtual void getAttentionBitmaskForSingleThreads(std::vector &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr &bitmask, size_t &bitmaskSize) const = 0; virtual std::vector getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, const uint8_t *bitmask, const size_t bitmaskSize) const = 0; @@ -60,7 +59,6 @@ class L0HwHelperHw : public L0HwHelper { bool imageCompressionSupported(const NEO::HardwareInfo &hwInfo) const override; bool usmCompressionSupported(const NEO::HardwareInfo &hwInfo) const override; bool forceDefaultUsmCompressionSupport() const override; - bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const override; void getAttentionBitmaskForSingleThreads(std::vector &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr &bitmask, size_t &bitmaskSize) const override; std::vector getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, const uint8_t *bitmask, const size_t bitmaskSize) const override; bool multiTileCapablePlatform() const override; diff --git a/level_zero/core/source/hw_helpers/l0_hw_helper_base.inl b/level_zero/core/source/hw_helpers/l0_hw_helper_base.inl index ff3126e602..4cd863364c 100644 --- a/level_zero/core/source/hw_helpers/l0_hw_helper_base.inl +++ b/level_zero/core/source/hw_helpers/l0_hw_helper_base.inl @@ -112,9 +112,4 @@ bool L0HwHelperHw::forceDefaultUsmCompressionSupport() const { return false; } -template -bool L0HwHelperHw::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const { - return false; -} - } // namespace L0 diff --git a/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp b/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp index afce869e38..97d7be5b31 100644 --- a/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp +++ b/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp @@ -5,8 +5,6 @@ * */ -#include "shared/source/xe_hpc_core/hw_cmds_pvc.h" - #include "level_zero/core/source/helpers/l0_populate_factory.h" #include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl" #include "level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl" @@ -24,11 +22,6 @@ void populateFactoryTable>() { l0HwHelperFactory[gfxCore] = &L0HwHelperHw::get(); } -template <> -bool L0HwHelperHw::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const { - return NEO::PVC::isXt(hwInfo); -} - template <> bool L0HwHelperHw::multiTileCapablePlatform() const { return true; diff --git a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp index f085e8e4c4..743dd55dc5 100644 --- a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp +++ b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp @@ -11,6 +11,7 @@ #include "shared/source/os_interface/os_inc_base.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/ult_hw_config.h" +#include "shared/test/common/helpers/variable_backup.h" #include "shared/test/common/mocks/mock_compilers.h" #include "shared/test/common/mocks/mock_io_functions.h" #include "shared/test/common/mocks/ult_device_factory.h" @@ -296,6 +297,10 @@ TEST(DriverImpTest, givenMissingMetricApiDependenciesWhenInitializingDriverImpTh NEO::MockCompilerEnableGuard mock(true); NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); hwInfo.capabilityTable.levelZeroSupported = true; + const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); + if (hwInfoConfig.isIpSamplingSupported(hwInfo)) { + GTEST_SKIP(); + } VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); std::unordered_map mockableEnvs = {{"ZET_ENABLE_METRICS", "1"}}; diff --git a/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp b/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp index 379d1e3107..86edf10c44 100644 --- a/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp +++ b/level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp @@ -7,6 +7,7 @@ #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/helpers/constants.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/linux/drm_neo.h" #include "shared/source/os_interface/linux/ioctl_helper.h" #include "shared/source/os_interface/linux/sys_calls.h" @@ -14,7 +15,6 @@ #include "level_zero/core/source/device/device.h" #include "level_zero/core/source/device/device_imp.h" -#include "level_zero/core/source/hw_helpers/l0_hw_helper.h" #include "level_zero/tools/source/metrics/os_metric_ip_sampling.h" #include @@ -184,9 +184,9 @@ bool MetricIpSamplingLinuxImp::isNReportsAvailable() { bool MetricIpSamplingLinuxImp::isDependencyAvailable() { const auto &hardwareInfo = device.getNEODevice()->getHardwareInfo(); - auto &l0HwHelper = L0HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); + const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hardwareInfo.platform.eProductFamily); - if (!l0HwHelper.isIpSamplingSupported(hardwareInfo)) { + if (!hwInfoConfig.isIpSamplingSupported(hardwareInfo)) { return false; } diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp index de4677b404..636287b7da 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp @@ -157,3 +157,18 @@ PVCTEST_F(PvcHwInfo, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConve } } } + +PVCTEST_F(PvcHwInfo, givenPvcHwInfoConfigWhenIsIpSamplingSupportedThenCorrectResultIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); + auto hwInfo = *defaultHwInfo; + + for (auto &deviceId : PVC_XL_IDS) { + hwInfo.platform.usDeviceID = deviceId; + EXPECT_FALSE(hwInfoConfig.isIpSamplingSupported(hwInfo)); + } + + for (auto &deviceId : PVC_XT_IDS) { + hwInfo.platform.usDeviceID = deviceId; + EXPECT_TRUE(hwInfoConfig.isIpSamplingSupported(hwInfo)); + } +} diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index af3498129a..317d6b4263 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -98,6 +98,7 @@ class HwInfoConfig { virtual bool isVmBindPatIndexProgrammingSupported() const = 0; virtual bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const = 0; virtual bool useChannelRedForUnusedShaderChannels() const = 0; + virtual bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const = 0; MOCKABLE_VIRTUAL ~HwInfoConfig() = default; @@ -180,6 +181,7 @@ class HwInfoConfigHw : public HwInfoConfig { bool isVmBindPatIndexProgrammingSupported() const override; bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const override; bool useChannelRedForUnusedShaderChannels() const override; + bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const 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 6bbe4f1bc4..19d45960f2 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -338,4 +338,9 @@ bool HwInfoConfigHw::isVmBindPatIndexProgrammingSupported() const { return false; } +template +bool HwInfoConfigHw::isIpSamplingSupported(const HardwareInfo &hwInfo) const { + return false; +} + } // namespace NEO diff --git a/shared/source/xe_hpc_core/pvc/definitions/os_agnostic_hw_info_config_pvc_extra.inl b/shared/source/xe_hpc_core/pvc/definitions/os_agnostic_hw_info_config_pvc_extra.inl index a58f6275c6..9264609d12 100644 --- a/shared/source/xe_hpc_core/pvc/definitions/os_agnostic_hw_info_config_pvc_extra.inl +++ b/shared/source/xe_hpc_core/pvc/definitions/os_agnostic_hw_info_config_pvc_extra.inl @@ -19,4 +19,9 @@ uint32_t HwInfoConfigHw::getThreadEuRatioForScratch(const HardwareIn template <> bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { return true; +} + +template <> +bool HwInfoConfigHw::isIpSamplingSupported(const HardwareInfo &hwInfo) const { + return PVC::isXt(hwInfo); } \ No newline at end of file diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index 3d0b24d876..10cb96a8b1 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -327,6 +327,11 @@ bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateReq return false; } +template <> +bool HwInfoConfigHw::isIpSamplingSupported(const HardwareInfo &hwInfo) const { + return false; +} + template <> bool HwInfoConfigHw::isVmBindPatIndexProgrammingSupported() const { return false; @@ -342,4 +347,4 @@ bool HwInfoConfigHw::useChannelRedForUnusedShaderChannels() const return false; } -} //namespace NEO +} // namespace NEO