43 #ifndef TVM_RUNTIME_REGISTRY_H_
44 #define TVM_RUNTIME_REGISTRY_H_
49 #include <type_traits>
112 template <
typename TCallable,
113 typename =
typename std::enable_if_t<
115 !std::is_base_of<PackedFunc, TCallable>::value>>
142 template <
typename FLambda>
144 using FType =
typename detail::function_signature<FLambda>::FType;
168 template <
typename T,
typename R,
typename... Args>
170 using R_ =
typename std::remove_reference<R>::type;
171 auto fwrap = [f](T target, Args... params) -> R_ {
173 return (target.*f)(params...);
199 template <
typename T,
typename R,
typename... Args>
201 auto fwrap = [f](
const T target, Args... params) -> R {
203 return (target.*f)(params...);
239 template <
typename TObjectRef,
typename TNode,
typename R,
typename... Args,
240 typename =
typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
242 auto fwrap = [f](TObjectRef ref, Args... params) {
243 TNode* target = ref.operator->();
245 return (target->*f)(params...);
281 template <
typename TObjectRef,
typename TNode,
typename R,
typename... Args,
282 typename =
typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
284 auto fwrap = [f](TObjectRef ref, Args... params) {
285 const TNode* target = ref.operator->();
287 return (target->*f)(params...);
329 #define TVM_FUNC_REG_VAR_DEF static TVM_ATTRIBUTE_UNUSED ::tvm::runtime::Registry& __mk_##TVM
339 #define TVM_REGISTER_GLOBAL(OpName) \
340 TVM_STR_CONCAT(TVM_FUNC_REG_VAR_DEF, __COUNTER__) = ::tvm::runtime::Registry::Register(OpName)
342 #define TVM_STRINGIZE_DETAIL(x) #x
343 #define TVM_STRINGIZE(x) TVM_STRINGIZE_DETAIL(x)
344 #define TVM_DESCRIBE(...) describe(__VA_ARGS__ "\n\nFrom:" __FILE__ ":" TVM_STRINGIZE(__LINE__))
348 #define TVM_ADD_FILELINE "\n\nDefined in " __FILE__ ":L" TVM_STRINGIZE(__LINE__)
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:138
Registry for global function.
Definition: registry.h:101
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:283
friend struct Manager
Definition: registry.h:326
static bool Remove(const String &name)
Erase global function from registry, if exist.
Registry & set_body(TCallable f)
set the body of the function to be f
Definition: registry.h:116
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:143
static std::vector< String > ListNames()
Get the names of currently registered global function.
static Registry & Register(const String &name, bool override=false)
Register a function with given name.
PackedFunc func_
internal packed function
Definition: registry.h:325
String name_
name of the function
Definition: registry.h:319
static const PackedFunc * Get(const 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:200
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:169
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:241
Registry & set_body(PackedFunc f)
set the body of the function to be f
Reference to string objects.
Definition: string.h:98
Arguments into TVM functions.
Definition: packed_func.h:391
Return Value container, Unlike TVMArgValue, which only holds reference and do not delete the underlyi...
Definition: packed_func.h:799
Please refer to TypedPackedFunc<R(Args..)>.
Definition: packed_func.h:60
void EnvCheckSignals()
Check if signals have been sent to the process and if so invoke the registered signal handler in the ...
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Type-erased function used across TVM API.
Runtime String container types.