mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Lazy init implementation for RAS module
Related-To: LOCI-3127 Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4bdd8860a1
commit
49aaf62bbd
@@ -396,4 +396,8 @@ OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = new LinuxSysmanImp(pParentSysmanDeviceImp);
|
||||
return static_cast<OsSysman *>(pLinuxSysmanImp);
|
||||
}
|
||||
std::vector<ze_device_handle_t> &LinuxSysmanImp::getDeviceHandles() {
|
||||
return pParentSysmanDeviceImp->deviceHandles;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -52,6 +52,7 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
|
||||
NEO::Drm &getDrm();
|
||||
PlatformMonitoringTech *getPlatformMonitoringTechAccess(uint32_t subDeviceId);
|
||||
Device *getDeviceHandle();
|
||||
std::vector<ze_device_handle_t> &getDeviceHandles() override;
|
||||
SysmanDeviceImp *getSysmanDeviceImp();
|
||||
std::string getPciCardBusDirectoryPath(std::string realPciPath);
|
||||
void releasePmtObject();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
#pragma once
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
struct SysmanDeviceImp;
|
||||
@@ -16,6 +19,7 @@ struct OsSysman {
|
||||
|
||||
virtual ze_result_t init() = 0;
|
||||
static OsSysman *create(SysmanDeviceImp *pSysmanImp);
|
||||
virtual std::vector<ze_device_handle_t> &getDeviceHandles() = 0;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/os_sysman.h"
|
||||
#include "level_zero/tools/source/sysman/ras/ras_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
@@ -38,6 +39,9 @@ void RasHandleContext::init(std::vector<ze_device_handle_t> &deviceHandles) {
|
||||
}
|
||||
ze_result_t RasHandleContext::rasGet(uint32_t *pCount,
|
||||
zes_ras_handle_t *phRas) {
|
||||
std::call_once(initRasOnce, [this]() {
|
||||
this->init(pOsSysman->getDeviceHandles());
|
||||
});
|
||||
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
|
||||
uint32_t numToCopy = std::min(*pCount, handleListSize);
|
||||
if (0 == *pCount || *pCount > handleListSize) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
struct _zes_ras_handle_t {
|
||||
@@ -48,6 +49,7 @@ struct RasHandleContext {
|
||||
|
||||
private:
|
||||
void createHandle(zes_ras_error_type_t type, ze_device_handle_t deviceHandle);
|
||||
std::once_flag initRasOnce;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -121,9 +121,6 @@ ze_result_t SysmanDeviceImp::init() {
|
||||
if (pSchedulerHandleContext) {
|
||||
pSchedulerHandleContext->init(deviceHandles);
|
||||
}
|
||||
if (pRasHandleContext) {
|
||||
pRasHandleContext->init(deviceHandles);
|
||||
}
|
||||
if (pMemoryHandleContext) {
|
||||
pMemoryHandleContext->init(deviceHandles);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,9 @@ FirmwareUtil *WddmSysmanImp::getFwUtilInterface() {
|
||||
Device *WddmSysmanImp::getDeviceHandle() {
|
||||
return pDevice;
|
||||
}
|
||||
|
||||
std::vector<ze_device_handle_t> &WddmSysmanImp::getDeviceHandles() {
|
||||
return pParentSysmanDeviceImp->deviceHandles;
|
||||
}
|
||||
NEO::Wddm &WddmSysmanImp::getWddm() {
|
||||
UNRECOVERABLE_IF(nullptr == pWddm);
|
||||
return *pWddm;
|
||||
|
||||
@@ -30,6 +30,7 @@ class WddmSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
|
||||
NEO::Wddm &getWddm();
|
||||
Device *getDeviceHandle();
|
||||
void releaseFwUtilInterface();
|
||||
std::vector<ze_device_handle_t> &getDeviceHandles() override;
|
||||
|
||||
protected:
|
||||
FirmwareUtil *pFwUtilInterface = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user