mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
refactor: prework for adding eu stall support on windows
Related-To: NEO-9492 Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c589c5d2df
commit
e78c8edcf3
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 Intel Corporation
|
||||
# Copyright (C) 2020-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -26,4 +26,10 @@ target_sources(${L0_STATIC_LIB_NAME}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/metric_device_context_create.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/windows/os_metric_ip_sampling_imp_windows.cpp
|
||||
)
|
||||
endif()
|
||||
add_subdirectories()
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
constexpr uint32_t maxDssBufferSize = 512 * MemoryConstants::kiloByte;
|
||||
constexpr uint32_t defaultPollPeriodNs = 10000000u;
|
||||
constexpr uint32_t unitReportSize = 64u;
|
||||
|
||||
class MetricIpSamplingLinuxImp : public MetricIpSamplingOsInterface {
|
||||
public:
|
||||
MetricIpSamplingLinuxImp(Device &device);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/constants.h"
|
||||
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
#include <memory>
|
||||
@@ -32,6 +34,10 @@ class MetricIpSamplingOsInterface : public MetricOsInterface {
|
||||
virtual bool isNReportsAvailable() = 0;
|
||||
virtual bool isDependencyAvailable() = 0;
|
||||
static std::unique_ptr<MetricIpSamplingOsInterface> create(Device &device);
|
||||
|
||||
uint32_t maxDssBufferSize = 512 * MemoryConstants::kiloByte;
|
||||
uint32_t defaultPollPeriodNs = 10000000u;
|
||||
uint32_t unitReportSize = 64u;
|
||||
};
|
||||
|
||||
class MetricOAOsInterface : public MetricOsInterface {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 Intel Corporation
|
||||
# Copyright (C) 2020-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -11,6 +11,5 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_oa_streamer_imp_windows.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_oa_query_imp_windows.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_oa_enumeration_imp_windows.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_ip_sampling_imp_windows.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -201,7 +201,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, givenCloseFailsWhenStopMeasurementIsC
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->stopMeasurement(), ZE_RESULT_ERROR_UNKNOWN);
|
||||
}
|
||||
|
||||
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, givenI915PerfIoctlDisableFailsWhenStartMeasurementIsCalledThenReturnFailure, IsPVC) {
|
||||
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, givenI915PerfIoctlDisableFailsWhenStopMeasurementIsCalledThenReturnFailure, IsPVC) {
|
||||
|
||||
VariableBackup<decltype(SysCalls::sysCallsIoctl)> mockIoctl(&SysCalls::sysCallsIoctl, [](int fileDescriptor, unsigned long int request, void *arg) -> int {
|
||||
if (request == I915_PERF_IOCTL_DISABLE) {
|
||||
@@ -279,7 +279,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndUnsuppo
|
||||
EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable());
|
||||
}
|
||||
|
||||
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndSupportedDeviceIdIsUsedWhenIsDependencyAvailableIsCalledThenReturnFailure, IsPVC) {
|
||||
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndSupportedDeviceIdIsUsedWhenIsDependencyAvailableIsCalledThenReturnSucess, IsPVC) {
|
||||
|
||||
auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
hwInfo->platform.eProductFamily = productFamily;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/tools/source/metrics/os_interface_metric.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::Return;
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
class MetricIpSamplingWindowsTest : 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;
|
||||
};
|
||||
|
||||
TEST_F(MetricIpSamplingWindowsTest, WhenIpSamplingOsInterfaceIsUsedReturnUnsupported) {
|
||||
uint64_t timerResolution;
|
||||
EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable());
|
||||
EXPECT_FALSE(metricIpSamplingOsInterface->isNReportsAvailable());
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->getRequiredBufferSize(0), 0);
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->getUnitReportSize(), 0);
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(nullptr, nullptr), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
|
||||
uint32_t dummy;
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->startMeasurement(dummy, dummy), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->stopMeasurement(), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->getMetricsTimerResolution(timerResolution), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user