mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 15:12:56 +08:00
Rename L0 Device method
remove gmock from mock device add macros to define mock methods with ref return Related-To: NEO-4914 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
35f135bbc8
commit
babdbfb0cf
@@ -605,7 +605,7 @@ ze_result_t ContextImp::createCommandListImmediate(ze_device_handle_t hDevice,
|
||||
ze_result_t ContextImp::activateMetricGroups(zet_device_handle_t hDevice,
|
||||
uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) {
|
||||
return L0::Device::fromHandle(hDevice)->activateMetricGroups(count, phMetricGroups);
|
||||
return L0::Device::fromHandle(hDevice)->activateMetricGroupsDeferred(count, phMetricGroups);
|
||||
}
|
||||
|
||||
ze_result_t ContextImp::reserveVirtualMem(const void *pStart,
|
||||
|
||||
@@ -97,8 +97,8 @@ struct Device : _ze_device_handle_t {
|
||||
virtual DebugSession *createDebugSession(const zet_debug_config_t &config, ze_result_t &result) = 0;
|
||||
virtual void removeDebugSession() = 0;
|
||||
|
||||
virtual ze_result_t activateMetricGroups(uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) = 0;
|
||||
virtual ze_result_t activateMetricGroupsDeferred(uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) = 0;
|
||||
virtual void activateMetricGroups() = 0;
|
||||
|
||||
virtual DriverHandle *getDriverHandle() = 0;
|
||||
|
||||
@@ -699,8 +699,8 @@ ze_result_t DeviceImp::getDebugProperties(zet_device_debug_properties_t *pDebugP
|
||||
|
||||
ze_result_t DeviceImp::systemBarrier() { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; }
|
||||
|
||||
ze_result_t DeviceImp::activateMetricGroups(uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) {
|
||||
ze_result_t DeviceImp::activateMetricGroupsDeferred(uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) {
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
if (!this->isSubdevice && this->isMultiDeviceCapable()) {
|
||||
for (auto subDevice : this->subDevices) {
|
||||
|
||||
@@ -76,8 +76,8 @@ struct DeviceImp : public Device {
|
||||
void removeDebugSession() override { debugSession.release(); }
|
||||
|
||||
uint32_t getMaxNumHwThreads() const override;
|
||||
ze_result_t activateMetricGroups(uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) override;
|
||||
ze_result_t activateMetricGroupsDeferred(uint32_t count,
|
||||
zet_metric_group_handle_t *phMetricGroups) override;
|
||||
|
||||
DriverHandle *getDriverHandle() override;
|
||||
void setDriverHandle(DriverHandle *driverHandle) override;
|
||||
|
||||
@@ -6,19 +6,12 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/preemption_mode.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/device/device_info.h"
|
||||
#include "shared/test/common/test_macros/mock_method_macros.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/driver/driver_handle.h"
|
||||
#include "level_zero/core/test/unit_tests/mock.h"
|
||||
#include "level_zero/core/test/unit_tests/white_box.h"
|
||||
#include "level_zero/tools/source/metrics/metric.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
@@ -58,40 +51,21 @@ struct Mock<Device> : public Device {
|
||||
ADDMETHOD_NOBASE(systemBarrier, ze_result_t, ZE_RESULT_SUCCESS, ());
|
||||
// Runtime internal methods
|
||||
ADDMETHOD_NOBASE(getExecEnvironment, void *, nullptr, ());
|
||||
MOCK_METHOD(NEO::HwHelper &,
|
||||
getHwHelper,
|
||||
(),
|
||||
(override));
|
||||
ADDMETHOD_NOBASE_REFRETURN(getHwHelper, NEO::HwHelper &, ());
|
||||
ADDMETHOD_CONST_NOBASE(isMultiDeviceCapable, bool, false, ());
|
||||
ADDMETHOD_NOBASE(getBuiltinFunctionsLib, BuiltinFunctionsLib *, nullptr, ());
|
||||
ADDMETHOD_CONST_NOBASE(getMaxNumHwThreads, uint32_t, 16u, ());
|
||||
|
||||
ADDMETHOD_NOBASE(activateMetricGroups, ze_result_t, ZE_RESULT_SUCCESS, (uint32_t count, zet_metric_group_handle_t *phMetricGroups));
|
||||
MOCK_METHOD(NEO::OSInterface &,
|
||||
getOsInterface,
|
||||
(),
|
||||
(override));
|
||||
ADDMETHOD_NOBASE(activateMetricGroupsDeferred, ze_result_t, ZE_RESULT_SUCCESS, (uint32_t count, zet_metric_group_handle_t *phMetricGroups));
|
||||
ADDMETHOD_NOBASE_REFRETURN(getOsInterface, NEO::OSInterface &, ());
|
||||
ADDMETHOD_CONST_NOBASE(getPlatformInfo, uint32_t, 0u, ());
|
||||
MOCK_METHOD(MetricContext &,
|
||||
getMetricContext,
|
||||
(),
|
||||
(override));
|
||||
MOCK_METHOD(const NEO::HardwareInfo &,
|
||||
getHwInfo,
|
||||
(),
|
||||
(const, override));
|
||||
ADDMETHOD_NOBASE_REFRETURN(getMetricContext, MetricContext &, ());
|
||||
ADDMETHOD_CONST_NOBASE_REFRETURN(getHwInfo, const NEO::HardwareInfo &, ());
|
||||
ADDMETHOD_NOBASE(getDriverHandle, L0::DriverHandle *, nullptr, ());
|
||||
ADDMETHOD_NOBASE_VOIDRETURN(setDriverHandle, (L0::DriverHandle *));
|
||||
ADDMETHOD_CONST_NOBASE(getDevicePreemptionMode, NEO::PreemptionMode, NEO::PreemptionMode::Initial, ());
|
||||
MOCK_METHOD(const NEO::DeviceInfo &,
|
||||
getDeviceInfo,
|
||||
(),
|
||||
(const, override));
|
||||
ADDMETHOD_CONST_NOBASE_REFRETURN(getDeviceInfo, const NEO::DeviceInfo &, ());
|
||||
ADDMETHOD_NOBASE(getNEODevice, NEO::Device *, nullptr, ());
|
||||
MOCK_METHOD(void,
|
||||
activateMetricGroups,
|
||||
(),
|
||||
(override));
|
||||
ADDMETHOD_NOBASE_VOIDRETURN(activateMetricGroups, ());
|
||||
ADDMETHOD_CONST_NOBASE(getDebugSurface, NEO::GraphicsAllocation *, nullptr, ());
|
||||
ADDMETHOD_NOBASE(allocateManagedMemoryFromHostPtr, NEO::GraphicsAllocation *, nullptr, (void *buffer, size_t size, struct L0::CommandList *commandList));
|
||||
ADDMETHOD_NOBASE(allocateMemoryFromHostPtr, NEO::GraphicsAllocation *, nullptr, (const void *buffer, size_t size, bool hostCopyAllowed));
|
||||
|
||||
@@ -15,9 +15,6 @@ namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using MockDriverHandle = Mock<L0::ult::DriverHandle>;
|
||||
using namespace testing;
|
||||
using ::testing::Invoke;
|
||||
using ::testing::Return;
|
||||
|
||||
Mock<DriverHandle>::Mock() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user