Files
compute-runtime/level_zero/tools/source/sysman/engine/engine.h
Bill Jordan 909107cab6 Fix zesDeviceReset for Spec version 1.
This patch does the following:
- Fixes a bug in FsAccess::listDirectory that could return
ZE_RESULT_UNKNOWN_ERROR when no error has occurred.
- Fixes a bug in zesDeviceReset that would reset the device
if force was set to false, even if the device was in use.
- Fixes a bug in zesDeviceReset that would reset the device
if force was set to false without closing the file descriptor.
- Added a releaseResources method method to Device object.
This method does the same thing as the DeviceImp
destructor except it does not free the DeviceImp object
and it does not free the SysmanDeviceImp object.
- Added the releaseResources methods to Mock<Device> object.
- Moved the reset of the debugger out of DriverHandleImp
destructor and into DeviceImp releaseResources.
- Added a releaseEngine method to the EngineHandleContext. This
method frees all the Engine handles.
- On reset, I call the Devcie->releaseResources and
EngineHandleContext->releaseEngines before resetting the device.
- Added a -r (--reset) option to zello_sysman so I
could easily test resets.

With these patches, the L0 Sysman CTS for zesDeviceReset
both pass.

Change-Id: I31fad1b27bc5cc6befe31cd6f9319748e2683424
2020-10-05 19:55:14 +02:00

50 lines
1.1 KiB
C++

/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <level_zero/zes_api.h>
#include <map>
#include <vector>
struct _zes_engine_handle_t {
virtual ~_zes_engine_handle_t() = default;
};
namespace L0 {
struct OsSysman;
class Engine : _zes_engine_handle_t {
public:
virtual ze_result_t engineGetProperties(zes_engine_properties_t *pProperties) = 0;
virtual ze_result_t engineGetActivity(zes_engine_stats_t *pStats) = 0;
static Engine *fromHandle(zes_engine_handle_t handle) {
return static_cast<Engine *>(handle);
}
inline zes_engine_handle_t toHandle() { return this; }
};
struct EngineHandleContext {
EngineHandleContext(OsSysman *pOsSysman);
~EngineHandleContext();
void init();
void releaseEngines();
ze_result_t engineGet(uint32_t *pCount, zes_engine_handle_t *phEngine);
OsSysman *pOsSysman = nullptr;
std::vector<Engine *> handleList = {};
private:
void createHandle(zes_engine_group_t engineType, uint32_t engineInstance);
};
} // namespace L0