43 #ifndef TVM_RUNTIME_REGISTRY_H_ 44 #define TVM_RUNTIME_REGISTRY_H_ 137 template <
typename FLambda>
139 using FType =
typename detail::function_signature<FLambda>::FType;
163 template <
typename T,
typename R,
typename... Args>
165 auto fwrap = [f](T target, Args... params) -> R {
167 return (target.*f)(params...);
193 template <
typename T,
typename R,
typename... Args>
195 auto fwrap = [f](
const T target, Args... params) -> R {
197 return (target.*f)(params...);
233 template <
typename TObjectRef,
typename TNode,
typename R,
typename... Args,
234 typename =
typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
236 auto fwrap = [f](TObjectRef ref, Args... params) {
237 TNode* target = ref.operator->();
239 return (target->*f)(params...);
275 template <
typename TObjectRef,
typename TNode,
typename R,
typename... Args,
276 typename =
typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
278 auto fwrap = [f](TObjectRef ref, Args... params) {
279 const TNode* target = ref.operator->();
281 return (target->*f)(params...);
292 TVM_DLL
static Registry&
Register(
const std::string& name,
bool override =
false);
298 TVM_DLL
static bool Remove(
const std::string& name);
305 TVM_DLL
static const PackedFunc*
Get(
const std::string& name);
310 TVM_DLL
static std::vector<std::string>
ListNames();
323 #define TVM_FUNC_REG_VAR_DEF static TVM_ATTRIBUTE_UNUSED ::tvm::runtime::Registry& __mk_##TVM 333 #define TVM_REGISTER_GLOBAL(OpName) \ 334 TVM_STR_CONCAT(TVM_FUNC_REG_VAR_DEF, __COUNTER__) = ::tvm::runtime::Registry::Register(OpName) 336 #define TVM_STRINGIZE_DETAIL(x) #x 337 #define TVM_STRINGIZE(x) TVM_STRINGIZE_DETAIL(x) 338 #define TVM_DESCRIBE(...) describe(__VA_ARGS__ "\n\nFrom:" __FILE__ ":" TVM_STRINGIZE(__LINE__)) 342 #define TVM_ADD_FILELINE "\n\nDefined in " __FILE__ ":L" TVM_STRINGIZE(__LINE__) 346 #endif // TVM_RUNTIME_REGISTRY_H_ Registry & set_body_method(R(TNode::*f)(Args...))
set the body of the function to be the passed method pointer. Used when calling a method on a Node su...
Definition: registry.h:235
static std::vector< std::string > ListNames()
Get the names of currently registered global function.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:36
Registry & set_body_typed(FLambda f)
set the body of the function to the given function. Note that this will ignore default arg values and...
Definition: registry.h:138
Registry & set_body_method(R(TNode::*f)(Args...) const)
set the body of the function to be the passed method pointer. Used when calling a method on a Node su...
Definition: registry.h:277
PackedFunc func_
internal packed function
Definition: registry.h:319
static const PackedFunc * Get(const std::string &name)
Get the global function by name.
Registry & set_body_method(R(T::*f)(Args...) const)
set the body of the function to be the passed method pointer. Note that this will ignore default arg ...
Definition: registry.h:194
void EnvCheckSignals()
Check if signals have been sent to the process and if so invoke the registered signal handler in the ...
Registry & set_body(PackedFunc::FType f)
set the body of the function to be f
Definition: registry.h:111
std::function< void(TVMArgs args, TVMRetValue *rv)> FType
The internal std::function.
Definition: packed_func.h:88
Please refer to TypedPackedFunc<R(Args..)>.
Definition: packed_func.h:136
static bool Remove(const std::string &name)
Erase global function from registry, if exist.
Registry & set_body(PackedFunc f)
set the body of the function to be f
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:68
Registry for global function.
Definition: registry.h:100
std::string name_
name of the function
Definition: registry.h:313
friend struct Manager
Definition: registry.h:320
static Registry & Register(const std::string &name, bool override=false)
Register a function with given name.
Registry & set_body_method(R(T::*f)(Args...))
set the body of the function to be the passed method pointer. Note that this will ignore default arg ...
Definition: registry.h:164
Type-erased function used across TVM API.