36 #ifndef TVM_RUNTIME_C_RUNTIME_API_H_ 37 #define TVM_RUNTIME_C_RUNTIME_API_H_ 41 #define TVM_WEAK __declspec(selectany) 43 #define TVM_WEAK __attribute__((weak)) 47 #include <emscripten/emscripten.h> 48 #define TVM_DLL EMSCRIPTEN_KEEPALIVE 54 #define TVM_DLL __declspec(dllexport) 56 #define TVM_DLL __declspec(dllimport) 59 #define TVM_DLL __attribute__((visibility("default"))) 64 #define TVM_VERSION "0.6.dev" 212 TVMModuleHandle* out);
223 TVMModuleHandle dep);
234 const char* func_name,
236 TVMFunctionHandle *out);
336 TVMRetValueHandle ret,
337 void* resource_handle);
368 void* resource_handle,
370 TVMFunctionHandle *out);
382 const char* name, TVMFunctionHandle f,
int override);
402 const char*** out_array);
426 TVMArrayHandle* out);
466 TVMStreamHandle stream);
476 TVMArrayHandle* out);
549 TVMStreamHandle dst);
563 #endif // TVM_RUNTIME_C_RUNTIME_API_H_ TVM_DLL const char * TVMGetLastError(void)
return str message of the last error all function in this file will return 0 when success and -1 when...
DLDataType TVMType
The data type used in TVM Runtime.
int(* TVMPackedCFunc)(TVMValue *args, int *type_codes, int num_args, TVMRetValueHandle ret, void *resource_handle)
C type of packed function.
The common header of DLPack.
TVM_DLL int TVMModGetFunction(TVMModuleHandle mod, const char *func_name, int query_imports, TVMFunctionHandle *out)
Get function from the module.
void * TVMModuleHandle
Handle to TVM runtime modules.
TVMArray * TVMArrayHandle
the array handle
TVM_DLL int TVMFuncRegisterGlobal(const char *name, TVMFunctionHandle f, int override)
Register the function to runtime's global table.
TVM_DLL int TVMStreamCreate(int device_type, int device_id, TVMStreamHandle *out)
Create a new runtime stream.
A Device context for Tensor and operator.
TVM_DLL int TVMFuncCreateFromCFunc(TVMPackedCFunc func, void *resource_handle, TVMPackedCFuncFinalizer fin, TVMFunctionHandle *out)
Wrap a TVMPackedCFunc to become a FunctionHandle.
TVM_DLL int TVMArrayFromDLPack(DLManagedTensor *from, TVMArrayHandle *out)
Produce an array from the DLManagedTensor that shares data memory with the DLManagedTensor.
TVM_DLL int TVMFuncListGlobalNames(int *out_size, const char ***out_array)
List all the globally registered function name.
TVM_DLL int TVMModImport(TVMModuleHandle mod, TVMModuleHandle dep)
Add dep to mod's dependency. This allows functions in this module to use modules. ...
Union type of values being passed through API and function calls.
TVM_DLL int TVMCFuncSetReturn(TVMRetValueHandle ret, TVMValue *value, int *type_code, int num_ret)
Set the return value of TVMPackedCFunc.
TVM_DLL int TVMModFree(TVMModuleHandle mod)
Free the Module.
TVM_DLL int TVMArrayCopyToBytes(TVMArrayHandle handle, void *data, size_t nbytes)
Copy array data to CPU byte array.
Byte array type used to pass in byte array When kBytes is used as data type.
void * TVMStreamHandle
The stream that is specific to device can be NULL, which indicates the default one.
TVM_DLL int TVMModLoadFromFile(const char *file_name, const char *format, TVMModuleHandle *out)
Load module from file.
TVM_DLL int TVMArrayCopyFromBytes(TVMArrayHandle handle, void *data, size_t nbytes)
Copy array data from CPU byte array.
TVM_DLL int TVMArrayAlloc(const tvm_index_t *shape, int ndim, int dtype_code, int dtype_bits, int dtype_lanes, int device_type, int device_id, TVMArrayHandle *out)
Allocate a nd-array's memory, including space of shape, of given spec.
TVM_DLL int TVMStreamFree(int device_type, int device_id, TVMStreamHandle stream)
Free a created stream handle.
TVMDeviceExtType
Extension device types in TVM.
DLTensor TVMArray
The tensor array stucture to TVM API.
C Tensor object, manage memory of DLTensor. This data structure is intended to faciliate the borrowin...
TVM_DLL int TVMArrayCopyFromTo(TVMArrayHandle from, TVMArrayHandle to, TVMStreamHandle stream)
Copy the array, both from and to must be valid during the copy.
TVM_DLL int TVMArrayToDLPack(TVMArrayHandle from, DLManagedTensor **out)
Produce a DLMangedTensor from the array that shares data memory with the array.
int(* TVMExtensionFuncDeclarer)(TVMFunctionHandle register_func_handle)
Signature for extension function declarer.
TVM_DLL int TVMFuncGetGlobal(const char *name, TVMFunctionHandle *out)
Get a global function.
void * TVMRetValueHandle
Handle to hold return value.
void * TVMFunctionHandle
Handle to packed function handle.
int64_t tvm_index_t
type of array index.
TVM_DLL int TVMGetObjectTag(TVMObjectHandle obj, int *tag)
Get the tag from an object.
DLContext TVMContext
The Device information, abstract away common device types.
TVM_DLL int TVMCbArgToReturn(TVMValue *value, int code)
Inplace translate callback argument value to return value. This is only needed for non-POD arguments...
TVMTypeCode
The type code in TVMType.
void * TVMObjectHandle
Handle to Object.
TVM_DLL int TVMFuncFree(TVMFunctionHandle func)
Free the function when it is no longer needed.
TVM_DLL int TVMExtTypeFree(void *handle, int type_code)
Free front-end extension type resource.
TVM_DLL int TVMStreamStreamSynchronize(int device_type, int device_id, TVMStreamHandle src, TVMStreamHandle dst)
Synchronize two streams of execution.
TVM_DLL int TVMSynchronize(int device_type, int device_id, TVMStreamHandle stream)
Wait until all computations on stream completes.
The data type the tensor can hold.
TVM_DLL void TVMAPISetLastError(const char *msg)
Used for implementing C API function. Set last error message before return.
Plain C Tensor object, does not manage memory.
TVM_DLL int TVMFuncCall(TVMFunctionHandle func, TVMValue *arg_values, int *type_codes, int num_args, TVMValue *ret_val, int *ret_type_code)
Call a Packed TVM Function.
TVM_DLL int TVMSetStream(int device_type, int device_id, TVMStreamHandle handle)
Set the runtime stream of current thread to be stream. The subsequent calls to the same device_type w...
TVM_DLL void TVMDLManagedTensorCallDeleter(DLManagedTensor *dltensor)
Delete (free) a DLManagedTensor's data.
TVM_DLL int TVMArrayFree(TVMArrayHandle handle)
Free the TVM Array.
void(* TVMPackedCFuncFinalizer)(void *resource_handle)
C callback to free the resource handle in C packed function.