Skip to content

Commit 10be59c

Browse files
Improve isIpSamplingSupported helper
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com> Related-To: NEO-6738
1 parent b81380a commit 10be59c

File tree

10 files changed

+41
-18
lines changed

10 files changed

+41
-18
lines changed

level_zero/core/source/hw_helpers/l0_hw_helper.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class L0HwHelper {
3535
virtual bool imageCompressionSupported(const NEO::HardwareInfo &hwInfo) const = 0;
3636
virtual bool usmCompressionSupported(const NEO::HardwareInfo &hwInfo) const = 0;
3737
virtual bool forceDefaultUsmCompressionSupport() const = 0;
38-
virtual bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const = 0;
3938

4039
virtual void getAttentionBitmaskForSingleThreads(std::vector<ze_device_thread_t> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const = 0;
4140
virtual std::vector<ze_device_thread_t> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, const uint8_t *bitmask, const size_t bitmaskSize) const = 0;
@@ -60,7 +59,6 @@ class L0HwHelperHw : public L0HwHelper {
6059
bool imageCompressionSupported(const NEO::HardwareInfo &hwInfo) const override;
6160
bool usmCompressionSupported(const NEO::HardwareInfo &hwInfo) const override;
6261
bool forceDefaultUsmCompressionSupport() const override;
63-
bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const override;
6462
void getAttentionBitmaskForSingleThreads(std::vector<ze_device_thread_t> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const override;
6563
std::vector<ze_device_thread_t> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, const uint8_t *bitmask, const size_t bitmaskSize) const override;
6664
bool multiTileCapablePlatform() const override;

level_zero/core/source/hw_helpers/l0_hw_helper_base.inl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,4 @@ bool L0HwHelperHw<GfxFamily>::forceDefaultUsmCompressionSupport() const {
112112
return false;
113113
}
114114

115-
template <typename GfxFamily>
116-
bool L0HwHelperHw<GfxFamily>::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const {
117-
return false;
118-
}
119-
120115
} // namespace L0

level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*
66
*/
77

8-
#include "shared/source/xe_hpc_core/hw_cmds_pvc.h"
9-
108
#include "level_zero/core/source/helpers/l0_populate_factory.h"
119
#include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl"
1210
#include "level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl"
@@ -24,11 +22,6 @@ void populateFactoryTable<L0HwHelperHw<Family>>() {
2422
l0HwHelperFactory[gfxCore] = &L0HwHelperHw<Family>::get();
2523
}
2624

27-
template <>
28-
bool L0HwHelperHw<Family>::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const {
29-
return NEO::PVC::isXt(hwInfo);
30-
}
31-
3225
template <>
3326
bool L0HwHelperHw<Family>::multiTileCapablePlatform() const {
3427
return true;

level_zero/core/test/unit_tests/sources/driver/test_driver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "shared/source/os_interface/os_inc_base.h"
1212
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1313
#include "shared/test/common/helpers/ult_hw_config.h"
14+
#include "shared/test/common/helpers/variable_backup.h"
1415
#include "shared/test/common/mocks/mock_compilers.h"
1516
#include "shared/test/common/mocks/mock_io_functions.h"
1617
#include "shared/test/common/mocks/ult_device_factory.h"
@@ -296,6 +297,10 @@ TEST(DriverImpTest, givenMissingMetricApiDependenciesWhenInitializingDriverImpTh
296297
NEO::MockCompilerEnableGuard mock(true);
297298
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
298299
hwInfo.capabilityTable.levelZeroSupported = true;
300+
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
301+
if (hwInfoConfig.isIpSamplingSupported(hwInfo)) {
302+
GTEST_SKIP();
303+
}
299304

300305
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
301306
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_METRICS", "1"}};

level_zero/tools/source/metrics/linux/os_metric_ip_sampling_imp_linux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
#include "shared/source/debug_settings/debug_settings_manager.h"
99
#include "shared/source/helpers/constants.h"
10+
#include "shared/source/os_interface/hw_info_config.h"
1011
#include "shared/source/os_interface/linux/drm_neo.h"
1112
#include "shared/source/os_interface/linux/ioctl_helper.h"
1213
#include "shared/source/os_interface/linux/sys_calls.h"
1314
#include "shared/source/os_interface/os_interface.h"
1415

1516
#include "level_zero/core/source/device/device.h"
1617
#include "level_zero/core/source/device/device_imp.h"
17-
#include "level_zero/core/source/hw_helpers/l0_hw_helper.h"
1818
#include "level_zero/tools/source/metrics/os_metric_ip_sampling.h"
1919

2020
#include <algorithm>
@@ -184,9 +184,9 @@ bool MetricIpSamplingLinuxImp::isNReportsAvailable() {
184184
bool MetricIpSamplingLinuxImp::isDependencyAvailable() {
185185

186186
const auto &hardwareInfo = device.getNEODevice()->getHardwareInfo();
187-
auto &l0HwHelper = L0HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
187+
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
188188

189-
if (!l0HwHelper.isIpSamplingSupported(hardwareInfo)) {
189+
if (!hwInfoConfig.isIpSamplingSupported(hardwareInfo)) {
190190
return false;
191191
}
192192

opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,18 @@ PVCTEST_F(PvcHwInfo, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConve
157157
}
158158
}
159159
}
160+
161+
PVCTEST_F(PvcHwInfo, givenPvcHwInfoConfigWhenIsIpSamplingSupportedThenCorrectResultIsReturned) {
162+
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
163+
auto hwInfo = *defaultHwInfo;
164+
165+
for (auto &deviceId : PVC_XL_IDS) {
166+
hwInfo.platform.usDeviceID = deviceId;
167+
EXPECT_FALSE(hwInfoConfig.isIpSamplingSupported(hwInfo));
168+
}
169+
170+
for (auto &deviceId : PVC_XT_IDS) {
171+
hwInfo.platform.usDeviceID = deviceId;
172+
EXPECT_TRUE(hwInfoConfig.isIpSamplingSupported(hwInfo));
173+
}
174+
}

shared/source/os_interface/hw_info_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class HwInfoConfig {
9898
virtual bool isVmBindPatIndexProgrammingSupported() const = 0;
9999
virtual bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const = 0;
100100
virtual bool useChannelRedForUnusedShaderChannels() const = 0;
101+
virtual bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const = 0;
101102

102103
MOCKABLE_VIRTUAL ~HwInfoConfig() = default;
103104

@@ -180,6 +181,7 @@ class HwInfoConfigHw : public HwInfoConfig {
180181
bool isVmBindPatIndexProgrammingSupported() const override;
181182
bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const override;
182183
bool useChannelRedForUnusedShaderChannels() const override;
184+
bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const override;
183185

184186
protected:
185187
HwInfoConfigHw() = default;

shared/source/os_interface/hw_info_config.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,9 @@ bool HwInfoConfigHw<gfxProduct>::isVmBindPatIndexProgrammingSupported() const {
338338
return false;
339339
}
340340

341+
template <PRODUCT_FAMILY gfxProduct>
342+
bool HwInfoConfigHw<gfxProduct>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
343+
return false;
344+
}
345+
341346
} // namespace NEO

shared/source/xe_hpc_core/pvc/definitions/os_agnostic_hw_info_config_pvc_extra.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@ uint32_t HwInfoConfigHw<gfxProduct>::getThreadEuRatioForScratch(const HardwareIn
1919
template <>
2020
bool HwInfoConfigHw<gfxProduct>::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const {
2121
return true;
22+
}
23+
24+
template <>
25+
bool HwInfoConfigHw<gfxProduct>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
26+
return PVC::isXt(hwInfo);
2227
}

shared/test/common/mocks/mock_hw_info_config.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::isComputeDispatchAllWalkerEnableInCfeStateReq
327327
return false;
328328
}
329329

330+
template <>
331+
bool HwInfoConfigHw<IGFX_UNKNOWN>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
332+
return false;
333+
}
334+
330335
template <>
331336
bool HwInfoConfigHw<IGFX_UNKNOWN>::isVmBindPatIndexProgrammingSupported() const {
332337
return false;
@@ -342,4 +347,4 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::useChannelRedForUnusedShaderChannels() const
342347
return false;
343348
}
344349

345-
} //namespace NEO
350+
} // namespace NEO

0 commit comments

Comments
 (0)