19 #ifndef TVM_RELAX_EXPR_H_
20 #define TVM_RELAX_EXPR_H_
22 #include <tvm/ffi/container/array.h>
23 #include <tvm/ffi/container/map.h>
24 #include <tvm/ffi/reflection/registry.h>
61 refl::AttachFieldFlag::SEqHashIgnore());
68 class Id :
public ObjectRef {
74 TVM_DLL
explicit Id(ffi::String name_hint);
119 refl::AttachFieldFlag::SEqHashIgnore());
167 refl::ObjectDef<CallNode>()
187 ffi::Array<StructInfo> sinfo_args = ffi::Array<StructInfo>(),
Span span =
Span());
199 Call call, ffi::Optional<Expr> opt_op = ffi::Optional<Expr>(),
200 ffi::Optional<ffi::Array<Expr>> opt_args = ffi::Optional<ffi::Array<Expr>>(),
201 ffi::Optional<Attrs> opt_attrs = ffi::Optional<Attrs>(),
202 ffi::Optional<ffi::Array<StructInfo>> opt_sinfo_args = ffi::Optional<ffi::Array<StructInfo>>(),
203 ffi::Optional<Span> opt_span = ffi::Optional<Span>());
241 template <
typename RelaxExpr,
typename = std::enable_if_t<std::is_base_of_v<Expr, RelaxExpr>>>
242 TVM_DLL
explicit Tuple(tvm::ffi::Array<RelaxExpr> fields,
Span span =
Span())
255 ffi::Optional<ffi::Array<Expr>> opt_fields = ffi::Optional<ffi::Array<Expr>>(),
256 ffi::Optional<Span> opt_span = ffi::Optional<Span>());
268 refl::ObjectDef<TupleGetItemNode>()
269 .def_ro(
"tuple_value", &TupleGetItemNode::tuple)
270 .def_ro(
"index", &TupleGetItemNode::index);
295 ffi::Optional<Expr> opt_tuple = ffi::Optional<Expr>(),
296 ffi::Optional<Integer> opt_index = ffi::Optional<Integer>(),
297 ffi::Optional<Span> opt_span = ffi::Optional<Span>());
305 static constexpr
const uint32_t _type_child_slots = 7;
327 refl::ObjectDef<ShapeExprNode>().def_ro(
"values", &ShapeExprNode::values);
347 const ffi::String&
name_hint()
const {
return vid->name_hint; }
351 refl::ObjectDef<VarNode>().def_ro(
"vid", &VarNode::vid);
353 refl::TypeAttrDef<VarNode>()
354 .def(
"__s_equal__", &VarNode::SEqual)
355 .def(
"__s_hash__", &VarNode::SHash);
359 ffi::TypedFunction<
bool(AnyView, AnyView,
bool, AnyView)>
equal)
const {
360 return equal(vid, other->
vid,
false,
"vid") &&
365 ffi::TypedFunction<uint64_t(AnyView, uint64_t,
bool)> hash)
const {
366 uint64_t hash_value = init_hash;
367 hash_value = hash(vid, hash_value,
false);
368 hash_value = hash(struct_info_, hash_value,
false);
372 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
373 static constexpr
const uint32_t _type_child_slots = 1;
379 TVM_DLL
explicit Var(ffi::String name_hint, ffi::Optional<StructInfo> struct_info_annotation,
381 :
Var(
Id(name_hint), struct_info_annotation, span) {}
383 TVM_DLL
explicit Var(
Id vid, ffi::Optional<StructInfo> struct_info_annotation,
397 refl::ObjectDef<DataflowVarNode>();
400 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
407 ffi::Optional<StructInfo> struct_info_annotation,
Span span =
Span())
408 :
DataflowVar(
Id(name_hint), struct_info_annotation, span) {}
410 TVM_DLL
explicit DataflowVar(
Id vid, ffi::Optional<StructInfo> struct_info_annotation,
435 refl::ObjectDef<ConstantNode>().def_ro(
"data", &ConstantNode::data);
450 ffi::Optional<StructInfo> struct_info_annotation = std::nullopt,
469 refl::ObjectDef<PrimValueNode>().def_ro(
"value", &PrimValueNode::value);
509 refl::ObjectDef<StringImmNode>().def_ro(
"value", &StringImmNode::value);
541 refl::ObjectDef<DataTypeImmNode>().def_ro(
"value", &DataTypeImmNode::value);
572 refl::ObjectDef<BindingNode>()
573 .def_ro(
"span", &BindingNode::span, refl::AttachFieldFlag::SEqHashIgnore())
577 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
587 explicit Binding(ObjectPtr<BindingNode> n) : ObjectRef(n) {}
588 explicit Binding(ffi::UnsafeInit tag) : ObjectRef(tag) {}
611 refl::ObjectDef<MatchCastNode>()
612 .def_ro(
"value", &MatchCastNode::value)
613 .def_ro(
"struct_info", &MatchCastNode::struct_info, refl::AttachFieldFlag::SEqHashDef());
637 refl::ObjectDef<VarBindingNode>().def_ro(
"value", &VarBindingNode::value);
639 refl::TypeAttrDef<VarBindingNode>()
640 .def(
"__s_equal__", &VarBindingNode::SEqual)
641 .def(
"__s_hash__", &VarBindingNode::SHash);
645 ffi::TypedFunction<
bool(AnyView, AnyView,
bool, AnyView)>
equal)
const;
647 ffi::TypedFunction<uint64_t(AnyView, uint64_t,
bool)> hash)
const;
665 refl::ObjectDef<BindingBlockNode>()
666 .def_ro(
"bindings", &BindingBlockNode::bindings)
667 .def_ro(
"span", &BindingBlockNode::span, refl::AttachFieldFlag::SEqHashIgnore(),
668 refl::DefaultValue(
Span()));
671 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
687 refl::ObjectDef<DataflowBlockNode>();
711 refl::ObjectDef<SeqExprNode>()
712 .def_ro(
"blocks", &SeqExprNode::blocks)
713 .def_ro(
"body", &SeqExprNode::body);
760 refl::ObjectDef<IfNode>()
761 .def_ro(
"cond", &IfNode::cond)
762 .def_ro(
"true_branch", &IfNode::true_branch)
763 .def_ro(
"false_branch", &IfNode::false_branch);
766 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
801 ffi::Optional<Expr> opt_true_branch = ffi::Optional<Expr>(),
802 ffi::Optional<Expr> opt_false_branch = ffi::Optional<Expr>(),
803 ffi::Optional<Span> opt_span = ffi::Optional<Span>());
819 refl::ObjectDef<FunctionNode>()
820 .def_ro(
"params", &FunctionNode::params, refl::AttachFieldFlag::SEqHashDef())
821 .def_ro(
"body", &FunctionNode::body)
822 .def_ro(
"ret_struct_info", &FunctionNode::ret_struct_info)
823 .def_ro(
"is_pure", &FunctionNode::is_pure);
826 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
854 ffi::Optional<StructInfo> ret_struct_info,
bool is_pure =
true,
908 refl::ObjectDef<ExternFuncNode>().def_ro(
"global_symbol", &ExternFuncNode::global_symbol);
953 struct std::hash<
tvm::relax::Var> {
955 return tvm::runtime::ObjectPtrHash()(
var);
960 struct std::equal_to<
tvm::relax::Var> {
962 return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
Managed reference to BaseAttrsNode.
Definition: attrs.h:131
Base node of all functions.
Definition: function.h:139
Managed reference to BaseFuncNode.
Definition: function.h:233
Managed reference to DictAttrsNode.
Definition: attrs.h:162
Reference to PrimExprNode.
Definition: expr.h:124
Base node of all non-primitive expressions.
Definition: expr.h:416
ffi::Optional< ObjectRef > struct_info_
Stores the result of structure information of the expression that encapsulate both static shape and r...
Definition: expr.h:423
Managed reference to RelaxExprNode.
Definition: expr.h:439
Definition: source_map.h:111
ffi::Array< Binding > bindings
Definition: expr.h:660
Span span
Definition: expr.h:661
static void RegisterReflection()
Definition: expr.h:663
TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.BindingBlock", BindingBlockNode, Object)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(BindingBlock, ObjectRef, BindingBlockNode)
BindingBlockNode * CopyOnWrite()
BindingBlock(ffi::Array< Binding > bindings, Span span=Span())
The base class of a variable binding in Relax.
Definition: expr.h:564
Var var
The return variable to bound to.
Definition: expr.h:568
static void RegisterReflection()
Definition: expr.h:570
TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.Binding", BindingNode, Object)
Span span
Definition: expr.h:566
const BindingNode * operator->() const
Definition: expr.h:590
Binding(ObjectPtr< BindingNode > n)
Definition: expr.h:587
TVM_DEFINE_DEFAULT_COPY_MOVE_AND_ASSIGN(Binding)
const BindingNode * get() const
Definition: expr.h:591
Binding(ffi::UnsafeInit tag)
Definition: expr.h:588
Call corresponds to callable invocation. Corresponds to operation in computational graph terminology.
Definition: expr.h:141
ffi::Array< StructInfo > sinfo_args
The structure info arguments of a CallNode. sinfo_args is designed to be non-empty only for intrinsic...
Definition: expr.h:163
static void RegisterReflection()
Definition: expr.h:165
tvm::ffi::Array< Expr > args
The arguments(inputs) of the call.
Definition: expr.h:152
Expr op
The operator(function) being invoked.
Definition: expr.h:149
Attrs attrs
The additional attributes.
Definition: expr.h:155
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Call", CallNode, ExprNode)
Call(Expr op, ffi::Array< Expr > args, Attrs attrs=Attrs(), ffi::Array< StructInfo > sinfo_args=ffi::Array< StructInfo >(), Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_COW_METHOD(CallNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Call, Expr, CallNode)
Constant tensor.
Definition: expr.h:422
static void RegisterReflection()
Definition: expr.h:433
bool is_scalar() const
Definition: expr.h:431
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Constant", ConstantNode, LeafExprNode)
runtime::Tensor data
The data of the tensor.
Definition: expr.h:425
TensorType tensor_type() const
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Constant, LeafExpr, ConstantNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(ConstantNode)
Constant(runtime::Tensor data, ffi::Optional< StructInfo > struct_info_annotation=std::nullopt, Span span=Span())
The constructor.
Represent a data type constant.
Definition: expr.h:534
DataType value
The data value.
Definition: expr.h:537
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.DataTypeImm", DataTypeImmNode, LeafExprNode)
static void RegisterReflection()
Definition: expr.h:539
Managed reference to DataTypeImm.
Definition: expr.h:550
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataTypeImmNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(DataTypeImm, LeafExpr, DataTypeImmNode)
DataTypeImm(DataType value, Span span=Span())
The constructor.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.DataflowBlock", DataflowBlockNode, BindingBlockNode)
static void RegisterReflection()
Definition: expr.h:685
DataflowBlock(ffi::Array< Binding > bindings, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataflowBlockNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(DataflowBlock, BindingBlock, DataflowBlockNode)
A sub-type of the variable node used to mark dataflow variables from normal visible "function local" ...
Definition: expr.h:393
static void RegisterReflection()
Definition: expr.h:395
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.DataflowVar", DataflowVarNode, VarNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataflowVarNode)
DataflowVar(Id vid, ffi::Optional< StructInfo > struct_info_annotation, Span span=Span())
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(DataflowVar, Var, DataflowVarNode)
DataflowVar(ffi::String name_hint, ffi::Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:406
The extern function, which can represent packed function.
Definition: expr.h:901
static void RegisterReflection()
Definition: expr.h:906
ffi::String global_symbol
The name of global symbol.
Definition: expr.h:904
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.ExternFunc", ExternFuncNode, BaseFuncNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(ExternFunc, BaseFunc, ExternFuncNode)
ExternFunc(ffi::String global_symbol, StructInfo struct_info, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ExternFuncNode)
ExternFunc(ffi::String global_symbol, Span span=Span())
A Relax function.
Definition: expr.h:806
static void RegisterReflection()
Definition: expr.h:817
SeqExpr body
The body of the function.
Definition: expr.h:811
ffi::Array< Var > params
The parameters to the function.
Definition: expr.h:809
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Function", FunctionNode, BaseFuncNode)
StructInfo ret_struct_info
The return type of the function.
Definition: expr.h:813
bool is_pure
Whether the function is annotated as pure or not.
Definition: expr.h:815
static Function CreateEmpty(ffi::Array< Var > params, StructInfo ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span())
Mimics the constructor but without body Expr.
Function(ffi::Array< Var > params, Expr body, ffi::Optional< StructInfo > ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span())
Construct a Relax Function.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Function, BaseFunc, FunctionNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(FunctionNode)
The unique identifier of variables.
Definition: expr.h:49
ffi::String name_hint
The name of the variable, this only acts as a hint to the user, and is not used for equality.
Definition: expr.h:56
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:64
static void RegisterReflection()
Definition: expr.h:58
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.Id", IdNode, Object)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Id, ObjectRef, IdNode)
Id(ffi::String name_hint)
The constructor.
Condition expression.
Definition: expr.h:749
static void RegisterReflection()
Definition: expr.h:758
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.If", IfNode, ExprNode)
SeqExpr true_branch
The expression evaluated when condition is true.
Definition: expr.h:754
Expr cond
The condition.
Definition: expr.h:752
SeqExpr false_branch
The expression evaluated when condition is false.
Definition: expr.h:756
TVM_DEFINE_OBJECT_REF_COW_METHOD(IfNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(If, Expr, IfNode)
If(Expr cond, Expr true_branch, Expr false_branch, Span span=Span())
The constructor.
Base type of all (non-function) leaf Exprs.
Definition: expr.h:303
TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.LeafExpr", LeafExprNode, ExprNode)
Managed reference to BaseExprNode.
Definition: expr.h:313
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(LeafExpr, Expr, LeafExprNode)
Runtime-match the value to the struct info.
Definition: expr.h:602
Expr value
The input value to match cast.
Definition: expr.h:605
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.MatchCast", MatchCastNode, BindingNode)
StructInfo struct_info
The struct info pattern to match to.
Definition: expr.h:607
static void RegisterReflection()
Definition: expr.h:609
Managed reference to MatchCastNode.
Definition: expr.h:622
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(MatchCast, Binding, MatchCastNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(MatchCastNode)
MatchCast(Var var, Expr value, StructInfo struct_info, Span span=Span())
PrimValue.
Definition: expr.h:462
static void RegisterReflection()
Definition: expr.h:467
PrimExpr value
The prim expr representing the value.
Definition: expr.h:465
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.PrimValue", PrimValueNode, LeafExprNode)
Managed reference to PrimValueNode.
Definition: expr.h:478
TVM_DEFINE_OBJECT_REF_COW_METHOD(PrimValueNode)
static PrimValue Int64(int64_t value, Span span=Span())
Create a int64 prim value.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(PrimValue, LeafExpr, PrimValueNode)
PrimValue(PrimExpr value, Span span=Span())
The constructor.
A sequence of blocks followed by an expression.
Definition: expr.h:704
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.SeqExpr", SeqExprNode, ExprNode)
Expr body
Definition: expr.h:707
static void RegisterReflection()
Definition: expr.h:709
ffi::Array< BindingBlock > blocks
Definition: expr.h:706
SeqExpr(ffi::Array< BindingBlock > blocks, Expr body, Span span=Span())
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(SeqExpr, Expr, SeqExprNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(SeqExprNode)
A shape expression which allows users to construct a shape containing PrimExpr.
Definition: expr.h:320
ffi::Array< PrimExpr > values
Definition: expr.h:323
static void RegisterReflection()
Definition: expr.h:325
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.ShapeExpr", ShapeExprNode, LeafExprNode)
ShapeExpr(ffi::Array< PrimExpr > values, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ShapeExprNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(ShapeExpr, LeafExpr, ShapeExprNode)
Represent a string literal constant.
Definition: expr.h:502
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.StringImm", StringImmNode, LeafExprNode)
ffi::String value
The data value.
Definition: expr.h:505
static void RegisterReflection()
Definition: expr.h:507
Managed reference to StringImm.
Definition: expr.h:518
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(StringImm, LeafExpr, StringImmNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(StringImmNode)
StringImm(ffi::String value, Span span=Span())
The constructor.
Base type of all structure information.
Definition: expr.h:108
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:114
static constexpr const uint32_t _type_child_slots
Definition: expr.h:124
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:122
static void RegisterReflection()
Definition: expr.h:116
TVM_FFI_DECLARE_OBJECT_INFO("ir.StructInfo", StructInfoNode, Object)
Managed reference to StructInfoNode.
Definition: expr.h:132
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(StructInfo, ObjectRef, StructInfoNode)
Managed reference to TensorTypeNode.
Definition: type.h:94
Get index-th field out of a tuple.
Definition: expr.h:259
static void RegisterReflection()
Definition: expr.h:266
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.TupleGetItem", TupleGetItemNode, ExprNode)
int index
which value to get
Definition: expr.h:264
Expr tuple
The tuple Expression.
Definition: expr.h:262
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleGetItemNode)
TupleGetItem(Expr tuple, int index, Span span=Span())
The constructor.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(TupleGetItem, Expr, TupleGetItemNode)
Tuple container.
Definition: expr.h:206
static void RegisterReflection()
Definition: expr.h:211
tvm::ffi::Array< Expr > fields
the fields of the tuple
Definition: expr.h:209
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.Tuple", TupleNode, ExprNode)
Tuple(tvm::ffi::Array< Expr > fields, Span span=Span())
The constructor.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Tuple, Expr, TupleNode)
Tuple(tvm::ffi::Array< RelaxExpr > fields, Span span=Span())
Utility constructor to handle conversion to relax::Expr.
Definition: expr.h:242
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleNode)
static void RegisterReflection()
Definition: expr.h:635
Expr value
The binding value.
Definition: expr.h:633
bool SEqual(const VarBindingNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.expr.VarBinding", VarBindingNode, BindingNode)
uint64_t SHash(uint64_t init_hash, ffi::TypedFunction< uint64_t(AnyView, uint64_t, bool)> hash) const
TVM_DEFINE_OBJECT_REF_COW_METHOD(VarBindingNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(VarBinding, Binding, VarBindingNode)
VarBinding(Var var, Expr value, Span span=Span())
The variable class for all Relax bindings.
Definition: expr.h:340
uint64_t SHash(uint64_t init_hash, ffi::TypedFunction< uint64_t(AnyView, uint64_t, bool)> hash) const
Definition: expr.h:364
const ffi::String & name_hint() const
Definition: expr.h:347
Id vid
The identifier of the variable, which is used for comparing stable equality across transformations.
Definition: expr.h:344
TVM_FFI_DECLARE_OBJECT_INFO("relax.expr.Var", VarNode, LeafExprNode)
static void RegisterReflection()
Definition: expr.h:349
bool SEqual(const VarNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition: expr.h:358
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Var, LeafExpr, VarNode)
Var(Id vid, ffi::Optional< StructInfo > struct_info_annotation, Span span=Span())
Var(ffi::String name_hint, ffi::Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:379
Runtime primitive data type.
Definition: data_type.h:47
Managed Tensor. The array is backed by reference counted blocks.
Definition: tensor.h:53
Definition: repr_printer.h:91
constexpr const char * kForcePure
Override checking purity for this function and treat as pure (is_pure must be set to true)
Definition: expr.h:890
constexpr const char * kWorkspaceSize
The required workspace for an external function.
Definition: expr.h:884
constexpr const char * kNumInput
The number of inputs of a function. If a function has the num_input attribute, the last func->params....
Definition: expr.h:897
constexpr const char * kComposite
Treat the function as a composite operator.
Definition: expr.h:880
constexpr const char * kCodegen
Indicate the codegen that should be used for building this function. When this is unset or set to "de...
Definition: expr.h:878
constexpr const char * kPrimitive
Mark the function as a primitive function.
Definition: expr.h:873
constexpr const char * kPartitionedFromPattern
Indicate the function was created by the Pattern Partitioning Pass.
Definition: expr.h:882
Call WithFields(Call call, ffi::Optional< Expr > opt_op=ffi::Optional< Expr >(), ffi::Optional< ffi::Array< Expr >> opt_args=ffi::Optional< ffi::Array< Expr >>(), ffi::Optional< Attrs > opt_attrs=ffi::Optional< Attrs >(), ffi::Optional< ffi::Array< StructInfo >> opt_sinfo_args=ffi::Optional< ffi::Array< StructInfo >>(), ffi::Optional< Span > opt_span=ffi::Optional< Span >())
Returns call with the given properties. A null property denotes 'no change'. Returns call if all prop...
If WithFields(If if_expr, ffi::Optional< Expr > opt_cond=ffi::Optional< Expr >(), ffi::Optional< Expr > opt_true_branch=ffi::Optional< Expr >(), ffi::Optional< Expr > opt_false_branch=ffi::Optional< Expr >(), ffi::Optional< Span > opt_span=ffi::Optional< Span >())
Returns if_expr with the given properties. A null property denotes 'no change'. Returns if_expr if al...
Expr GetShapeOf(const Expr &expr)
Get the shape of Expr.
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
Definitions and helper macros for IR/AST nodes.
A managed object in the TVM runtime.
A map from source names to source code.
Common operators defined for Expr.