mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Update Scheduler APIs as per latest spec
Change-Id: Ia8558ab30c83f1e30dae94cc7eb489ea7a8897da Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
fa8e39fe16
commit
94a26db5ba
43
level_zero/tools/source/sysman/scheduler/scheduler.cpp
Normal file
43
level_zero/tools/source/sysman/scheduler/scheduler.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/scheduler/scheduler_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
SchedulerHandleContext::~SchedulerHandleContext() {
|
||||
for (Scheduler *pScheduler : handleList) {
|
||||
delete pScheduler;
|
||||
}
|
||||
}
|
||||
|
||||
void SchedulerHandleContext::init() {
|
||||
Scheduler *pScheduler = new SchedulerImp(pOsSysman);
|
||||
if (pScheduler->initSuccess == true) {
|
||||
handleList.push_back(pScheduler);
|
||||
} else {
|
||||
delete pScheduler;
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t SchedulerHandleContext::schedulerGet(uint32_t *pCount, zes_sched_handle_t *phScheduler) {
|
||||
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 != phScheduler) {
|
||||
for (uint32_t i = 0; i < numToCopy; i++) {
|
||||
phScheduler[i] = handleList[i]->toHandle();
|
||||
}
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user