|
tvm
|
TVM runtime backend API. More...
#include <tvm/runtime/base.h>Go to the source code of this file.
Classes | |
| struct | TVMParallelGroupEnv |
| Environment for TVM parallel task. More... | |
Typedefs | |
| typedef int(* | FTVMParallelLambda) (int task_id, TVMParallelGroupEnv *penv, void *cdata) |
| The callback function to execute a parallel lambda. More... | |
Functions | |
| int | TVMBackendGetFuncFromEnv (void *mod_node, const char *func_name, TVMFFIObjectHandle *out) |
| Backend function for modules to get function from its environment mod_node (its imports and global function). The user do should not call TVMFuncFree on func. More... | |
| void * | TVMBackendAllocWorkspace (int device_type, int device_id, uint64_t nbytes, int dtype_code_hint, int dtype_bits_hint) |
| Backend function to allocate temporal workspace. More... | |
| int | TVMBackendFreeWorkspace (int device_type, int device_id, void *ptr) |
| Backend function to free temporal workspace. More... | |
| int | TVMBackendParallelLaunch (FTVMParallelLambda flambda, void *cdata, int num_task) |
| Backend function for running parallel jobs. More... | |
| int | TVMBackendParallelBarrier (int task_id, TVMParallelGroupEnv *penv) |
| BSP barrrier between parallel threads. More... | |
| int | TVMBackendRunOnce (void **handle, int(*f)(void *), void *cdata, int nbytes) |
| Simple static initialization function. Run f once and set handle to be not null. This function is mainly used for test purpose. More... | |
TVM runtime backend API.
The functions defined in this header are intended to be used by compiled tvm operators, usually user do not need to use these function directly.
| typedef int(* FTVMParallelLambda) (int task_id, TVMParallelGroupEnv *penv, void *cdata) |
The callback function to execute a parallel lambda.
| task_id | the task id of the function. |
| penv | The parallel environment backs the execution. |
| cdata | The supporting closure data. |
| void* TVMBackendAllocWorkspace | ( | int | device_type, |
| int | device_id, | ||
| uint64_t | nbytes, | ||
| int | dtype_code_hint, | ||
| int | dtype_bits_hint | ||
| ) |
Backend function to allocate temporal workspace.
| nbytes | The size of the space requested. |
| device_type | The device type which the space will be allocated. |
| device_id | The device id which the space will be allocated. |
| dtype_code_hint | The type code of the array elements. Only used in certain backends such as OpenGL. |
| dtype_bits_hint | The type bits of the array elements. Only used in certain backends such as OpenGL. |
| int TVMBackendFreeWorkspace | ( | int | device_type, |
| int | device_id, | ||
| void * | ptr | ||
| ) |
Backend function to free temporal workspace.
| ptr | The result allocated space pointer. |
| device_type | The device type which the space will be allocated. |
| device_id | The device id which the space will be allocated. |
| int TVMBackendGetFuncFromEnv | ( | void * | mod_node, |
| const char * | func_name, | ||
| TVMFFIObjectHandle * | out | ||
| ) |
Backend function for modules to get function from its environment mod_node (its imports and global function). The user do should not call TVMFuncFree on func.
| mod_node | The module handle. |
| func_name | The name of the function. |
| out | The result function. |
| int TVMBackendParallelBarrier | ( | int | task_id, |
| TVMParallelGroupEnv * | penv | ||
| ) |
BSP barrrier between parallel threads.
| task_id | the task id of the function. |
| penv | The parallel environment backs the execution. |
| int TVMBackendParallelLaunch | ( | FTVMParallelLambda | flambda, |
| void * | cdata, | ||
| int | num_task | ||
| ) |
Backend function for running parallel jobs.
| flambda | The parallel function to be launched. |
| cdata | The closure data. |
| num_task | Number of tasks to launch, can be 0, means launch with all available threads. |
| int TVMBackendRunOnce | ( | void ** | handle, |
| int(*)(void *) | f, | ||
| void * | cdata, | ||
| int | nbytes | ||
| ) |
Simple static initialization function. Run f once and set handle to be not null. This function is mainly used for test purpose.
| handle | A global address to indicate f |
| f | The function to be run |
| cdata | The closure data to pass to the function. |
| nbytes | Number of bytes in the closure data. |