mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +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
|
||||
@@ -46,6 +46,7 @@ set(NEO_CORE_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/adapter_factory_dxgi.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/read_preemption_regkey.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/windows_inc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/${BRANCH_DIR_SUFFIX}/perf_wddm.cpp
|
||||
)
|
||||
|
||||
set(NEO_CORE_OS_INTERFACE_WDDM
|
||||
@@ -136,6 +137,7 @@ if(NOT WIN32 AND NOT DISABLE_WDDM_LINUX)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/power_settings_stub.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/trim_callback_stub.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sys_calls_wrapper_drm_or_wddm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/perf_wddm.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
23
shared/source/os_interface/windows/wddm/perf_wddm.cpp
Normal file
23
shared/source/os_interface/windows/wddm/perf_wddm.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool Wddm::perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Wddm::perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Wddm::perfDisableEuStallStream() {
|
||||
return false;
|
||||
}
|
||||
} // namespace NEO
|
||||
@@ -190,6 +190,10 @@ class Wddm : public DriverModel {
|
||||
|
||||
uint32_t getTimestampFrequency() const { return timestampFrequency; }
|
||||
|
||||
MOCKABLE_VIRTUAL bool perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize);
|
||||
MOCKABLE_VIRTUAL bool perfDisableEuStallStream();
|
||||
MOCKABLE_VIRTUAL bool perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize);
|
||||
|
||||
PhysicalDevicePciBusInfo getPciBusInfo() const override;
|
||||
|
||||
size_t getMaxMemAllocSize() const override;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2019-2023 Intel Corporation
|
||||
# Copyright (C) 2019-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -34,6 +34,7 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_special_heap_test.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_reservation_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_windows_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/wddm_perf_tests.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -53,4 +54,10 @@ if(WIN32 OR(UNIX AND NOT DISABLE_WDDM_LINUX))
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 AND NOT DISABLE_WDDM_LINUX)
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_perf_tests.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
using WddmPerfTests = WddmFixture;
|
||||
|
||||
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfOpenEuStallStreamIsCalledThenReturnFailure) {
|
||||
constexpr uint32_t samplingGranularity = 251u;
|
||||
constexpr uint32_t gpuClockPeriodNs = 1000000000ull;
|
||||
constexpr uint32_t samplingUnit = 1;
|
||||
uint32_t notifyEveryNReports = 0, samplingPeriodNs = samplingGranularity * samplingUnit * gpuClockPeriodNs;
|
||||
EXPECT_FALSE(wddm->perfOpenEuStallStream(notifyEveryNReports, samplingPeriodNs));
|
||||
}
|
||||
|
||||
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfReadEuStallStreamIsCalledThenReturnFailure) {
|
||||
uint8_t pRawData = 0u;
|
||||
size_t pRawDataSize = 0;
|
||||
EXPECT_FALSE(wddm->perfReadEuStallStream(&pRawData, &pRawDataSize));
|
||||
}
|
||||
|
||||
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfDisableEuStallStreamIsCalledThenReturnFailure) {
|
||||
EXPECT_FALSE(wddm->perfDisableEuStallStream());
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user