24 #ifndef TVM_IR_FUNCTION_H_
25 #define TVM_IR_FUNCTION_H_
27 #include <tvm/ffi/container/array.h>
28 #include <tvm/ffi/container/map.h>
29 #include <tvm/ffi/string.h>
34 #include <type_traits>
163 template <
typename TObjectRef>
164 Optional<TObjectRef>
GetAttr(
const std::string& attr_key,
165 Optional<TObjectRef> default_value = std::nullopt)
const {
169 template <
typename TObjectRef>
170 Optional<TObjectRef>
GetAttr(
const std::string& attr_key, TObjectRef default_value)
const {
171 return GetAttr<TObjectRef>(attr_key, Optional<TObjectRef>(default_value));
Helpers for attribute objects.
Base node of all functions.
Definition: function.h:139
static constexpr const uint32_t _type_child_slots
Definition: function.h:226
bool HasNonzeroAttr(const std::string &attr_key) const
Check whether the function has an non-zero integer attr.
Definition: function.h:193
LinkageType GetLinkageType() const
Get the type of the linkage.
Definition: function.h:213
Optional< TObjectRef > GetAttr(const std::string &attr_key, TObjectRef default_value) const
Definition: function.h:170
DictAttrs attrs
Additional attributes storing the meta-data.
Definition: function.h:142
static void RegisterReflection()
Definition: function.h:220
Optional< TObjectRef > GetAttr(const std::string &attr_key, Optional< TObjectRef > default_value=std::nullopt) const
Get a function attribute.
Definition: function.h:164
TVM_DECLARE_BASE_OBJECT_INFO(BaseFuncNode, RelaxExprNode)
static constexpr const char * _type_key
Definition: function.h:225
Managed reference to BaseFuncNode.
Definition: function.h:234
TVM_DEFINE_OBJECT_REF_METHODS(BaseFunc, RelaxExpr, BaseFuncNode)
Managed reference to DictAttrsNode.
Definition: attrs.h:166
bool HasNonzeroAttr(const std::string &attr_key) const
Check whether the function has an non-zero integer attr.
Definition: attrs.h:233
Optional< TObjectRef > GetAttr(const std::string &attr_key, Optional< TObjectRef > default_value=Optional< TObjectRef >(std::nullopt)) const
Get a function attribute.
Definition: attrs.h:197
Base node of all non-primitive expressions.
Definition: expr.h:422
Managed reference to RelaxExprNode.
Definition: expr.h:446
constexpr const char * kCallingConv
Indicates the special calling convention.
Definition: function.h:96
constexpr const char * kTarget
Compilation target of the function.
Definition: function.h:105
constexpr const char * kGlobalSymbol
Global linker symbol of the function in generated code.
Definition: function.h:126
Definition: repr_printer.h:91
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
CallingConv
Possible Calling conventions.
Definition: function.h:44
@ kDefault
Default calling convention.
@ kCPackedFunc
ffi::Function that exposes a Cffi::Function signature.
@ kDeviceKernelLaunch
Device kernel launch.
LinkageType
Supported linkage types.
Definition: function.h:71
@ kExternal
External linkage.
@ kInternal
Internal linkage.