mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
add support for multiple engines in scheduler API.
Change-Id: I2d530f88b8f4c8646c00ed712e5a07bb8439b759 Signed-off-by: Vilvaraj, T J Vivek <t.j.vivek.vilvaraj@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b93ad5e87f
commit
f211578148
@@ -6,7 +6,7 @@
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_SCHEDULER_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_scheduler_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler_imp.h
|
||||
)
|
||||
|
||||
|
||||
@@ -11,86 +11,157 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
const std::string LinuxSchedulerImp::preemptTimeoutMilliSecs("engine/rcs0/preempt_timeout_ms");
|
||||
const std::string LinuxSchedulerImp::defaultPreemptTimeouttMilliSecs("engine/rcs0/.defaults/preempt_timeout_ms");
|
||||
const std::string LinuxSchedulerImp::timesliceDurationMilliSecs("engine/rcs0/timeslice_duration_ms");
|
||||
const std::string LinuxSchedulerImp::defaultTimesliceDurationMilliSecs("engine/rcs0/.defaults/timeslice_duration_ms");
|
||||
const std::string LinuxSchedulerImp::heartbeatIntervalMilliSecs("engine/rcs0/heartbeat_interval_ms");
|
||||
const std::string LinuxSchedulerImp::defaultHeartbeatIntervalMilliSecs("engine/rcs0/.defaults/heartbeat_interval_ms");
|
||||
const std::string LinuxSchedulerImp::computeEngineDir("engine/rcs0");
|
||||
const std::string LinuxSchedulerImp::preemptTimeoutMilliSecs("preempt_timeout_ms");
|
||||
const std::string LinuxSchedulerImp::defaultPreemptTimeouttMilliSecs(".defaults/preempt_timeout_ms");
|
||||
const std::string LinuxSchedulerImp::timesliceDurationMilliSecs("timeslice_duration_ms");
|
||||
const std::string LinuxSchedulerImp::defaultTimesliceDurationMilliSecs(".defaults/timeslice_duration_ms");
|
||||
const std::string LinuxSchedulerImp::heartbeatIntervalMilliSecs("heartbeat_interval_ms");
|
||||
const std::string LinuxSchedulerImp::defaultHeartbeatIntervalMilliSecs(".defaults/heartbeat_interval_ms");
|
||||
const std::string LinuxSchedulerImp::engineDir("engine");
|
||||
constexpr uint16_t milliSecsToMicroSecs = 1000;
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getProperties(zes_sched_properties_t &schedProperties) {
|
||||
schedProperties.onSubdevice = false;
|
||||
schedProperties.canControl = canControlScheduler();
|
||||
schedProperties.engines = this->engineType;
|
||||
schedProperties.supportedModes = (1 << ZES_SCHED_MODE_TIMEOUT) | (1 << ZES_SCHED_MODE_TIMESLICE) | (1 << ZES_SCHED_MODE_EXCLUSIVE);
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) {
|
||||
ze_result_t result;
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(defaultPreemptTimeouttMilliSecs, timeout);
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
uint32_t i = 0;
|
||||
std::vector<uint64_t> timeoutVec = {};
|
||||
timeoutVec.resize(listOfEngines.size());
|
||||
for (auto engineName : listOfEngines) {
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultPreemptTimeouttMilliSecs, timeout);
|
||||
} else {
|
||||
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs, timeout);
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
timeout = timeout * milliSecsToMicroSecs;
|
||||
timeoutVec[i] = timeout;
|
||||
i++;
|
||||
} else {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// check if all engines of the same type have the same scheduling param values
|
||||
if (std::adjacent_find(timeoutVec.begin(), timeoutVec.end(), std::not_equal_to<>()) == timeoutVec.end()) {
|
||||
timeout = timeoutVec[0];
|
||||
return result;
|
||||
} else {
|
||||
result = pSysfsAccess->read(preemptTimeoutMilliSecs, timeout);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
timeout = timeout * milliSecsToMicroSecs;
|
||||
}
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool_t getDefault) {
|
||||
ze_result_t result;
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(defaultTimesliceDurationMilliSecs, timeslice);
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
uint32_t i = 0;
|
||||
std::vector<uint64_t> timesliceVec = {};
|
||||
timesliceVec.resize(listOfEngines.size());
|
||||
for (auto engineName : listOfEngines) {
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultTimesliceDurationMilliSecs, timeslice);
|
||||
} else {
|
||||
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs, timeslice);
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
timeslice = timeslice * milliSecsToMicroSecs;
|
||||
timesliceVec[i] = timeslice;
|
||||
i++;
|
||||
} else {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// check if all engines of the same type have the same scheduling param values
|
||||
if (std::adjacent_find(timesliceVec.begin(), timesliceVec.end(), std::not_equal_to<>()) == timesliceVec.end()) {
|
||||
timeslice = timesliceVec[0];
|
||||
return result;
|
||||
} else {
|
||||
result = pSysfsAccess->read(timesliceDurationMilliSecs, timeslice);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
timeslice = timeslice * milliSecsToMicroSecs;
|
||||
}
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool_t getDefault) {
|
||||
ze_result_t result;
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(defaultHeartbeatIntervalMilliSecs, heartbeat);
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
uint32_t i = 0;
|
||||
std::vector<uint64_t> heartbeatVec = {};
|
||||
heartbeatVec.resize(listOfEngines.size());
|
||||
for (auto engineName : listOfEngines) {
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultHeartbeatIntervalMilliSecs, heartbeat);
|
||||
} else {
|
||||
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs, heartbeat);
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
heartbeat = heartbeat * milliSecsToMicroSecs;
|
||||
heartbeatVec[i] = heartbeat;
|
||||
i++;
|
||||
} else {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// check if all engines of the same type have the same scheduling param values
|
||||
if (std::adjacent_find(heartbeatVec.begin(), heartbeatVec.end(), std::not_equal_to<>()) == heartbeatVec.end()) {
|
||||
heartbeat = heartbeatVec[0];
|
||||
return result;
|
||||
} else {
|
||||
result = pSysfsAccess->read(heartbeatIntervalMilliSecs, heartbeat);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
heartbeat = heartbeat * milliSecsToMicroSecs;
|
||||
}
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) {
|
||||
timeout = timeout / milliSecsToMicroSecs;
|
||||
ze_result_t result = pSysfsAccess->write(preemptTimeoutMilliSecs, timeout);
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
for (auto engineName : listOfEngines) {
|
||||
result = pSysfsAccess->write(engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs, timeout);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) {
|
||||
timeslice = timeslice / milliSecsToMicroSecs;
|
||||
ze_result_t result = pSysfsAccess->write(timesliceDurationMilliSecs, timeslice);
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
for (auto engineName : listOfEngines) {
|
||||
result = pSysfsAccess->write(engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs, timeslice);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) {
|
||||
heartbeat = heartbeat / milliSecsToMicroSecs;
|
||||
ze_result_t result = pSysfsAccess->write(heartbeatIntervalMilliSecs, heartbeat);
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
for (auto engineName : listOfEngines) {
|
||||
result = pSysfsAccess->write(engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs, heartbeat);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -99,17 +170,52 @@ ze_bool_t LinuxSchedulerImp::canControlScheduler() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool LinuxSchedulerImp::isSchedulerSupported() {
|
||||
return (ZE_RESULT_SUCCESS == pSysfsAccess->canRead(computeEngineDir));
|
||||
static const std::multimap<zes_engine_type_flag_t, std::string> level0EngineTypeToSysfsEngineMap = {
|
||||
{ZES_ENGINE_TYPE_FLAG_COMPUTE, "rcs"},
|
||||
{ZES_ENGINE_TYPE_FLAG_DMA, "bcs"},
|
||||
{ZES_ENGINE_TYPE_FLAG_MEDIA, "vcs"},
|
||||
{ZES_ENGINE_TYPE_FLAG_OTHER, "vecs"}};
|
||||
|
||||
ze_result_t OsScheduler::getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &mapOfEngines, OsSysman *pOsSysman) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
auto pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
std::vector<std::string> localListOfAllEngines = {};
|
||||
auto result = pSysfsAccess->scanDirEntries(LinuxSchedulerImp::engineDir, localListOfAllEngines);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
for_each(localListOfAllEngines.begin(), localListOfAllEngines.end(),
|
||||
[&](std::string &mappedEngine) {
|
||||
for (auto itr = level0EngineTypeToSysfsEngineMap.begin(); itr != level0EngineTypeToSysfsEngineMap.end(); itr++) {
|
||||
char digits[] = "0123456789";
|
||||
auto mappedEngineName = mappedEngine.substr(0, mappedEngine.find_first_of(digits, 0));
|
||||
if (0 == mappedEngineName.compare(itr->second.c_str())) {
|
||||
auto ret = mapOfEngines.find(itr->first);
|
||||
if (ret != mapOfEngines.end()) {
|
||||
ret->second.push_back(mappedEngine);
|
||||
} else {
|
||||
std::vector<std::string> engineVec = {};
|
||||
engineVec.push_back(mappedEngine);
|
||||
mapOfEngines.emplace(itr->first, engineVec);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
LinuxSchedulerImp::LinuxSchedulerImp(OsSysman *pOsSysman) {
|
||||
LinuxSchedulerImp::LinuxSchedulerImp(OsSysman *pOsSysman, zes_engine_type_flag_t type, std::vector<std::string> &listOfEngines) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
engineType = type;
|
||||
this->listOfEngines = listOfEngines;
|
||||
}
|
||||
|
||||
OsScheduler *OsScheduler::create(OsSysman *pOsSysman) {
|
||||
LinuxSchedulerImp *pLinuxSchedulerImp = new LinuxSchedulerImp(pOsSysman);
|
||||
OsScheduler *OsScheduler::create(OsSysman *pOsSysman, zes_engine_type_flag_t type, std::vector<std::string> &listOfEngines) {
|
||||
LinuxSchedulerImp *pLinuxSchedulerImp = new LinuxSchedulerImp(pOsSysman, type, listOfEngines);
|
||||
return static_cast<OsScheduler *>(pLinuxSchedulerImp);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,15 @@ class LinuxSchedulerImp : public OsScheduler, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t setTimesliceDuration(uint64_t timeslice) override;
|
||||
ze_result_t setHeartbeatInterval(uint64_t heartbeat) override;
|
||||
ze_bool_t canControlScheduler() override;
|
||||
bool isSchedulerSupported() override;
|
||||
ze_result_t getProperties(zes_sched_properties_t &properties) override;
|
||||
LinuxSchedulerImp() = default;
|
||||
LinuxSchedulerImp(OsSysman *pOsSysman);
|
||||
LinuxSchedulerImp(OsSysman *pOsSysman, zes_engine_type_flag_t type, std::vector<std::string> &listOfEngines);
|
||||
~LinuxSchedulerImp() override = default;
|
||||
static const std::string engineDir;
|
||||
|
||||
protected:
|
||||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
zes_engine_type_flag_t engineType = ZES_ENGINE_TYPE_FLAG_OTHER;
|
||||
|
||||
private:
|
||||
static const std::string preemptTimeoutMilliSecs;
|
||||
@@ -41,7 +43,7 @@ class LinuxSchedulerImp : public OsScheduler, NEO::NonCopyableOrMovableClass {
|
||||
static const std::string defaultTimesliceDurationMilliSecs;
|
||||
static const std::string heartbeatIntervalMilliSecs;
|
||||
static const std::string defaultHeartbeatIntervalMilliSecs;
|
||||
static const std::string computeEngineDir;
|
||||
std::vector<std::string> listOfEngines = {};
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -8,8 +8,14 @@
|
||||
#pragma once
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
struct OsSysman;
|
||||
using namespace std;
|
||||
|
||||
class OsScheduler {
|
||||
public:
|
||||
virtual ze_result_t getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) = 0;
|
||||
@@ -19,8 +25,9 @@ class OsScheduler {
|
||||
virtual ze_result_t setTimesliceDuration(uint64_t timeslice) = 0;
|
||||
virtual ze_result_t setHeartbeatInterval(uint64_t heartbeat) = 0;
|
||||
virtual ze_bool_t canControlScheduler() = 0;
|
||||
virtual bool isSchedulerSupported() = 0;
|
||||
static OsScheduler *create(OsSysman *pOsSysman);
|
||||
virtual ze_result_t getProperties(zes_sched_properties_t &properties) = 0;
|
||||
static OsScheduler *create(OsSysman *pOsSysman, zes_engine_type_flag_t engineType, std::vector<std::string> &listOfEngines);
|
||||
static ze_result_t getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &listOfEngines, OsSysman *pOsSysman);
|
||||
virtual ~OsScheduler() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,23 +6,33 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/scheduler/scheduler_imp.h"
|
||||
|
||||
class OsScheduler;
|
||||
namespace L0 {
|
||||
|
||||
SchedulerHandleContext::SchedulerHandleContext(OsSysman *pOsSysman) {
|
||||
this->pOsSysman = pOsSysman;
|
||||
}
|
||||
|
||||
SchedulerHandleContext::~SchedulerHandleContext() {
|
||||
for (Scheduler *pScheduler : handleList) {
|
||||
delete pScheduler;
|
||||
}
|
||||
handleList.clear();
|
||||
}
|
||||
void SchedulerHandleContext::createHandle(zes_engine_type_flag_t engineType, std::vector<std::string> &listOfEngines) {
|
||||
Scheduler *pScheduler = new SchedulerImp(pOsSysman, engineType, listOfEngines);
|
||||
handleList.push_back(pScheduler);
|
||||
}
|
||||
|
||||
void SchedulerHandleContext::init() {
|
||||
Scheduler *pScheduler = new SchedulerImp(pOsSysman);
|
||||
if (pScheduler->initSuccess == true) {
|
||||
handleList.push_back(pScheduler);
|
||||
} else {
|
||||
delete pScheduler;
|
||||
std::map<zes_engine_type_flag_t, std::vector<std::string>> engineTypeInstance = {};
|
||||
OsScheduler::getNumEngineTypeAndInstances(engineTypeInstance, pOsSysman);
|
||||
for (auto itr = engineTypeInstance.begin(); itr != engineTypeInstance.end(); ++itr) {
|
||||
createHandle(itr->first, itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct _zes_sched_handle_t {
|
||||
@@ -37,7 +39,7 @@ class Scheduler : _zes_sched_handle_t {
|
||||
};
|
||||
|
||||
struct SchedulerHandleContext : NEO::NonCopyableOrMovableClass {
|
||||
SchedulerHandleContext(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
|
||||
SchedulerHandleContext(OsSysman *pOsSysman);
|
||||
~SchedulerHandleContext();
|
||||
void init();
|
||||
ze_result_t schedulerGet(uint32_t *pCount, zes_sched_handle_t *phScheduler);
|
||||
@@ -45,6 +47,9 @@ struct SchedulerHandleContext : NEO::NonCopyableOrMovableClass {
|
||||
OsSysman *pOsSysman = nullptr;
|
||||
std::vector<Scheduler *> handleList = {};
|
||||
ze_device_handle_t hCoreDevice = nullptr;
|
||||
|
||||
private:
|
||||
void createHandle(zes_engine_type_flag_t engineType, std::vector<std::string> &listOfEngines);
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -141,17 +141,11 @@ ze_result_t SchedulerImp::schedulerGetProperties(zes_sched_properties_t *pProper
|
||||
}
|
||||
|
||||
void SchedulerImp::init() {
|
||||
this->initSuccess = pOsScheduler->isSchedulerSupported();
|
||||
properties.onSubdevice = false;
|
||||
properties.canControl = pOsScheduler->canControlScheduler();
|
||||
properties.engines = ZES_ENGINE_TYPE_FLAG_COMPUTE;
|
||||
properties.supportedModes = (1 << ZES_SCHED_MODE_TIMEOUT) | (1 << ZES_SCHED_MODE_TIMESLICE) | (1 << ZES_SCHED_MODE_EXCLUSIVE);
|
||||
pOsScheduler->getProperties(this->properties);
|
||||
}
|
||||
|
||||
SchedulerImp::SchedulerImp(OsSysman *pOsSysman) {
|
||||
if (pOsScheduler == nullptr) {
|
||||
pOsScheduler = OsScheduler::create(pOsSysman);
|
||||
}
|
||||
SchedulerImp::SchedulerImp(OsSysman *pOsSysman, zes_engine_type_flag_t engineType, std::vector<std::string> &listOfEngines) {
|
||||
pOsScheduler = OsScheduler::create(pOsSysman, engineType, listOfEngines);
|
||||
UNRECOVERABLE_IF(nullptr == pOsScheduler);
|
||||
init();
|
||||
};
|
||||
|
||||
@@ -29,8 +29,9 @@ class SchedulerImp : public Scheduler, NEO::NonCopyableOrMovableClass {
|
||||
|
||||
SchedulerImp() = default;
|
||||
OsScheduler *pOsScheduler = nullptr;
|
||||
SchedulerImp(OsSysman *pOsSysman);
|
||||
SchedulerImp(OsSysman *pOsSysman, zes_engine_type_flag_t type, std::vector<std::string> &listOfEngines);
|
||||
~SchedulerImp() override;
|
||||
zes_engine_type_flag_t engineType;
|
||||
|
||||
private:
|
||||
zes_sched_properties_t properties = {};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_SCHEDULER_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler_imp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler_imp.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -5,22 +5,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysman/scheduler/os_scheduler.h"
|
||||
#include "level_zero/tools/source/sysman/scheduler/windows/os_scheduler_imp.h"
|
||||
|
||||
#include "sysman/scheduler/scheduler_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class WddmSchedulerImp : public OsScheduler {
|
||||
public:
|
||||
ze_result_t getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) override;
|
||||
ze_result_t getTimesliceDuration(uint64_t ×lice, ze_bool_t getDefault) override;
|
||||
ze_result_t getHeartbeatInterval(uint64_t &heartbeat, ze_bool_t getDefault) override;
|
||||
ze_result_t setPreemptTimeout(uint64_t timeout) override;
|
||||
ze_result_t setTimesliceDuration(uint64_t timeslice) override;
|
||||
ze_result_t setHeartbeatInterval(uint64_t heartbeat) override;
|
||||
ze_bool_t canControlScheduler() override;
|
||||
bool isSchedulerSupported() override;
|
||||
};
|
||||
|
||||
ze_result_t WddmSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
@@ -49,11 +39,15 @@ ze_bool_t WddmSchedulerImp::canControlScheduler() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WddmSchedulerImp::isSchedulerSupported() {
|
||||
return false;
|
||||
ze_result_t WddmSchedulerImp::getProperties(zes_sched_properties_t &properties) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
OsScheduler *OsScheduler::create(OsSysman *pOsSysman) {
|
||||
ze_result_t OsScheduler::getNumEngineTypeAndInstances(std::map<zes_engine_type_flag_t, std::vector<std::string>> &listOfEngines, OsSysman *pOsSysman) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
OsScheduler *OsScheduler::create(OsSysman *pOsSysman, zes_engine_type_flag_t type, std::vector<std::string> &listOfEngines) {
|
||||
WddmSchedulerImp *pWddmSchedulerImp = new WddmSchedulerImp();
|
||||
return static_cast<OsScheduler *>(pWddmSchedulerImp);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysman/scheduler/scheduler_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class WddmSchedulerImp : public OsScheduler {
|
||||
public:
|
||||
ze_result_t getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) override;
|
||||
ze_result_t getTimesliceDuration(uint64_t ×lice, ze_bool_t getDefault) override;
|
||||
ze_result_t getHeartbeatInterval(uint64_t &heartbeat, ze_bool_t getDefault) override;
|
||||
ze_result_t setPreemptTimeout(uint64_t timeout) override;
|
||||
ze_result_t setTimesliceDuration(uint64_t timeslice) override;
|
||||
ze_result_t setHeartbeatInterval(uint64_t heartbeat) override;
|
||||
ze_bool_t canControlScheduler() override;
|
||||
ze_result_t getProperties(zes_sched_properties_t &properties) override;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user