STM Runtime.
Overview: STM is a co-operative, non-preemptive, static scheduling framework for real-time systems. The STM runtime is a library that executes a schedule produced offline by the STM compiler, enforcing data dependency ordering and control flow ordering across engines on a Tegra SoC.
STM Clients: Every STM client corresponds to an OS process. All STM clients mentioned to the STM compiler must be launched before any STM client will begin scheduling runnables.
STM Master: Alongside STM clients, the STM master executable needs to be launched and passed a .stm file generated by the STM compiler. STM clients will block at the call to stmClientInit() until the STM master process has been launched.
Definition in file stm.h.
Go to the source code of this file.
Data Structures | |
struct | stmRunnableInfo_t |
Information which can be queried by CPU runnables using stmGetRuntimeInfo() More... | |
Typedefs | |
typedef void(* | stmCudaSubmitter_t) (void *userdata, cudaStream_t stream) |
Function signature for STM CUDA submitter runnable. More... | |
typedef void(* | stmCuDlaStandaloneSubmitter_t) (void *userdata, cudlaDevHandle cudla) |
Function signature for STM cuDLA standalone submitter runnable. More... | |
typedef void(* | stmCuDlaSubmitter_t) (void *userdata, cudaStream_t cudla) |
Function signature for STM cuDLA hybrid submitter runnable. More... | |
typedef void(* | stmRunnable_t) (void *userdata) |
Function signature for STM CPU runnable. More... | |
typedef void(* | stmScheduleSwitchCallback_t) (uint16_t startScheduleId, uint16_t hyperepochId, void *userdata) |
Function signature for STM schedule switch callback. More... | |
typedef void(* | stmVpuSubmitter_t) (void *userdata, cupvaStream_t vpu) |
Function signature for STM VPU submitter runnable. More... | |
typedef void(* | stmVulkanSubmitter_t) (void *userdata, VkQueue queue) |
Functions | |
STM_API void | stmClientExit (void) |
Cleans up STM client context. No STM APIs can be called after this. More... | |
STM_API stmErrorCode_t | stmClientInit (const char *clientName) |
Initialize STM client context. More... | |
STM_API stmErrorCode_t | stmClientInitWithDiscriminator (const char *clientName, int32_t discriminator) |
Initialize STM client context with a discriminator. More... | |
STM_API stmErrorCode_t | stmEnterScheduler (void) |
Yield to STM scheduler, which will schedule all registered runnables in the STM schedule periodically until completion. This function will not return until a runnable calls stmExitScheduler() or the number of epochs specified in the STM master process have completed. More... | |
STM_API stmErrorCode_t | stmExitScheduler (void) |
Return from stmEnterScheduler(). More... | |
STM_API stmErrorCode_t | stmGetRuntimeInfo (stmRunnableInfo_t *info) |
Get runtime information about execution. More... | |
STM_API stmErrorCode_t | stmRegisterCallBack (stmScheduleSwitchCallback_t func, void *userdata) |
Registers a callback function with a client to be invoked during a schedule switch. Before this client starts running, the callback function will be invoked. More... | |
STM_API stmErrorCode_t | stmRegisterCpuRunnable (stmRunnable_t func, const char *const runnableId, void *userdata) |
Registers an stmRunnable_t function with the name provided by the user to the STM compiler. More... | |
STM_API stmErrorCode_t | stmRegisterCudaResource (const char *resourceName, cudaStream_t stream) |
Registers a CUDA stream resource. More... | |
STM_API stmErrorCode_t | stmRegisterCudaSubmitter (stmCudaSubmitter_t func, const char *const runnableId, void *userdata) |
Registers an stmCudaSubmitter_t function with the name provided by the user to the STM compiler. More... | |
STM_API stmErrorCode_t | stmRegisterCuDlaResource (const char *resourceName, cudaStream_t cudla) |
Registers a cuDLA hybrid resource. More... | |
STM_API stmErrorCode_t | stmRegisterCuDlaStandaloneResource (const char *resourceName, cudlaDevHandle cudla) |
Registers a cuDLA standalone resource. More... | |
STM_API stmErrorCode_t | stmRegisterCuDlaStandaloneSubmitter (stmCuDlaStandaloneSubmitter_t func, const char *const runnableId, void *userdata) |
Registers an stmCudlaStandaloneSubmitter_t function with the name provided by the user to the STM compiler. More... | |
STM_API stmErrorCode_t | stmRegisterCuDlaSubmitter (stmCuDlaSubmitter_t func, const char *const runnableId, void *userdata) |
Registers an stmCudlaSubmitter_t function with the name provided by the user to the STM compiler. More... | |
STM_API stmErrorCode_t | stmRegisterVpuResource (const char *resourceName, cupvaStream_t vpu) |
Registers a cuPVA resource. More... | |
STM_API stmErrorCode_t | stmRegisterVpuSubmitter (stmVpuSubmitter_t func, const char *const runnableId, void *userdata) |
Registers an stmVpuSubmitter_t function with the name provided by the user to the STM compiler. More... | |
STM_API stmErrorCode_t | stmRegisterVulkanResource (const char *resourceName, VkQueue queue, VkDevice device, VkPhysicalDevice physicalDevice, VkInstance instance) |
STM_API stmErrorCode_t | stmRegisterVulkanSubmitter (stmVulkanSubmitter_t func, const char *const runnableId, void *userdata) |
typedef void(* stmCudaSubmitter_t) (void *userdata, cudaStream_t stream) |
Function signature for STM CUDA submitter runnable.
[in] | userdata | Pointer to any data needed by the runnable |
[in] | stream | CUDA stream created by application for the kernels |
typedef void(* stmCuDlaStandaloneSubmitter_t) (void *userdata, cudlaDevHandle cudla) |
Function signature for STM cuDLA standalone submitter runnable.
[in] | userdata | Pointer to any data needed by the runnable |
[in] | cudla | cuDLA device handle created by application |
typedef void(* stmCuDlaSubmitter_t) (void *userdata, cudaStream_t cudla) |
Function signature for STM cuDLA hybrid submitter runnable.
[in] | userdata | Pointer to any data needed by the runnable |
[in] | cudla | CUDA stream created by application |
typedef void(* stmRunnable_t) (void *userdata) |
typedef void(* stmScheduleSwitchCallback_t) (uint16_t startScheduleId, uint16_t hyperepochId, void *userdata) |
typedef void(* stmVpuSubmitter_t) (void *userdata, cupvaStream_t vpu) |
Function signature for STM VPU submitter runnable.
[in] | userdata | Pointer to any data needed by the runnable |
[in] | vpu | cuPVA stream created by application |
typedef void(* stmVulkanSubmitter_t) (void *userdata, VkQueue queue) |
STM_API void stmClientExit | ( | void | ) |
Cleans up STM client context. No STM APIs can be called after this.
STM_API stmErrorCode_t stmClientInit | ( | const char * | clientName | ) |
Initialize STM client context.
discriminator
= -1. Calling this after registering resources and runnables will allow the client to also receive schedule information here instead of in stmEnterScheduler. STM_API stmErrorCode_t stmClientInitWithDiscriminator | ( | const char * | clientName, |
int32_t | discriminator | ||
) |
Initialize STM client context with a discriminator.
discriminator
is started. Client contexts should be cleaned up with stmClientExit() after STM has completed its execution. Client must call at most one of the two: stmClientInit() or stmClientInitWithDiscriminator() All negative values of discriminator
are equivalent and the same as calling stmClientInit() Calling this after registering resources and runnables will allow the client to also receive schedule information here instead of in stmEnterScheduler. STM_API stmErrorCode_t stmEnterScheduler | ( | void | ) |
Yield to STM scheduler, which will schedule all registered runnables in the STM schedule periodically until completion. This function will not return until a runnable calls stmExitScheduler() or the number of epochs specified in the STM master process have completed.
STM_API stmErrorCode_t stmExitScheduler | ( | void | ) |
Return from stmEnterScheduler().
STM_API stmErrorCode_t stmGetRuntimeInfo | ( | stmRunnableInfo_t * | info | ) |
Get runtime information about execution.
[out] | info | Pointer to stmRunnableInfo_t whose fields will be populated |
STM_API stmErrorCode_t stmRegisterCallBack | ( | stmScheduleSwitchCallback_t | func, |
void * | userdata | ||
) |
Registers a callback function with a client to be invoked during a schedule switch. Before this client starts running, the callback function will be invoked.
[in] | func | The callback function to be executed. |
[in] | userdata | Optional pointer to any data needed by the callback. |
STM_API stmErrorCode_t stmRegisterCpuRunnable | ( | stmRunnable_t | func, |
const char *const | runnableId, | ||
void * | userdata | ||
) |
Registers an stmRunnable_t function with the name provided by the user to the STM compiler.
[in] | func | STM CPU runnable function pointer. |
[in] | runnableId | Name of CPU runnable provided to the STM compiler. |
[in] | userdata | Pointer to any data needed by the runnable. |
STM_API stmErrorCode_t stmRegisterCudaResource | ( | const char * | resourceName, |
cudaStream_t | stream | ||
) |
Registers a CUDA stream resource.
[in] | resourceName | Name of resource. Needs to match resource name passed to STM compiler. |
[in] | stream | CUDA stream created by application. |
STM_API stmErrorCode_t stmRegisterCudaSubmitter | ( | stmCudaSubmitter_t | func, |
const char *const | runnableId, | ||
void * | userdata | ||
) |
Registers an stmCudaSubmitter_t function with the name provided by the user to the STM compiler.
[in] | func | STM CUDA submitter runnable function pointer. |
[in] | runnableId | Name of CUDA submitter runnable provided to the STM compiler. |
[in] | userdata | Pointer to any data needed by the runnable. |
STM_API stmErrorCode_t stmRegisterCuDlaResource | ( | const char * | resourceName, |
cudaStream_t | cudla | ||
) |
Registers a cuDLA hybrid resource.
[in] | resourceName | Name of resource. Needs to match resource name passed to STM compiler. |
[in] | cudla | The CUDA stream created by the application used for cuDLA task submission |
STM_API stmErrorCode_t stmRegisterCuDlaStandaloneResource | ( | const char * | resourceName, |
cudlaDevHandle | cudla | ||
) |
Registers a cuDLA standalone resource.
[in] | resourceName | Name of resource. Needs to match resource name passed to STM compiler. |
[in] | cudla | The cuDLA device handle created by the application used for cuDLA task submission |
STM_API stmErrorCode_t stmRegisterCuDlaStandaloneSubmitter | ( | stmCuDlaStandaloneSubmitter_t | func, |
const char *const | runnableId, | ||
void * | userdata | ||
) |
Registers an stmCudlaStandaloneSubmitter_t function with the name provided by the user to the STM compiler.
[in] | func | STM cuDLA standalone submitter runnable function pointer. |
[in] | runnableId | Name of cuDLA standalone submitter runnable provided to the STM compiler. |
[in] | userdata | Pointer to any data needed by the runnable. |
STM_API stmErrorCode_t stmRegisterCuDlaSubmitter | ( | stmCuDlaSubmitter_t | func, |
const char *const | runnableId, | ||
void * | userdata | ||
) |
Registers an stmCudlaSubmitter_t function with the name provided by the user to the STM compiler.
[in] | func | STM cuDLA submitter runnable function pointer. |
[in] | runnableId | Name of cuDLA submitter runnable provided to the STM compiler. |
[in] | userdata | Pointer to any data needed by the runnable. |
STM_API stmErrorCode_t stmRegisterVpuResource | ( | const char * | resourceName, |
cupvaStream_t | vpu | ||
) |
Registers a cuPVA resource.
[in] | resourceName | Name of resource. Needs to match resource name passed to STM compiler. |
[in] | vpu | cuPVA stream created by application. |
STM_API stmErrorCode_t stmRegisterVpuSubmitter | ( | stmVpuSubmitter_t | func, |
const char *const | runnableId, | ||
void * | userdata | ||
) |
Registers an stmVpuSubmitter_t function with the name provided by the user to the STM compiler.
[in] | func | STM cuPVA submitter runnable function pointer. |
[in] | runnableId | Name of cuPVA submitter runnable provided to the STM compiler. |
[in] | userdata | Pointer to any data needed by the runnable. |
STM_API stmErrorCode_t stmRegisterVulkanResource | ( | const char * | resourceName, |
VkQueue | queue, | ||
VkDevice | device, | ||
VkPhysicalDevice | physicalDevice, | ||
VkInstance | instance | ||
) |
STM_API stmErrorCode_t stmRegisterVulkanSubmitter | ( | stmVulkanSubmitter_t | func, |
const char *const | runnableId, | ||
void * | userdata | ||
) |