mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
feature: add support for eustall uAPI
Related-To: NEO-14347 Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8b508fd15f
commit
7d85b1aeb7
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
# Copyright (C) 2024-2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -11,6 +11,8 @@ set(neo_libult_common_SRCS_LIB_ULT_LINUX_XE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe_definitions.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xe_config_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe_perf.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe_perf.h
|
||||
)
|
||||
if(UNIX)
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/os_interface/linux/xe/mock_drm_xe_perf.h"
|
||||
|
||||
#include "shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h"
|
||||
|
||||
std::unique_ptr<DrmMockXePerf> DrmMockXePerf::create(RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto drm = std::unique_ptr<DrmMockXePerf>(new DrmMockXePerf{rootDeviceEnvironment});
|
||||
drm->initInstance();
|
||||
|
||||
drm->ioctlHelper = std::make_unique<MockIoctlHelperXe>(*drm);
|
||||
|
||||
return drm;
|
||||
}
|
||||
|
||||
int DrmMockXePerf::ioctl(DrmIoctl request, void *arg) {
|
||||
int ret = -1;
|
||||
ioctlCalled = true;
|
||||
|
||||
if (forceIoctlAnswer) {
|
||||
return setIoctlAnswer;
|
||||
}
|
||||
|
||||
switch (request) {
|
||||
case DrmIoctl::perfQuery: {
|
||||
perfQueryCallCount++;
|
||||
if (failPerfQueryOnCall && (perfQueryCallCount >= failPerfQueryOnCall)) {
|
||||
return -1;
|
||||
}
|
||||
drm_xe_device_query *euStallDeviceQuery = static_cast<drm_xe_device_query *>(arg);
|
||||
uint64_t samplingRates[] = {251, 502};
|
||||
if (euStallDeviceQuery->size == 0) {
|
||||
if (querySizeZero) {
|
||||
euStallDeviceQuery->size = 0;
|
||||
return 0;
|
||||
} else {
|
||||
uint32_t sizeNeeded = sizeof(drm_xe_query_eu_stall) + sizeof(samplingRates);
|
||||
euStallDeviceQuery->size = sizeNeeded;
|
||||
}
|
||||
} else {
|
||||
drm_xe_query_eu_stall *euStallQueryData = reinterpret_cast<drm_xe_query_eu_stall *>(euStallDeviceQuery->data);
|
||||
if (numSamplingRateCountZero) {
|
||||
euStallQueryData->num_sampling_rates = 0;
|
||||
return 0;
|
||||
}
|
||||
euStallQueryData->num_sampling_rates = 2;
|
||||
memcpy_s(reinterpret_cast<void *>(euStallQueryData->sampling_rates), sizeof(samplingRates), &samplingRates, sizeof(samplingRates));
|
||||
}
|
||||
ret = 0;
|
||||
} break;
|
||||
default:
|
||||
return DrmMockXe::ioctl(request, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
27
shared/test/common/os_interface/linux/xe/mock_drm_xe_perf.h
Normal file
27
shared/test/common/os_interface/linux/xe/mock_drm_xe_perf.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/test/common/os_interface/linux/xe/mock_drm_xe.h"
|
||||
|
||||
using NEO::XeDrm::DrmMockXe;
|
||||
|
||||
struct DrmMockXePerf : public DrmMockXe {
|
||||
static std::unique_ptr<DrmMockXePerf> create(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
|
||||
int ioctl(DrmIoctl request, void *arg) override;
|
||||
|
||||
int32_t curFd = 0;
|
||||
bool querySizeZero = false;
|
||||
bool numSamplingRateCountZero = false;
|
||||
uint32_t perfQueryCallCount = 0;
|
||||
uint32_t failPerfQueryOnCall = 0;
|
||||
|
||||
protected:
|
||||
// Don't call directly, use the create() function
|
||||
DrmMockXePerf(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockXe(rootDeviceEnvironment) {}
|
||||
};
|
||||
Reference in New Issue
Block a user