24 #ifndef TVM_RUNTIME_CRT_FUNC_REGISTRY_H_ 25 #define TVM_RUNTIME_CRT_FUNC_REGISTRY_H_ 89 tvm_function_index_t* function_index);
115 #define TVM_AVERAGE_FUNCTION_NAME_STRLEN_BYTES 10 129 static const size_t kTvmAverageFuncEntrySizeBytes =
142 size_t buffer_size_bytes);
162 #endif // TVM_RUNTIME_CRT_FUNC_REGISTRY_H_ int TVMFuncRegistry_SetNumFuncs(const TVMFuncRegistry *reg, const uint16_t num_funcs)
Set the number of functions to registry.
TVMFuncRegistry registry
Definition: func_registry.h:108
#define TVM_AVERAGE_FUNCTION_NAME_STRLEN_BYTES
Definition: func_registry.h:115
const TVMBackendPackedCFunc * funcs
Function pointers, in the same order as their names in names.
Definition: func_registry.h:50
A data structure that facilitates function lookup by C-string name.
Definition: func_registry.h:41
struct TVMMutableFuncRegistry TVMMutableFuncRegistry
A TVMFuncRegistry that supports adding and changing the functions.
tvm_crt_error_t TVMFuncRegistry_Lookup(const TVMFuncRegistry *reg, const char *name, tvm_function_index_t *function_index)
Get packed function from registry by name.
tvm_crt_error_t TVMFuncRegistry_GetByIndex(const TVMFuncRegistry *reg, tvm_function_index_t index, TVMBackendPackedCFunc *out_func)
Fetch TVMBackendPackedCFunc given a function index.
Defines integral error codes returned by the CRT.
tvm_crt_error_t
Definition: error_codes.h:50
uint16_t tvm_function_index_t
Definition: func_registry.h:34
uint16_t tvm_module_index_t
Definition: func_registry.h:36
tvm_crt_error_t TVMMutableFuncRegistry_Set(TVMMutableFuncRegistry *reg, const char *name, TVMBackendPackedCFunc func, int override)
Add or set a function in the registry.
A TVMFuncRegistry that supports adding and changing the functions.
Definition: func_registry.h:107
size_t max_functions
maximum number of functions in this registry.
Definition: func_registry.h:111
uint16_t TVMFuncRegistry_GetNumFuncs(const TVMFuncRegistry *reg)
Get the of the number of functions from registry.
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.
Definition: c_backend_api.h:49
const char * TVMFuncRegistry_Get0thFunctionName(const TVMFuncRegistry *reg)
Get the address of 0th function from registry.
tvm_crt_error_t TVMMutableFuncRegistry_Create(TVMMutableFuncRegistry *reg, uint8_t *buffer, size_t buffer_size_bytes)
Create a new mutable function registry from a block of memory.
const char * names
Names of registered functions, concatenated together and separated by \0. An additional \0 is present...
Definition: func_registry.h:47
struct TVMFuncRegistry TVMFuncRegistry
A data structure that facilitates function lookup by C-string name.