mxnet
Classes | Namespaces | Macros
registry.h File Reference

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

#include <string>
#include <vector>
#include "packed_func.h"
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  mxnet::runtime::Registry
 Registry for global function. More...
 

Namespaces

 mxnet
 namespace of mxnet
 
 mxnet::runtime
 

Macros

#define MXNET_ATTRIBUTE_UNUSED
 helper macro to supress unused warning More...
 
#define MXNET_STR_CONCAT_(__x, __y)   __x##__y
 
#define MXNET_STR_CONCAT(__x, __y)   MXNET_STR_CONCAT_(__x, __y)
 
#define MXNET_FUNC_REG_VAR_DEF   static MXNET_ATTRIBUTE_UNUSED ::mxnet::runtime::Registry& __mk_##MXNET
 
#define MXNET_REGISTER_GLOBAL(OpName)
 Register a function globally. 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.
});

Macro Definition Documentation

◆ MXNET_ATTRIBUTE_UNUSED

#define MXNET_ATTRIBUTE_UNUSED

helper macro to supress unused warning

◆ MXNET_FUNC_REG_VAR_DEF

#define MXNET_FUNC_REG_VAR_DEF   static MXNET_ATTRIBUTE_UNUSED ::mxnet::runtime::Registry& __mk_##MXNET

◆ MXNET_REGISTER_GLOBAL

#define MXNET_REGISTER_GLOBAL (   OpName)
Value:

Register a function globally.

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

◆ MXNET_STR_CONCAT

#define MXNET_STR_CONCAT (   __x,
  __y 
)    MXNET_STR_CONCAT_(__x, __y)

◆ MXNET_STR_CONCAT_

#define MXNET_STR_CONCAT_ (   __x,
  __y 
)    __x##__y
MXNET_FUNC_REG_VAR_DEF
#define MXNET_FUNC_REG_VAR_DEF
Definition: registry.h:308
mxnet::runtime::Registry::Register
static MXNET_DLL Registry & Register(const std::string &name, bool override=false)
Register a function with given name.
MXNET_STR_CONCAT
#define MXNET_STR_CONCAT(__x, __y)
Definition: registry.h:306