Metrics Ip Sampling Fix Inclusions

This patch fixes isolation build issues
due to inclusions.

Related-To: LOCI-2707

Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
Joshua Santosh Ranjan 2022-02-22 12:53:28 +00:00 committed by Compute-Runtime-Automation
parent 8377b9d73c
commit d24c6cedfb
8 changed files with 82 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -35,6 +35,7 @@ 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;
@ -58,6 +59,7 @@ 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;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -111,4 +111,10 @@ template <typename GfxFamily>
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

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -22,6 +22,19 @@ void populateFactoryTable<L0HwHelperHw<Family>>() {
l0HwHelperFactory[gfxCore] = &L0HwHelperHw<Family>::get();
}
template <>
bool L0HwHelperHw<Family>::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const {
if (hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[0] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[1] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[2] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[3] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[4]) {
return true;
}
return false;
}
template class L0HwHelperHw<Family>;
} // namespace L0

View File

@ -11,10 +11,10 @@
#include "shared/source/os_interface/linux/ioctl_helper.h"
#include "shared/source/os_interface/linux/sys_calls.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/xe_hpc_core/hw_cmds_base.h"
#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>
@ -163,20 +163,10 @@ bool MetricIpSamplingLinuxImp::isNReportsAvailable() {
bool MetricIpSamplingLinuxImp::isDependencyAvailable() {
auto hwInfo = device.getNEODevice()->getHardwareInfo();
auto isSupportedDevice = false;
const auto &hardwareInfo = device.getNEODevice()->getHardwareInfo();
auto &l0HwHelper = L0HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
if (hwInfo.platform.eProductFamily == IGFX_PVC) {
if (hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[0] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[1] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[2] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[3] ||
hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[4]) {
isSupportedDevice = true;
}
}
if (!isSupportedDevice) {
if (!l0HwHelper.isIpSamplingSupported(hardwareInfo)) {
return false;
}

View File

@ -7,18 +7,21 @@
set(L0_TOOLS_METRICS_LINUX_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_metric_oa_query_pool_linux.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_metric_ip_sampling_linux.cpp
)
if(NEO_ENABLE_i915_PRELIM_DETECTION)
list(APPEND L0_TOOLS_METRICS_LINUX_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/test_metric_ip_sampling_linux_prelim.cpp
)
endif()
if(TESTS_PVC)
if(NEO_ENABLE_i915_PRELIM_DETECTION)
list(APPEND L0_TOOLS_METRICS_LINUX_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/test_metric_ip_sampling_linux_pvc_prelim.cpp
)
endif()
if("${BRANCH_TYPE}" STREQUAL "")
list(APPEND L0_TOOLS_METRICS_LINUX_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/test_metric_ip_sampling_linux_upstream.cpp
)
if("${BRANCH_TYPE}" STREQUAL "")
list(APPEND L0_TOOLS_METRICS_LINUX_TESTS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/test_metric_ip_sampling_linux_pvc_upstream.cpp
)
endif()
endif()
if(UNIX)

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/test_macros/test.h"
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
#include "level_zero/tools/source/metrics/os_metric_ip_sampling.h"
namespace L0 {
namespace ult {
class MetricIpSamplingLinuxTest : public DeviceFixture,
public ::testing::Test {
public:
void SetUp() override {
DeviceFixture::SetUp();
metricIpSamplingOsInterface = MetricIpSamplingOsInterface::create(static_cast<L0::Device &>(*device));
}
void TearDown() override {
DeviceFixture::TearDown();
}
std::unique_ptr<MetricIpSamplingOsInterface> metricIpSamplingOsInterface = nullptr;
};
HWTEST2_F(MetricIpSamplingLinuxTest, GivenUnsupportedProductFamilyIsUsedWhenIsDependencyAvailableIsCalledThenReturnFailure, IsNotXeHpcCore) {
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable());
}
} // namespace ult
} // namespace L0

View File

@ -16,6 +16,8 @@
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
#include "level_zero/tools/source/metrics/os_metric_ip_sampling.h"
#include "hw_cmds.h"
namespace NEO {
namespace SysCalls {
extern int closeFuncRetVal;
@ -184,13 +186,6 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenPollIsFailureWhenisNReportsAvail
EXPECT_FALSE(metricIpSamplingOsInterface->isNReportsAvailable());
}
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenUnsupportedProductFamilyIsUsedWhenIsDependencyAvailableIsCalledThenReturnFailure, IsDG2) {
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo->platform.eProductFamily = productFamily;
EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable());
}
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndUnsupportedDeviceIdIsUsedWhenIsDependencyAvailableIsCalledThenReturnFailure, IsPVC) {
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();

View File

@ -11,6 +11,8 @@
#include "level_zero/tools/source/metrics/os_metric_ip_sampling.h"
#include "level_zero/tools/test/unit_tests/sources/metrics/mock_metric_oa.h"
#include "hw_cmds.h"
namespace L0 {
namespace ult {