mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 00:03:14 +08:00
Scheduler API's boilerplate implementation
Add boilerplate for all scheduler APIs listed in spec. Change-Id: I0ba7e4d969f409e1a3360204dbc16037898d64c8 Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
13ccef4b7a
commit
4e75ea0496
24
level_zero/tools/source/sysman/scheduler/CMakeLists.txt
Normal file
24
level_zero/tools/source/sysman/scheduler/CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_SCHEDULER
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scheduler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scheduler_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scheduler_imp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler.h
|
||||
)
|
||||
|
||||
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_SCHEDULER}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_SCHEDULER ${L0_SRCS_TOOLS_SYSMAN_SCHEDULER})
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_SCHEDULER_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler_imp.cpp
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_SCHEDULER_LINUX}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_SCHEDULER_LINUX ${L0_SRCS_TOOLS_SYSMAN_SCHEDULER_LINUX})
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
#include "sysman/scheduler/scheduler_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
class LinuxSchedulerImp : public OsScheduler {
|
||||
public:
|
||||
LinuxSchedulerImp(OsSysman *pOsSysman);
|
||||
~LinuxSchedulerImp() override = default;
|
||||
|
||||
// Don't allow copies of the LinuxSchedulerImp object
|
||||
LinuxSchedulerImp(const LinuxSchedulerImp &obj) = delete;
|
||||
LinuxSchedulerImp &operator=(const LinuxSchedulerImp &obj) = delete;
|
||||
|
||||
private:
|
||||
SysfsAccess *pSysfsAccess;
|
||||
};
|
||||
|
||||
LinuxSchedulerImp::LinuxSchedulerImp(OsSysman *pOsSysman) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
}
|
||||
|
||||
OsScheduler *OsScheduler::create(OsSysman *pOsSysman) {
|
||||
LinuxSchedulerImp *pLinuxSchedulerImp = new LinuxSchedulerImp(pOsSysman);
|
||||
return static_cast<OsScheduler *>(pLinuxSchedulerImp);
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
19
level_zero/tools/source/sysman/scheduler/os_scheduler.h
Normal file
19
level_zero/tools/source/sysman/scheduler/os_scheduler.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
namespace L0 {
|
||||
struct OsSysman;
|
||||
class OsScheduler {
|
||||
public:
|
||||
static OsScheduler *create(OsSysman *pOsSysman);
|
||||
virtual ~OsScheduler() {}
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
26
level_zero/tools/source/sysman/scheduler/scheduler.h
Normal file
26
level_zero/tools/source/sysman/scheduler/scheduler.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class Scheduler {
|
||||
public:
|
||||
virtual ~Scheduler(){};
|
||||
virtual ze_result_t getCurrentMode(zet_sched_mode_t *pMode) = 0;
|
||||
virtual ze_result_t getTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) = 0;
|
||||
virtual ze_result_t getTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) = 0;
|
||||
virtual ze_result_t setTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0;
|
||||
virtual ze_result_t setTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0;
|
||||
virtual ze_result_t setExclusiveMode(ze_bool_t *pNeedReboot) = 0;
|
||||
virtual ze_result_t setComputeUnitDebugMode(ze_bool_t *pNeedReboot) = 0;
|
||||
virtual void init() = 0;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
55
level_zero/tools/source/sysman/scheduler/scheduler_imp.cpp
Normal file
55
level_zero/tools/source/sysman/scheduler/scheduler_imp.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "scheduler_imp.h"
|
||||
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ze_result_t SchedulerImp::getCurrentMode(zet_sched_mode_t *pMode) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t SchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t SchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t SchedulerImp::setTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t SchedulerImp::setTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t SchedulerImp::setExclusiveMode(ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t SchedulerImp::setComputeUnitDebugMode(ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
void SchedulerImp::init() {
|
||||
if (pOsScheduler == nullptr) {
|
||||
pOsScheduler = OsScheduler::create(pOsSysman);
|
||||
}
|
||||
UNRECOVERABLE_IF(nullptr == pOsScheduler);
|
||||
}
|
||||
|
||||
SchedulerImp::~SchedulerImp() {
|
||||
if (nullptr != pOsScheduler) {
|
||||
delete pOsScheduler;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
38
level_zero/tools/source/sysman/scheduler/scheduler_imp.h
Normal file
38
level_zero/tools/source/sysman/scheduler/scheduler_imp.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
#include "os_scheduler.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class SchedulerImp : public Scheduler {
|
||||
public:
|
||||
void init() override;
|
||||
ze_result_t getCurrentMode(zet_sched_mode_t *pMode) override;
|
||||
ze_result_t getTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) override;
|
||||
ze_result_t getTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) override;
|
||||
ze_result_t setTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) override;
|
||||
ze_result_t setTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) override;
|
||||
ze_result_t setExclusiveMode(ze_bool_t *pNeedReboot) override;
|
||||
ze_result_t setComputeUnitDebugMode(ze_bool_t *pNeedReboot) override;
|
||||
|
||||
SchedulerImp(OsSysman *pOsSysman) : pOsSysman(pOsSysman) { pOsScheduler = nullptr; };
|
||||
~SchedulerImp() override;
|
||||
// Don't allow copies of the SchedulerImp object
|
||||
SchedulerImp(const SchedulerImp &obj) = delete;
|
||||
SchedulerImp &operator=(const SchedulerImp &obj) = delete;
|
||||
|
||||
private:
|
||||
OsSysman *pOsSysman;
|
||||
OsScheduler *pOsScheduler;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_SCHEDULER_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_scheduler_imp.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${L0_SRCS_TOOLS_SYSMAN_SCHEDULER_WINDOWS}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_SCHEDULER_WINDOWS ${L0_SRCS_TOOLS_SYSMAN_SCHEDULER_WINDOWS})
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/tools/source/sysman/scheduler/os_scheduler.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class WddmSchedulerImp : public OsScheduler {};
|
||||
|
||||
OsScheduler *OsScheduler::create(OsSysman *pOsSysman) {
|
||||
WddmSchedulerImp *pWddmSchedulerImp = new WddmSchedulerImp();
|
||||
return static_cast<OsScheduler *>(pWddmSchedulerImp);
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "level_zero/tools/source/sysman/frequency/frequency.h"
|
||||
#include "level_zero/tools/source/sysman/memory/memory.h"
|
||||
#include "level_zero/tools/source/sysman/pci/pci.h"
|
||||
#include "level_zero/tools/source/sysman/scheduler/scheduler.h"
|
||||
#include "level_zero/tools/source/sysman/standby/standby.h"
|
||||
#include "level_zero/tools/source/sysman/sysman_device/sysman_device.h"
|
||||
#include <level_zero/zet_api.h>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "level_zero/core/source/driver/driver.h"
|
||||
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||
#include "level_zero/tools/source/sysman/pci/pci_imp.h"
|
||||
#include "level_zero/tools/source/sysman/scheduler/scheduler_imp.h"
|
||||
#include "level_zero/tools/source/sysman/sysman.h"
|
||||
#include "level_zero/tools/source/sysman/sysman_device/sysman_device_imp.h"
|
||||
|
||||
@@ -22,6 +23,7 @@ SysmanImp::SysmanImp(ze_device_handle_t hDevice) {
|
||||
pOsSysman = OsSysman::create(this);
|
||||
UNRECOVERABLE_IF(nullptr == pOsSysman);
|
||||
pPci = new PciImp(pOsSysman);
|
||||
pSched = new SchedulerImp(pOsSysman);
|
||||
pSysmanDevice = new SysmanDeviceImp(pOsSysman, hCoreDevice);
|
||||
pFrequencyHandleContext = new FrequencyHandleContext(pOsSysman);
|
||||
pStandbyHandleContext = new StandbyHandleContext(pOsSysman);
|
||||
@@ -44,6 +46,9 @@ SysmanImp::~SysmanImp() {
|
||||
if (pPci) {
|
||||
delete pPci;
|
||||
}
|
||||
if (pSched) {
|
||||
delete pSched;
|
||||
}
|
||||
delete pOsSysman;
|
||||
}
|
||||
|
||||
@@ -61,6 +66,9 @@ void SysmanImp::init() {
|
||||
if (pPci) {
|
||||
pPci->init();
|
||||
}
|
||||
if (pSched) {
|
||||
pSched->init();
|
||||
}
|
||||
if (pSysmanDevice) {
|
||||
pSysmanDevice->init();
|
||||
}
|
||||
@@ -71,31 +79,31 @@ ze_result_t SysmanImp::deviceGetProperties(zet_sysman_properties_t *pProperties)
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerGetCurrentMode(zet_sched_mode_t *pMode) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->getCurrentMode(pMode);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerGetTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->getTimeoutModeProperties(getDefaults, pConfig);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerGetTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->getTimesliceModeProperties(getDefaults, pConfig);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerSetTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->setTimeoutMode(pProperties, pNeedReboot);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerSetTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->setTimesliceMode(pProperties, pNeedReboot);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerSetExclusiveMode(ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->setExclusiveMode(pNeedReboot);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::schedulerSetComputeUnitDebugMode(ze_bool_t *pNeedReboot) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
return pSched->setComputeUnitDebugMode(pNeedReboot);
|
||||
}
|
||||
|
||||
ze_result_t SysmanImp::processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) {
|
||||
|
||||
@@ -30,6 +30,7 @@ struct SysmanImp : Sysman {
|
||||
|
||||
OsSysman *pOsSysman = nullptr;
|
||||
Pci *pPci = nullptr;
|
||||
Scheduler *pSched = nullptr;
|
||||
SysmanDevice *pSysmanDevice = nullptr;
|
||||
FrequencyHandleContext *pFrequencyHandleContext = nullptr;
|
||||
StandbyHandleContext *pStandbyHandleContext = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user