Scheduler#

oneAPI Level Zero Specification - Version 1.18.31

Scheduler Functions#

zesSchedulerGetProperties#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetProperties(zes_sched_handle_t hScheduler, zes_sched_properties_t *pProperties)#

Get properties related to a scheduler component.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Handle for the component.

  • pProperties – [in,out] Structure that will contain property data.

Returns:

zesSchedulerGetCurrentMode#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetCurrentMode(zes_sched_handle_t hScheduler, zes_sched_mode_t *pMode)#

Get current scheduling mode in effect on a scheduler component.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • pMode – [in,out] Will contain the current scheduler mode.

Returns:

zesSchedulerGetTimeoutModeProperties#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetTimeoutModeProperties(zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeout_properties_t *pConfig)#

Get scheduler config for mode ZES_SCHED_MODE_TIMEOUT.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • getDefaults – [in] If TRUE, the driver will return the system default properties for this mode, otherwise it will return the current properties.

  • pConfig – [in,out] Will contain the current parameters for this mode.

Returns:

zesSchedulerGetTimesliceModeProperties#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetTimesliceModeProperties(zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeslice_properties_t *pConfig)#

Get scheduler config for mode ZES_SCHED_MODE_TIMESLICE.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • getDefaults – [in] If TRUE, the driver will return the system default properties for this mode, otherwise it will return the current properties.

  • pConfig – [in,out] Will contain the current parameters for this mode.

Returns:

zesSchedulerSetTimeoutMode#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetTimeoutMode(zes_sched_handle_t hScheduler, zes_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReload)#

Change scheduler mode to ZES_SCHED_MODE_TIMEOUT or update scheduler mode parameters if already running in this mode.

  • This mode is optimized for multiple applications or contexts submitting work to the hardware. When higher priority work arrives, the scheduler attempts to pause the current executing work within some timeout interval, then submits the other work.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • pProperties – [in] The properties to use when configuring this mode.

  • pNeedReload – [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode.

Returns:

zesSchedulerSetTimesliceMode#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetTimesliceMode(zes_sched_handle_t hScheduler, zes_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReload)#

Change scheduler mode to ZES_SCHED_MODE_TIMESLICE or update scheduler mode parameters if already running in this mode.

  • This mode is optimized to provide fair sharing of hardware execution time between multiple contexts submitting work to the hardware concurrently.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • pProperties – [in] The properties to use when configuring this mode.

  • pNeedReload – [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode.

Returns:

zesSchedulerSetExclusiveMode#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetExclusiveMode(zes_sched_handle_t hScheduler, ze_bool_t *pNeedReload)#

Change scheduler mode to ZES_SCHED_MODE_EXCLUSIVE.

  • This mode is optimized for single application/context use-cases. It permits a context to run indefinitely on the hardware without being preempted or terminated. All pending work for other contexts must wait until the running context completes with no further submitted work.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • pNeedReload – [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode.

Returns:

zesSchedulerSetComputeUnitDebugMode#

Added in version 1.0

ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetComputeUnitDebugMode(zes_sched_handle_t hScheduler, ze_bool_t *pNeedReload)#

Change scheduler mode to ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG.

  • This is a special mode that must ben enabled when debugging an application that uses this device e.g. using the Level0 Debug API.

  • It ensures that only one command queue can execute work on the hardware at a given time. Work is permitted to run as long as needed without enforcing any scheduler fairness policies.

  • The application may call this function from simultaneous threads.

  • The implementation of this function should be lock-free.

  • [DEPRECATED] No longer supported.

Parameters:
  • hScheduler – [in] Sysman handle for the component.

  • pNeedReload – [in,out] Will be set to TRUE if a device driver reload is needed to apply the new scheduler mode.

Returns:

Scheduler Structures#

zes_sched_properties_t#

Added in version 1.0

struct zes_sched_properties_t#

Properties related to scheduler component.

Public Members

zes_structure_type_t stype#

[in] type of this structure

void *pNext#

[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).

ze_bool_t onSubdevice#

[out] True if this resource is located on a sub-device; false means that the resource is on the device of the calling Sysman handle

uint32_t subdeviceId#

[out] If onSubdevice is true, this gives the ID of the sub-device

ze_bool_t canControl#

[out] Software can change the scheduler component configuration assuming the user has permissions.

zes_engine_type_flags_t engines#

[out] Bitfield of accelerator engine types that are managed by this scheduler component. Note that there can be more than one scheduler component for the same type of accelerator engine.

uint32_t supportedModes#

[out] Bitfield of scheduler modes that can be configured for this scheduler component (bitfield of 1<<zes_sched_mode_t).