Improve isIpSamplingSupported helper

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
Related-To: NEO-6738
This commit is contained in:
Kamil Kopryk
2022-03-30 16:00:43 +00:00
committed by Compute-Runtime-Automation
parent b81380a879
commit 10be59cb15
10 changed files with 41 additions and 18 deletions

View File

@@ -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<ze_device_thread_t> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const = 0;
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 {
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<ze_device_thread_t> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const override;
std::vector<ze_device_thread_t> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, const uint8_t *bitmask, const size_t bitmaskSize) const override;
bool multiTileCapablePlatform() const override;

View File

@@ -112,9 +112,4 @@ bool L0HwHelperHw<GfxFamily>::forceDefaultUsmCompressionSupport() const {
return false;
}
template <typename GfxFamily>
bool L0HwHelperHw<GfxFamily>::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const {
return false;
}
} // namespace L0

View File

@@ -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<L0HwHelperHw<Family>>() {
l0HwHelperFactory[gfxCore] = &L0HwHelperHw<Family>::get();
}
template <>
bool L0HwHelperHw<Family>::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const {
return NEO::PVC::isXt(hwInfo);
}
template <>
bool L0HwHelperHw<Family>::multiTileCapablePlatform() const {
return true;

View File

@@ -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<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_METRICS", "1"}};

View File

@@ -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 <algorithm>
@@ -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;
}

View File

@@ -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));
}
}

View File

@@ -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;

View File

@@ -338,4 +338,9 @@ bool HwInfoConfigHw<gfxProduct>::isVmBindPatIndexProgrammingSupported() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
return false;
}
} // namespace NEO

View File

@@ -20,3 +20,8 @@ template <>
bool HwInfoConfigHw<gfxProduct>::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const {
return true;
}
template <>
bool HwInfoConfigHw<gfxProduct>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
return PVC::isXt(hwInfo);
}

View File

@@ -327,6 +327,11 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::isComputeDispatchAllWalkerEnableInCfeStateReq
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isVmBindPatIndexProgrammingSupported() const {
return false;