mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor: Prework to get sampling unit through ioctl query on xe
Related-To: NEO-13777 Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6d63f688eb
commit
f2b48b97d2
@@ -40,46 +40,23 @@ class MetricIpSamplingLinuxImp : public MetricIpSamplingOsInterface {
|
||||
private:
|
||||
int32_t stream = -1;
|
||||
Device &device;
|
||||
|
||||
ze_result_t getNearestSupportedSamplingUnit(uint32_t &samplingPeriodNs, uint32_t &samplingRate);
|
||||
};
|
||||
|
||||
MetricIpSamplingLinuxImp::MetricIpSamplingLinuxImp(Device &device) : device(device) {}
|
||||
|
||||
ze_result_t MetricIpSamplingLinuxImp::getNearestSupportedSamplingUnit(uint32_t &samplingPeriodNs, uint32_t &samplingUnit) {
|
||||
|
||||
static constexpr uint32_t samplingClockGranularity = 251u;
|
||||
static constexpr uint32_t minSamplingUnit = 1u;
|
||||
static constexpr uint32_t maxSamplingUnit = 7u;
|
||||
ze_result_t MetricIpSamplingLinuxImp::startMeasurement(uint32_t ¬ifyEveryNReports, uint32_t &samplingPeriodNs) {
|
||||
|
||||
const auto drm = device.getOsInterface()->getDriverModel()->as<NEO::Drm>();
|
||||
uint64_t gpuTimeStampfrequency = 0;
|
||||
ze_result_t ret = getMetricsTimerResolution(gpuTimeStampfrequency);
|
||||
if (ret != ZE_RESULT_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t gpuClockPeriodNs = nsecPerSec / gpuTimeStampfrequency;
|
||||
uint64_t numberOfClocks = samplingPeriodNs / gpuClockPeriodNs;
|
||||
|
||||
samplingUnit = std::clamp(static_cast<uint32_t>(numberOfClocks / samplingClockGranularity), minSamplingUnit, maxSamplingUnit);
|
||||
samplingPeriodNs = samplingUnit * samplingClockGranularity * static_cast<uint32_t>(gpuClockPeriodNs);
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t MetricIpSamplingLinuxImp::startMeasurement(uint32_t ¬ifyEveryNReports, uint32_t &samplingPeriodNs) {
|
||||
|
||||
const auto drm = device.getOsInterface()->getDriverModel()->as<NEO::Drm>();
|
||||
|
||||
uint32_t samplingUnit = 0;
|
||||
if (getNearestSupportedSamplingUnit(samplingPeriodNs, samplingUnit) != ZE_RESULT_SUCCESS) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
DeviceImp &deviceImp = static_cast<DeviceImp &>(device);
|
||||
|
||||
auto ioctlHelper = drm->getIoctlHelper();
|
||||
uint32_t euStallFdParameter = ioctlHelper->getEuStallFdParameter();
|
||||
std::array<uint64_t, 12u> properties;
|
||||
auto engineInfo = drm->getEngineInfo();
|
||||
if (engineInfo == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
@@ -90,13 +67,7 @@ ze_result_t MetricIpSamplingLinuxImp::startMeasurement(uint32_t ¬ifyEveryNRep
|
||||
}
|
||||
|
||||
notifyEveryNReports = std::max(notifyEveryNReports, 1u);
|
||||
|
||||
if (!ioctlHelper->getEuStallProperties(properties, maxDssBufferSize, samplingUnit, defaultPollPeriodNs,
|
||||
classInstance->engineInstance, notifyEveryNReports)) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
if (!ioctlHelper->perfOpenEuStallStream(euStallFdParameter, properties, &stream)) {
|
||||
if (!ioctlHelper->perfOpenEuStallStream(euStallFdParameter, samplingPeriodNs, classInstance->engineInstance, notifyEveryNReports, gpuTimeStampfrequency, &stream)) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/constants.h"
|
||||
|
||||
#include "level_zero/core/source/event/event.h"
|
||||
#include "level_zero/tools/source/metrics/os_interface_metric.h"
|
||||
#include "level_zero/zet_intel_gpu_metric.h"
|
||||
@@ -55,8 +57,6 @@ struct CommandList;
|
||||
struct MetricStreamer;
|
||||
struct MetricProgrammable;
|
||||
|
||||
static constexpr uint64_t nsecPerSec = 1000000000ull;
|
||||
|
||||
class MetricSource {
|
||||
public:
|
||||
static constexpr uint32_t metricSourceTypeUndefined = 0u;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -64,7 +64,7 @@ ze_result_t OaMetricSourceImp::getTimestampValidBits(uint64_t &validBits) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
uint64_t maxTimeStamp = maxNanoSeconds * timerFreqquency / nsecPerSec;
|
||||
uint64_t maxTimeStamp = maxNanoSeconds * timerFreqquency / CommonConstants::nsecPerSec;
|
||||
|
||||
auto bits = std::bitset<64>(maxTimeStamp);
|
||||
validBits = bits.count();
|
||||
|
||||
@@ -137,7 +137,7 @@ ze_result_t MetricIpSamplingWindowsImp::getNearestSupportedSamplingUnit(uint32_t
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t gpuClockPeriodNs = nsecPerSec / gpuTimeStampfrequency;
|
||||
uint64_t gpuClockPeriodNs = CommonConstants::nsecPerSec / gpuTimeStampfrequency;
|
||||
UNRECOVERABLE_IF(gpuClockPeriodNs == 0);
|
||||
uint64_t numberOfClocks = samplingPeriodNs / gpuClockPeriodNs;
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ namespace ult {
|
||||
class IoctlHelperPrelim20Mock : public NEO::IoctlHelperPrelim20 {
|
||||
public:
|
||||
using NEO::IoctlHelperPrelim20::IoctlHelperPrelim20;
|
||||
bool getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize, uint64_t samplingRate,
|
||||
uint64_t pollPeriod, uint64_t engineInstance, uint64_t notifyNReports) override {
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -189,7 +188,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, givenI915PerfIoctlEnableFailsWhenStar
|
||||
EXPECT_EQ(metricIpSamplingOsInterface->startMeasurement(notifyEveryNReports, samplingPeriodNs), ZE_RESULT_ERROR_UNKNOWN);
|
||||
}
|
||||
|
||||
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, givenGetEuStallPropertiesWhenStartMeasurementIsCalledThenReturnFailure, IsPVC) {
|
||||
HWTEST2_F(MetricIpSamplingLinuxTestPrelim, givenPerfOpenEuStallStreamWhenStartMeasurementIsCalledThenReturnFailure, IsPVC) {
|
||||
|
||||
auto drm = static_cast<DrmPrelimMock *>(device->getOsInterface()->getDriverModel()->as<NEO::Drm>());
|
||||
drm->setIoctlHelperPrelim20Mock();
|
||||
|
||||
@@ -96,4 +96,5 @@ inline constexpr uint32_t maxWorkgroupSize = 1024u;
|
||||
inline constexpr uint32_t minimalSyncBufferSize = 12;
|
||||
inline constexpr uint32_t gpuHangCheckTimeInUS = 500'000;
|
||||
inline constexpr double defaultProfilingTimerResolution = 83.333;
|
||||
} // namespace CommonConstants
|
||||
inline constexpr uint64_t nsecPerSec = 1000000000ull;
|
||||
} // namespace CommonConstants
|
||||
@@ -152,11 +152,9 @@ class IoctlHelper {
|
||||
virtual int vmBind(const VmBindParams &vmBindParams) = 0;
|
||||
virtual int vmUnbind(const VmBindParams &vmBindParams) = 0;
|
||||
virtual int getResetStats(ResetStats &resetStats, uint32_t *status, ResetStatsFault *resetStatsFault) = 0;
|
||||
virtual bool getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize,
|
||||
uint64_t samplingRate, uint64_t pollPeriod, uint64_t engineInstance, uint64_t notifyNReports) = 0;
|
||||
virtual bool isEuStallSupported() = 0;
|
||||
virtual uint32_t getEuStallFdParameter() = 0;
|
||||
virtual bool perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) = 0;
|
||||
virtual bool perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) = 0;
|
||||
virtual bool perfDisableEuStallStream(int32_t *stream) = 0;
|
||||
virtual UuidRegisterResult registerUuid(const std::string &uuid, uint32_t uuidClass, uint64_t ptr, uint64_t size) = 0;
|
||||
virtual UuidRegisterResult registerStringClassUuid(const std::string &uuid, uint64_t ptr, uint64_t size) = 0;
|
||||
@@ -325,10 +323,8 @@ class IoctlHelperUpstream : public IoctlHelperI915 {
|
||||
int vmUnbind(const VmBindParams &vmBindParams) override;
|
||||
int getResetStats(ResetStats &resetStats, uint32_t *status, ResetStatsFault *resetStatsFault) override;
|
||||
bool isEuStallSupported() override;
|
||||
bool getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize, uint64_t samplingRate,
|
||||
uint64_t pollPeriod, uint64_t engineInstance, uint64_t notifyNReports) override;
|
||||
uint32_t getEuStallFdParameter() override;
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) override;
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) override;
|
||||
bool perfDisableEuStallStream(int32_t *stream) override;
|
||||
UuidRegisterResult registerUuid(const std::string &uuid, uint32_t uuidClass, uint64_t ptr, uint64_t size) override;
|
||||
UuidRegisterResult registerStringClassUuid(const std::string &uuid, uint64_t ptr, uint64_t size) override;
|
||||
@@ -401,9 +397,7 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 {
|
||||
int vmBind(const VmBindParams &vmBindParams) override;
|
||||
int vmUnbind(const VmBindParams &vmBindParams) override;
|
||||
int getResetStats(ResetStats &resetStats, uint32_t *status, ResetStatsFault *resetStatsFault) override;
|
||||
bool getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize, uint64_t samplingRate,
|
||||
uint64_t pollPeriod, uint64_t engineInstance, uint64_t notifyNReports) override;
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) override;
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) override;
|
||||
bool perfDisableEuStallStream(int32_t *stream) override;
|
||||
bool isEuStallSupported() override;
|
||||
uint32_t getEuStallFdParameter() override;
|
||||
|
||||
@@ -587,14 +587,35 @@ bool IoctlHelperPrelim20::isEuStallSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize, uint64_t samplingRate,
|
||||
uint64_t pollPeriod, uint64_t engineInstance, uint64_t notifyNReports) {
|
||||
uint32_t IoctlHelperPrelim20::getEuStallFdParameter() {
|
||||
return PRELIM_I915_PERF_FLAG_FD_EU_STALL;
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) {
|
||||
static constexpr uint32_t maxDssBufferSize = 512 * MemoryConstants::kiloByte;
|
||||
static constexpr uint32_t defaultPollPeriodNs = 10000000u;
|
||||
|
||||
// Get sampling unit.
|
||||
static constexpr uint32_t samplingClockGranularity = 251u;
|
||||
static constexpr uint32_t minSamplingUnit = 1u;
|
||||
static constexpr uint32_t maxSamplingUnit = 7u;
|
||||
|
||||
uint64_t gpuClockPeriodNs = CommonConstants::nsecPerSec / gpuTimeStampfrequency;
|
||||
uint64_t numberOfClocks = samplingPeriodNs / gpuClockPeriodNs;
|
||||
|
||||
uint32_t samplingUnit = 0;
|
||||
samplingUnit = std::clamp(static_cast<uint32_t>(numberOfClocks / samplingClockGranularity), minSamplingUnit, maxSamplingUnit);
|
||||
samplingPeriodNs = samplingUnit * samplingClockGranularity * static_cast<uint32_t>(gpuClockPeriodNs);
|
||||
|
||||
// Populate the EU stall properties.
|
||||
std::array<uint64_t, 12u> properties;
|
||||
|
||||
properties[0] = prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_BUF_SZ;
|
||||
properties[1] = dssBufferSize;
|
||||
properties[1] = maxDssBufferSize;
|
||||
properties[2] = prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_SAMPLE_RATE;
|
||||
properties[3] = samplingRate;
|
||||
properties[3] = samplingUnit;
|
||||
properties[4] = prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_POLL_PERIOD;
|
||||
properties[5] = pollPeriod;
|
||||
properties[5] = defaultPollPeriodNs;
|
||||
properties[6] = prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_ENGINE_CLASS;
|
||||
properties[7] = prelim_drm_i915_gem_engine_class::PRELIM_I915_ENGINE_CLASS_COMPUTE;
|
||||
properties[8] = prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_ENGINE_INSTANCE;
|
||||
@@ -602,14 +623,7 @@ bool IoctlHelperPrelim20::getEuStallProperties(std::array<uint64_t, 12u> &proper
|
||||
properties[10] = prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_EVENT_REPORT_COUNT;
|
||||
properties[11] = notifyNReports;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperPrelim20::getEuStallFdParameter() {
|
||||
return PRELIM_I915_PERF_FLAG_FD_EU_STALL;
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) {
|
||||
// Call perf open ioctl.
|
||||
NEO::PrelimI915::drm_i915_perf_open_param param = {};
|
||||
param.flags = I915_PERF_FLAG_FD_CLOEXEC |
|
||||
euStallFdParameter |
|
||||
|
||||
@@ -199,17 +199,11 @@ bool IoctlHelperUpstream::isEuStallSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IoctlHelperUpstream::getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize,
|
||||
uint64_t samplingRate, uint64_t pollPeriod, uint64_t engineInstance,
|
||||
uint64_t notifyNReports) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperUpstream::getEuStallFdParameter() {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
bool IoctlHelperUpstream::perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) {
|
||||
bool IoctlHelperUpstream::perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,11 +82,9 @@ class IoctlHelperXe : public IoctlHelper {
|
||||
int vmBind(const VmBindParams &vmBindParams) override;
|
||||
int vmUnbind(const VmBindParams &vmBindParams) override;
|
||||
int getResetStats(ResetStats &resetStats, uint32_t *status, ResetStatsFault *resetStatsFault) override;
|
||||
bool getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize, uint64_t samplingRate, uint64_t pollPeriod,
|
||||
uint64_t engineInstance, uint64_t notifyNReports) override;
|
||||
bool isEuStallSupported() override;
|
||||
uint32_t getEuStallFdParameter() override;
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) override;
|
||||
bool perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) override;
|
||||
bool perfDisableEuStallStream(int32_t *stream) override;
|
||||
MOCKABLE_VIRTUAL int perfOpenIoctl(DrmIoctl request, void *arg);
|
||||
unsigned int getIoctlRequestValuePerf(DrmIoctl ioctlRequest) const;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,17 +11,13 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool IoctlHelperXe::perfOpenEuStallStream(uint32_t euStallFdParameter, std::array<uint64_t, 12u> &properties, int32_t *stream) {
|
||||
bool IoctlHelperXe::perfOpenEuStallStream(uint32_t euStallFdParameter, uint32_t &samplingPeriodNs, uint64_t engineInstance, uint64_t notifyNReports, uint64_t gpuTimeStampfrequency, int32_t *stream) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IoctlHelperXe::perfDisableEuStallStream(int32_t *stream) {
|
||||
return false;
|
||||
}
|
||||
bool IoctlHelperXe::getEuStallProperties(std::array<uint64_t, 12u> &properties, uint64_t dssBufferSize, uint64_t samplingRate,
|
||||
uint64_t pollPeriod, uint64_t engineInstance, uint64_t notifyNReports) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int IoctlHelperXe::getIoctlRequestValuePerf(DrmIoctl ioctlRequest) const {
|
||||
return 0;
|
||||
|
||||
@@ -374,28 +374,12 @@ TEST_F(IoctlPrelimHelperTests, givenPrelimWhenCallingIsEuStallSupportedThenTrueI
|
||||
EXPECT_TRUE(ioctlHelper.isEuStallSupported());
|
||||
}
|
||||
|
||||
TEST_F(IoctlPrelimHelperTests, givenPrelimWhenGettingEuStallPropertiesThenCorrectPropertiesAreReturned) {
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_TRUE(ioctlHelper.getEuStallProperties(properties, 0x101, 0x102, 0x103, 1, 20u));
|
||||
EXPECT_EQ(properties[0], prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_BUF_SZ);
|
||||
EXPECT_EQ(properties[1], 0x101u);
|
||||
EXPECT_EQ(properties[2], prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_SAMPLE_RATE);
|
||||
EXPECT_EQ(properties[3], 0x102u);
|
||||
EXPECT_EQ(properties[4], prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_POLL_PERIOD);
|
||||
EXPECT_EQ(properties[5], 0x103u);
|
||||
EXPECT_EQ(properties[6], prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_ENGINE_CLASS);
|
||||
EXPECT_EQ(properties[7], prelim_drm_i915_gem_engine_class::PRELIM_I915_ENGINE_CLASS_COMPUTE);
|
||||
EXPECT_EQ(properties[8], prelim_drm_i915_eu_stall_property_id::PRELIM_DRM_I915_EU_STALL_PROP_ENGINE_INSTANCE);
|
||||
|
||||
EXPECT_EQ(properties[11], 20u);
|
||||
}
|
||||
|
||||
TEST_F(IoctlPrelimHelperTests, givenPrelimWhenCallingPerfOpenEuStallStreamWithInvalidArgumentsThenFailureReturned) {
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
int32_t invalidStream = -1;
|
||||
DrmMock *mockDrm = reinterpret_cast<DrmMock *>(drm.get());
|
||||
mockDrm->failPerfOpen = true;
|
||||
EXPECT_FALSE(ioctlHelper.perfOpenEuStallStream(0u, properties, &invalidStream));
|
||||
uint32_t samplingPeridNs = 10000u;
|
||||
EXPECT_FALSE(ioctlHelper.perfOpenEuStallStream(0u, samplingPeridNs, 1, 20u, 10000u, &invalidStream));
|
||||
}
|
||||
|
||||
TEST_F(IoctlPrelimHelperTests, givenPrelimWhenGettingEuStallFdParameterThenCorrectIoctlValueIsReturned) {
|
||||
@@ -583,8 +567,8 @@ TEST(IoctlPrelimHelperPerfTests, givenCalltoPerfOpenEuStallStreamWithInvalidStre
|
||||
mockIoctlHelper.initialize();
|
||||
int32_t invalidFd = -1;
|
||||
mockIoctlHelper.failPerfEnable = true;
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_FALSE(mockIoctlHelper.perfOpenEuStallStream(0u, properties, &invalidFd));
|
||||
uint32_t samplingPeridNs = 10000u;
|
||||
EXPECT_FALSE(mockIoctlHelper.perfOpenEuStallStream(0u, samplingPeridNs, 1, 20u, 10000u, &invalidFd));
|
||||
}
|
||||
|
||||
TEST(IoctlPrelimHelperPerfTests, givenCalltoPerfDisableEuStallStreamWithValidStreamThenSuccessIsReturned) {
|
||||
@@ -594,9 +578,8 @@ TEST(IoctlPrelimHelperPerfTests, givenCalltoPerfDisableEuStallStreamWithValidStr
|
||||
|
||||
mockIoctlHelper.initialize();
|
||||
int32_t validFd = -1;
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_TRUE(mockIoctlHelper.getEuStallProperties(properties, 0x101, 0x102, 0x103, 1, 20u));
|
||||
EXPECT_TRUE(mockIoctlHelper.perfOpenEuStallStream(0u, properties, &validFd));
|
||||
uint32_t samplingPeridNs = 10000u;
|
||||
EXPECT_TRUE(mockIoctlHelper.perfOpenEuStallStream(0u, samplingPeridNs, 1, 20u, 10000u, &validFd));
|
||||
EXPECT_TRUE(mockIoctlHelper.perfDisableEuStallStream(&validFd));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
* Copyright (C) 2021-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -523,21 +523,13 @@ TEST(IoctlHelperTestsUpstream, whenCallingIsEuStallSupportedThenFalseIsReturned)
|
||||
EXPECT_FALSE(ioctlHelper->isEuStallSupported());
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, whenCallingGetEuStallPropertiesThenFailueIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto ioctlHelper = drm->getIoctlHelper();
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_FALSE(ioctlHelper->getEuStallProperties(properties, 0x101, 0x102, 0x103, 1, 20u));
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, whenCallingPerfOpenEuStallStreamThenFailueIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto ioctlHelper = drm->getIoctlHelper();
|
||||
int32_t invalidFd = -1;
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_FALSE(ioctlHelper->perfOpenEuStallStream(0u, properties, &invalidFd));
|
||||
uint32_t samplingPeridNs = 10000u;
|
||||
EXPECT_FALSE(ioctlHelper->perfOpenEuStallStream(0u, samplingPeridNs, 1, 20u, 10000u, &invalidFd));
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, whenCallingPerfDisableEuStallStreamThenFailueIsReturned) {
|
||||
@@ -675,12 +667,13 @@ TEST(IoctlHelperTestsUpstream, whenVmUnbindIsCalledThenZeroIsReturned) {
|
||||
EXPECT_EQ(0, ioctlHelper.vmUnbind(vmBindParams));
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenGettingEuStallPropertiesThenFailureIsReturned) {
|
||||
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenCallingPerfOpenEuStallStreamThenFailueIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
IoctlHelperUpstream ioctlHelper{*drm};
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_FALSE(ioctlHelper.getEuStallProperties(properties, 0x101, 0x102, 0x103, 1, 1));
|
||||
int32_t invalidFd = -1;
|
||||
uint32_t samplingPeridNs = 10000u;
|
||||
EXPECT_FALSE(ioctlHelper.perfOpenEuStallStream(0u, samplingPeridNs, 1, 20u, 10000u, &invalidFd));
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenGettingEuStallFdParameterThenZeroIsReturned) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,23 +17,14 @@
|
||||
using namespace NEO;
|
||||
using IoctlHelperXeTest = Test<XeConfigFixture>;
|
||||
|
||||
TEST_F(IoctlHelperXeTest, whenCallingGetEuStallPropertiesThenFailueIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
|
||||
EXPECT_NE(nullptr, xeIoctlHelper);
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_FALSE(xeIoctlHelper.get()->getEuStallProperties(properties, 0x101, 0x102, 0x103, 1, 20u));
|
||||
}
|
||||
|
||||
TEST_F(IoctlHelperXeTest, whenCallingPerfOpenEuStallStreamThenFailueIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
|
||||
EXPECT_NE(nullptr, xeIoctlHelper);
|
||||
int32_t invalidFd = -1;
|
||||
std::array<uint64_t, 12u> properties = {};
|
||||
EXPECT_FALSE(xeIoctlHelper.get()->perfOpenEuStallStream(0u, properties, &invalidFd));
|
||||
uint32_t samplingPeriodNs = 10000u;
|
||||
EXPECT_FALSE(xeIoctlHelper.get()->perfOpenEuStallStream(0u, samplingPeriodNs, 1, 20u, 10000u, &invalidFd));
|
||||
}
|
||||
|
||||
TEST_F(IoctlHelperXeTest, whenCallingPerfDisableEuStallStreamThenFailueIsReturned) {
|
||||
|
||||
Reference in New Issue
Block a user