2020-03-06 11:09:57 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "level_zero/tools/source/sysman/sysman.h"
|
|
|
|
|
|
2020-07-03 20:05:35 +05:30
|
|
|
#include "level_zero/core/source/device/device_imp.h"
|
2020-03-18 22:21:57 -07:00
|
|
|
#include "level_zero/core/source/driver/driver.h"
|
|
|
|
|
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
2020-03-06 11:09:57 +01:00
|
|
|
#include "level_zero/tools/source/sysman/sysman_imp.h"
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace L0 {
|
|
|
|
|
|
2020-07-03 20:05:35 +05:30
|
|
|
SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t device) {
|
|
|
|
|
auto isSysmanEnabled = getenv("ZES_ENABLE_SYSMAN");
|
2020-07-13 21:50:32 +05:30
|
|
|
if ((isSysmanEnabled == nullptr) || (device == nullptr)) {
|
2020-07-03 20:05:35 +05:30
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
auto isSysmanEnabledAsInt = atoi(isSysmanEnabled);
|
|
|
|
|
if (isSysmanEnabledAsInt == 1) {
|
|
|
|
|
SysmanDeviceImp *sysman = new SysmanDeviceImp(device);
|
|
|
|
|
UNRECOVERABLE_IF(!sysman);
|
|
|
|
|
sysman->init();
|
|
|
|
|
return sysman;
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DeviceImp::setSysmanHandle(SysmanDevice *pSysman) {
|
|
|
|
|
pSysmanDevice = pSysman;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SysmanDevice *DeviceImp::getSysmanHandle() {
|
|
|
|
|
return pSysmanDevice;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 11:09:57 +01:00
|
|
|
} // namespace L0
|