Files
compute-runtime/level_zero/sysman/source/ras/ras.cpp
Jitendra Sharma d29ed25f8b Add support for global_operations in new sysman design
Related-To: LOCI-4135
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
2023-04-05 17:25:03 +02:00

52 lines
1.2 KiB
C++

/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/sysman/source/ras/ras.h"
#include "shared/source/helpers/basic_math.h"
#include "level_zero/sysman/source/os_sysman.h"
namespace L0 {
namespace Sysman {
void RasHandleContext::releaseRasHandles() {
for (Ras *pRas : handleList) {
delete pRas;
}
handleList.clear();
}
RasHandleContext::~RasHandleContext() {
releaseRasHandles();
}
void RasHandleContext::init(uint32_t subDeviceCount) {
}
ze_result_t RasHandleContext::rasGet(uint32_t *pCount,
zes_ras_handle_t *phRas) {
std::call_once(initRasOnce, [this]() {
this->init(pOsSysman->getSubDeviceCount());
this->rasInitDone = true;
});
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
uint32_t numToCopy = std::min(*pCount, handleListSize);
if (0 == *pCount || *pCount > handleListSize) {
*pCount = handleListSize;
}
if (nullptr != phRas) {
for (uint32_t i = 0; i < numToCopy; i++) {
phRas[i] = handleList[i]->toHandle();
}
}
return ZE_RESULT_SUCCESS;
}
} // namespace Sysman
} // namespace L0