tvm
Classes | Namespaces | Macros | Functions
registry.h File Reference

This file defines the TVM global function registry. More...

#include <tvm/runtime/container/string.h>
#include <tvm/runtime/packed_func.h>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for registry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tvm::runtime::WrappedPythonObject
 A class that wraps a Python object and preserves its ownership. More...
 
class  tvm::runtime::Registry
 Registry for global function. More...
 

Namespaces

 tvm
 runtime implementation for LibTorch/TorchScript.
 
 tvm::runtime
 

Macros

#define TVM_FUNC_REG_VAR_DEF   static TVM_ATTRIBUTE_UNUSED ::tvm::runtime::Registry& __mk_##TVM
 
#define TVM_REGISTER_GLOBAL(OpName)    TVM_STR_CONCAT(TVM_FUNC_REG_VAR_DEF, __COUNTER__) = ::tvm::runtime::Registry::Register(OpName)
 Register a function globally. More...
 
#define TVM_STRINGIZE_DETAIL(x)   #x
 
#define TVM_STRINGIZE(x)   TVM_STRINGIZE_DETAIL(x)
 
#define TVM_DESCRIBE(...)   describe(__VA_ARGS__ "\n\nFrom:" __FILE__ ":" TVM_STRINGIZE(__LINE__))
 
#define TVM_ADD_FILELINE   "\n\nDefined in " __FILE__ ":L" TVM_STRINGIZE(__LINE__)
 Macro to include current line as string. More...
 

Functions

void tvm::runtime::EnvCheckSignals ()
 Check if signals have been sent to the process and if so invoke the registered signal handler in the frontend environment. More...
 

Detailed Description

This file defines the TVM global function registry.

The registered functions will be made available to front-end as well as backend users.

The registry stores type-erased functions. Each registered function is automatically exposed to front-end language(e.g. python).

Front-end can also pass callbacks as PackedFunc, or register then into the same global registry in C++. The goal is to mix the front-end language and the TVM back-end.

// register the function as MyAPIFuncName
TVM_REGISTER_GLOBAL(MyAPIFuncName)
.set_body([](TVMArgs args, TVMRetValue* rv) {
// my code.
});
#define TVM_REGISTER_GLOBAL(OpName)
Register a function globally.
Definition: registry.h:384
Definition: packed_func.h:38

Macro Definition Documentation

◆ TVM_ADD_FILELINE

#define TVM_ADD_FILELINE   "\n\nDefined in " __FILE__ ":L" TVM_STRINGIZE(__LINE__)

Macro to include current line as string.

◆ TVM_DESCRIBE

#define TVM_DESCRIBE (   ...)    describe(__VA_ARGS__ "\n\nFrom:" __FILE__ ":" TVM_STRINGIZE(__LINE__))

◆ TVM_FUNC_REG_VAR_DEF

#define TVM_FUNC_REG_VAR_DEF   static TVM_ATTRIBUTE_UNUSED ::tvm::runtime::Registry& __mk_##TVM

◆ TVM_REGISTER_GLOBAL

#define TVM_REGISTER_GLOBAL (   OpName)     TVM_STR_CONCAT(TVM_FUNC_REG_VAR_DEF, __COUNTER__) = ::tvm::runtime::Registry::Register(OpName)

Register a function globally.

.set_body([](TVMArgs args, TVMRetValue* rv) {
});

◆ TVM_STRINGIZE

#define TVM_STRINGIZE (   x)    TVM_STRINGIZE_DETAIL(x)

◆ TVM_STRINGIZE_DETAIL

#define TVM_STRINGIZE_DETAIL (   x)    #x