|
tvm
|
TVM runtime backend API. More...
#include <tvm/runtime/c_runtime_api.h>Go to the source code of this file.
Classes | |
| struct | TVMParallelGroupEnv |
| Environment for TVM parallel task. More... | |
Typedefs | |
| typedef int(* | TVMBackendPackedCFunc) (TVMValue *args, int *type_codes, int num_args, TVMValue *out_ret_value, int *out_ret_tcode, void *resource_handle) |
| Signature for backend functions exported as DLL. More... | |
| 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, TVMFunctionHandle *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... | |
| int | TVMBackendRegisterSystemLibSymbol (const char *name, void *ptr) |
| Backend function to register system-wide library symbol. 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 | TVMBackendRegisterEnvCAPI (const char *name, void *ptr) |
| Backend function to register execution environment(e.g. python) specific C APIs. 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. |
| typedef int(* TVMBackendPackedCFunc) (TVMValue *args, int *type_codes, int num_args, TVMValue *out_ret_value, int *out_ret_tcode, void *resource_handle) |
Signature for backend functions exported as DLL.
| args | The arguments |
| type_codes | The type codes of the arguments |
| num_args | Number of arguments. |
| out_ret_value | The output value of the return value. |
| out_ret_tcode | The output type code of the return value. |
| resource_handle | Pointer to associated resource. |
| 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, | ||
| TVMFunctionHandle * | 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 TVMBackendRegisterEnvCAPI | ( | const char * | name, |
| void * | ptr | ||
| ) |
Backend function to register execution environment(e.g. python) specific C APIs.
| name | The name of the symbol |
| ptr | The symbol address. |
| int TVMBackendRegisterSystemLibSymbol | ( | const char * | name, |
| void * | ptr | ||
| ) |
Backend function to register system-wide library symbol.
| name | The name of the symbol |
| ptr | The symbol address. |
| 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. |
1.8.13