24#ifndef TVM_TIR_FUNCTION_H_
25#define TVM_TIR_FUNCTION_H_
27#include <tvm/ffi/container/map.h>
28#include <tvm/ffi/container/variant.h>
56 ffi::Optional<SeqStmt>
body;
59 namespace refl = tvm::ffi::reflection;
60 refl::ObjectDef<FunctionNode>()
64 refl::TypeAttrDef<FunctionNode>()
Base node of all functions.
Definition function.h:92
DictAttrs attrs
Additional attributes storing the meta-data.
Definition function.h:95
ffi::Optional< TObjectRef > GetAttr(const std::string &attr_key, ffi::Optional< TObjectRef > default_value=std::nullopt) const
Get a function attribute.
Definition function.h:117
Managed reference to BaseFuncNode.
Definition function.h:181
Managed reference to DictAttrsNode.
Definition attrs.h:108
Managed reference to FuncTypeNode.
Definition type.h:224
Non-nullable source-location metadata.
Definition location.h:91
Managed reference to TypeNode.
Definition base_expr.h:80
static TVM_TIRX_DLL Type Missing()
Construct a MissingType for type information not yet populated.
Reference to the shared immutable unknown location.
Definition location.h:105
Managed reference to VarNode.
Definition expr.h:714
Primitive functions that contains TIR statements.
Definition function.h:49
bool SEqual(const FunctionNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition function.h:69
TVM_TIRX_DLL FuncType func_type_annotation() const
Return the derived function annotation of this function.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Function", FunctionNode, BaseFuncNode)
int64_t SHash(int64_t init_hash, ffi::TypedFunction< int64_t(AnyView, int64_t, bool)> hash) const
Definition function.h:80
Type ret_type
The return type of the function.
Definition function.h:54
static void RegisterReflection()
Definition function.h:58
ffi::Array< tvm::Var > params
Function parameters.
Definition function.h:52
ffi::Optional< SeqStmt > body
The body of the function, absent for a declaration.
Definition function.h:56
Managed reference to FunctionNode.
Definition function.h:105
TVM_TIRX_DLL Function(ffi::Array< tvm::Var > params, ffi::Optional< SeqStmt > body, Type ret_type=VoidType(), DictAttrs attrs=DictAttrs(), Location loc=UnknownLoc())
Constructor.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Function, BaseFunc, FunctionNode)
Function(ffi::ObjectPtr< FunctionNode > node)
Definition function.h:124
TVM_DEFINE_OBJECT_REF_COW_METHOD(FunctionNode)
Copy-on-write helper macro for IR ffi::ObjectRef types.
constexpr const char * kIsHostFunc
Mark the function as run on the host, mutually exclusive with kTarget.
Definition function.h:269
constexpr const char * kIsEntryFunc
Mark the function as the entry function of the final generated runtime module.
Definition function.h:255
constexpr const char * kPersistentKernel
Mark the kernel as persistent.
Definition function.h:274
constexpr const char * kIsGlobalFunc
Mark the function as the global function called from the host.
Definition function.h:262
constexpr const char * kNoAlias
Whether to set noalias rule on the function arguments.
Definition function.h:245
constexpr const char * kKernelLaunchParams
Ordered launch-parameter tags for a device kernel.
Definition function.h:238
TVM_TIRX_DLL Function RenewDef(Function func)
Renew variable definitions and remap their uses in a function.
Function Specialize(Function func, const ffi::Map< Var, ffi::Variant< TensorVar, Expr > > ¶m_map)
Specialize parameters of Function.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
Type VoidType()
Definition type.h:185
TVM_TIRX_DLL PrimExpr equal(PrimExpr a, PrimExpr b, Location loc=UnknownLoc())
equal
#define TVM_TIRX_DLL
Definition base.h:83
Device-independent tensor allocation, copies, views and serialization.
TIRx tensor expressions and construction helpers.
TIRx statements and shared statement entry header.