24#ifndef TVM_TIRX_FUNCTION_H_
25#define TVM_TIRX_FUNCTION_H_
27#include <tvm/ffi/container/map.h>
28#include <tvm/ffi/extra/structural_equal.h>
29#include <tvm/ffi/extra/structural_hash.h>
62 namespace refl = tvm::ffi::reflection;
63 refl::ObjectDef<FunctionObj>()
67 refl::TypeAttrDef<FunctionObj>()
73 ffi::TypedFunction<
bool(AnyView, AnyView,
bool, AnyView)>
equal)
const {
82 int64_t
SHash(int64_t init_hash, ffi::TypedFunction<int64_t(AnyView, int64_t,
bool)> hash)
const {
83 int64_t hash_value = init_hash;
84 hash_value = hash(
params, hash_value,
true);
85 hash_value = hash(
attrs, hash_value,
false);
86 hash_value = hash(
ret_type, hash_value,
false);
87 hash_value = hash(
body, hash_value,
false);
201 "tirx.kernel_launch_params"};
208inline constexpr ffi::reflection::AttrKey<bool>
kNoAlias{
"tirx.noalias"};
218inline constexpr ffi::reflection::AttrKey<bool>
kIsEntryFunc{
"tirx.is_entry_func"};
225inline constexpr ffi::reflection::AttrKey<bool>
kIsGlobalFunc{
"tirx.is_global_func"};
232inline constexpr ffi::reflection::AttrKey<bool>
kIsHostFunc{
"tirx.is_host_func"};
#define TVM_TIRX_DLL
Definition base.h:55
Device-independent tensor allocation, copies, views and serialization.
TIRx tensor expressions and construction helpers.
TIRx statements and shared statement entry header.
Base node of all functions.
Definition function.h:94
DictAttrs attrs
Additional attributes storing the meta-data.
Definition function.h:97
Managed reference to BaseFuncObj.
Definition function.h:202
Managed reference to DictAttrsObj.
Definition attrs.h:108
Managed reference to FuncTypeObj.
Definition type.h:553
Non-nullable source-location metadata.
Definition location.h:91
Sequence statement.
Definition stmt.h:91
Managed reference to TypeObj.
Definition type.h:75
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
Primitive functions that contains TIR statements.
Definition function.h:50
bool SEqual(const FunctionObj *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition function.h:72
int64_t SHash(int64_t init_hash, ffi::TypedFunction< int64_t(AnyView, int64_t, bool)> hash) const
Definition function.h:82
ffi::Array< tvm::Var > params
Function parameters.
Definition function.h:53
TVM_TIRX_DLL FuncType func_type_annotation() const
Return the derived function annotation of this function.
SeqStmt body
The body of the function, empty for a marked declaration.
Definition function.h:57
FunctionObj(ffi::UnsafeInit tag)
Definition function.h:59
Type ret_type
The return type of the function.
Definition function.h:55
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Function", FunctionObj, BaseFuncObj)
static void RegisterReflection()
Definition function.h:61
Managed reference to FunctionObj.
Definition function.h:107
Function(ffi::ObjectPtr< FunctionObj > node)
Definition function.h:126
TVM_DEFINE_OBJECT_REF_COW_METHOD(FunctionObj)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Function, BaseFunc, FunctionObj)
TVM_TIRX_DLL Function(ffi::Array< tvm::Var > params, SeqStmt body, Type ret_type=VoidType(), DictAttrs attrs=DictAttrs(), Location loc=UnknownLoc())
Constructor.
Copy-on-write helper macro for IR ffi::ObjectRef types.
constexpr ffi::reflection::AttrKey< ffi::Array< ffi::String > > kKernelLaunchParams
Ordered launch-parameter tags for a device kernel.
Definition function.h:200
constexpr ffi::reflection::AttrKey< bool > kNoAlias
Whether to set noalias rule on the function arguments.
Definition function.h:208
constexpr ffi::reflection::AttrKey< bool > kIsGlobalFunc
Mark the function as the global function called from the host.
Definition function.h:225
constexpr ffi::reflection::AttrKey< bool > kIsHostFunc
Mark the function as run on the host, mutually exclusive with kTarget.
Definition function.h:232
constexpr ffi::reflection::AttrKey< bool > kPersistentKernel
Mark the kernel as persistent.
Definition function.h:237
constexpr ffi::reflection::AttrKey< bool > kIsEntryFunc
Mark the function as the entry function of the final generated runtime module.
Definition function.h:218
TVM_TIRX_DLL Function RenewDef(Function func)
Renew variable definitions and remap their uses in a function.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41
Type VoidType()
Definition type.h:514
TVM_TIRX_DLL PrimExpr equal(PrimExpr a, PrimExpr b, Location loc=UnknownLoc())
equal