PandA-2024.02
Data Structures | Typedefs | Functions
c_backend_api.h File Reference
#include "c_runtime_api.h"
Include dependency graph for c_backend_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

TVM_DLL 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...
 
TVM_DLL int TVMBackendRegisterSystemLibSymbol (const char *name, void *ptr)
 Backend function to register system-wide library symbol. More...
 
TVM_DLL 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...
 
TVM_DLL int TVMBackendFreeWorkspace (int device_type, int device_id, void *ptr)
 Backend function to free temporal workspace. More...
 
TVM_DLL int TVMBackendParallelLaunch (FTVMParallelLambda flambda, void *cdata, int num_task)
 Backend function for running parallel jobs. More...
 
TVM_DLL int TVMBackendParallelBarrier (int task_id, TVMParallelGroupEnv *penv)
 BSP barrrier between parallel threads. More...
 
TVM_DLL 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...
 

Typedef Documentation

◆ FTVMParallelLambda

typedef int(* FTVMParallelLambda) (int task_id, TVMParallelGroupEnv *penv, void *cdata)

The callback function to execute a parallel lambda.

Parameters
task_idthe task id of the function.
penvThe parallel environment backs the execution.
cdataThe supporting closure data.

Definition at line 112 of file c_backend_api.h.

Function Documentation

◆ TVMBackendAllocWorkspace()

TVM_DLL 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.

Note
The result allocate spaced is ensured to be aligned to kTempAllocaAlignment.
Parameters
nbytesThe size of the space requested.
device_typeThe device type which the space will be allocated.
device_idThe device id which the space will be allocated.
dtype_code_hintThe type code of the array elements. Only used in certain backends such as OpenGL.
dtype_bits_hintThe type bits of the array elements. Only used in certain backends such as OpenGL.
Returns
nullptr when error is thrown, a valid ptr if success

Referenced by fused_nn_contrib_conv2d_NCHWc().

Here is the caller graph for this function:

◆ TVMBackendFreeWorkspace()

TVM_DLL int TVMBackendFreeWorkspace ( int  device_type,
int  device_id,
void *  ptr 
)

Backend function to free temporal workspace.

Parameters
ptrThe result allocated space pointer.
device_typeThe device type which the space will be allocated.
device_idThe device id which the space will be allocated.
Returns
0 when no error is thrown, -1 when failure happens
See also
TVMBackendAllocWorkspace

Referenced by fused_nn_contrib_conv2d_NCHWc().

Here is the caller graph for this function:

◆ TVMBackendGetFuncFromEnv()

TVM_DLL 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.

Parameters
mod_nodeThe module handle.
func_nameThe name of the function.
outThe result function.
Returns
0 when no error is thrown, -1 when failure happens

◆ TVMBackendParallelBarrier()

TVM_DLL int TVMBackendParallelBarrier ( int  task_id,
TVMParallelGroupEnv penv 
)

BSP barrrier between parallel threads.

Parameters
task_idthe task id of the function.
penvThe parallel environment backs the execution.
Returns
0 when no error is thrown, -1 when failure happens

◆ TVMBackendParallelLaunch()

TVM_DLL int TVMBackendParallelLaunch ( FTVMParallelLambda  flambda,
void *  cdata,
int  num_task 
)

Backend function for running parallel jobs.

Parameters
flambdaThe parallel function to be launched.
cdataThe closure data.
num_taskNumber of tasks to launch, can be 0, means launch with all available threads.
Returns
0 when no error is thrown, -1 when failure happens

◆ TVMBackendRegisterSystemLibSymbol()

TVM_DLL int TVMBackendRegisterSystemLibSymbol ( const char *  name,
void *  ptr 
)

Backend function to register system-wide library symbol.

Parameters
nameThe name of the symbol
ptrThe symbol address.
Returns
0 when no error is thrown, -1 when failure happens

◆ TVMBackendRunOnce()

TVM_DLL 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.

Parameters
handleAn global address to indicate f
fThe function to be ran
cdataThe closure data to pass to the function.
nbytesNumber of bytes in the closure data.
Returns
0 when no error is thrown, -1 when failure happens

Generated on Mon Feb 12 2024 13:03:11 for PandA-2024.02 by doxygen 1.8.13