mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Change-Id: I1419231a721fab210e166d26a264cae04d661dcd Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com> Signed-off-by: macabral <matias.a.cabral@intel.com> Signed-off-by: davidoli <david.olien@intel.com> Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@intel.com> Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com> Signed-off-by: Latif, Raiyan <raiyan.latif@intel.com> Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
43 lines
1.0 KiB
C++
43 lines
1.0 KiB
C++
/*
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "level_zero/tools/source/sysman/sysman.h"
|
|
|
|
#include "level_zero/core/source/device/device_imp.h"
|
|
#include "level_zero/core/source/driver/driver.h"
|
|
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
|
#include "level_zero/tools/source/sysman/sysman_imp.h"
|
|
|
|
#include <vector>
|
|
|
|
namespace L0 {
|
|
|
|
SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t device) {
|
|
auto isSysmanEnabled = getenv("ZES_ENABLE_SYSMAN");
|
|
if ((isSysmanEnabled == nullptr) || (device == nullptr)) {
|
|
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;
|
|
}
|
|
|
|
} // namespace L0
|