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());
65 static constexpr
const char*
_type_key =
"relax.Id";
70 class Id :
public ObjectRef {
76 TVM_DLL
explicit Id(String name_hint);
121 refl::AttachFieldFlag::SEqHashIgnore());
125 static constexpr
const char*
_type_key =
"ir.StructInfo";
170 refl::ObjectDef<CallNode>()
177 static constexpr
const char*
_type_key =
"relax.expr.Call";
192 Array<StructInfo> sinfo_args = Array<StructInfo>(),
Span span =
Span());
204 Optional<Array<Expr>> opt_args = Optional<Array<Expr>>(),
205 Optional<Attrs> opt_attrs = Optional<Attrs>(),
206 Optional<Array<StructInfo>> opt_sinfo_args = Optional<Array<StructInfo>>(),
207 Optional<Span> opt_span = Optional<Span>());
220 static constexpr
const char*
_type_key =
"relax.expr.Tuple";
247 template <
typename RelaxExpr,
typename = std::enable_if_t<std::is_base_of_v<Expr, RelaxExpr>>>
261 Optional<Span> opt_span = Optional<Span>());
273 refl::ObjectDef<TupleGetItemNode>()
274 .def_ro(
"tuple_value", &TupleGetItemNode::tuple)
275 .def_ro(
"index", &TupleGetItemNode::index);
278 static constexpr
const char* _type_key =
"relax.expr.TupleGetItem";
302 Optional<Integer> opt_index = Optional<Integer>(),
303 Optional<Span> opt_span = Optional<Span>());
311 static constexpr
const char* _type_key =
"relax.expr.LeafExpr";
312 static constexpr
const uint32_t _type_child_slots = 7;
334 refl::ObjectDef<ShapeExprNode>().def_ro(
"values", &ShapeExprNode::values);
337 static constexpr
const char* _type_key =
"relax.expr.ShapeExpr";
356 const String&
name_hint()
const {
return vid->name_hint; }
360 refl::ObjectDef<VarNode>().def_ro(
"vid", &VarNode::vid);
362 refl::TypeAttrDef<VarNode>()
363 .def(
"__s_equal__", &VarNode::SEqual)
364 .def(
"__s_hash__", &VarNode::SHash);
368 ffi::TypedFunction<
bool(AnyView, AnyView,
bool, AnyView)>
equal)
const {
369 return equal(vid, other->
vid,
false,
"vid") &&
374 ffi::TypedFunction<uint64_t(AnyView, uint64_t,
bool)> hash)
const {
375 uint64_t hash_value = init_hash;
376 hash_value = hash(vid, hash_value,
false);
377 hash_value = hash(struct_info_, hash_value,
false);
381 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
382 static constexpr
const char* _type_key =
"relax.expr.Var";
383 static constexpr
const uint32_t _type_child_slots = 1;
389 TVM_DLL
explicit Var(String name_hint, Optional<StructInfo> struct_info_annotation,
391 :
Var(
Id(name_hint), struct_info_annotation, span) {}
393 TVM_DLL
explicit Var(
Id vid, Optional<StructInfo> struct_info_annotation,
Span span =
Span());
406 refl::ObjectDef<DataflowVarNode>();
409 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
410 static constexpr
const char* _type_key =
"relax.expr.DataflowVar";
416 TVM_DLL
explicit DataflowVar(String name_hint, Optional<StructInfo> struct_info_annotation,
418 :
DataflowVar(
Id(name_hint), struct_info_annotation, span) {}
420 TVM_DLL
explicit DataflowVar(
Id vid, Optional<StructInfo> struct_info_annotation,
445 refl::ObjectDef<ConstantNode>().def_ro(
"data", &ConstantNode::data);
448 static constexpr
const char* _type_key =
"relax.expr.Constant";
462 Optional<StructInfo> struct_info_annotation = std::nullopt,
481 refl::ObjectDef<PrimValueNode>().def_ro(
"value", &PrimValueNode::value);
484 static constexpr
const char* _type_key =
"relax.expr.PrimValue";
523 refl::ObjectDef<StringImmNode>().def_ro(
"value", &StringImmNode::value);
526 static constexpr
const char* _type_key =
"relax.expr.StringImm";
557 refl::ObjectDef<DataTypeImmNode>().def_ro(
"value", &DataTypeImmNode::value);
560 static constexpr
const char* _type_key =
"relax.expr.DataTypeImm";
590 refl::ObjectDef<BindingNode>()
591 .def_ro(
"span", &BindingNode::span, refl::AttachFieldFlag::SEqHashIgnore())
595 static constexpr
const char* _type_key =
"relax.expr.Binding";
596 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
606 explicit Binding(ObjectPtr<Object> n) : ObjectRef(n) {}
629 refl::ObjectDef<MatchCastNode>()
630 .def_ro(
"value", &MatchCastNode::value)
631 .def_ro(
"struct_info", &MatchCastNode::struct_info, refl::AttachFieldFlag::SEqHashDef());
634 static constexpr
const char* _type_key =
"relax.expr.MatchCast";
657 refl::ObjectDef<VarBindingNode>().def_ro(
"value", &VarBindingNode::value);
659 refl::TypeAttrDef<VarBindingNode>()
660 .def(
"__s_equal__", &VarBindingNode::SEqual)
661 .def(
"__s_hash__", &VarBindingNode::SHash);
665 ffi::TypedFunction<
bool(AnyView, AnyView,
bool, AnyView)>
equal)
const;
667 ffi::TypedFunction<uint64_t(AnyView, uint64_t,
bool)> hash)
const;
669 static constexpr
const char* _type_key =
"relax.expr.VarBinding";
688 refl::ObjectDef<BindingBlockNode>()
689 .def_ro(
"bindings", &BindingBlockNode::bindings)
690 .def_ro(
"span", &BindingBlockNode::span, refl::AttachFieldFlag::SEqHashIgnore(),
691 refl::DefaultValue(
Span()));
694 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
695 static constexpr
const char* _type_key =
"relax.expr.BindingBlock";
712 refl::ObjectDef<DataflowBlockNode>();
715 static constexpr
const char* _type_key =
"relax.expr.DataflowBlock";
738 refl::ObjectDef<SeqExprNode>()
739 .def_ro(
"blocks", &SeqExprNode::blocks)
740 .def_ro(
"body", &SeqExprNode::body);
743 static constexpr
const char* _type_key =
"relax.expr.SeqExpr";
790 refl::ObjectDef<IfNode>()
791 .def_ro(
"cond", &IfNode::cond)
792 .def_ro(
"true_branch", &IfNode::true_branch)
793 .def_ro(
"false_branch", &IfNode::false_branch);
796 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
797 static constexpr
const char* _type_key =
"relax.expr.If";
832 Optional<Expr> opt_true_branch = Optional<Expr>(),
833 Optional<Expr> opt_false_branch = Optional<Expr>(),
834 Optional<Span> opt_span = Optional<Span>());
850 refl::ObjectDef<FunctionNode>()
851 .def_ro(
"params", &FunctionNode::params, refl::AttachFieldFlag::SEqHashDef())
852 .def_ro(
"body", &FunctionNode::body)
853 .def_ro(
"ret_struct_info", &FunctionNode::ret_struct_info)
854 .def_ro(
"is_pure", &FunctionNode::is_pure);
857 static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindDAGNode;
858 static constexpr
const char* _type_key =
"relax.expr.Function";
885 TVM_DLL
explicit Function(Array<Var> params,
Expr body, Optional<StructInfo> ret_struct_info,
939 refl::ObjectDef<ExternFuncNode>().def_ro(
"global_symbol", &ExternFuncNode::global_symbol);
942 static constexpr
const char* _type_key =
"relax.expr.ExternFunc";
986 struct std::hash<
tvm::relax::Var> {
988 return tvm::runtime::ObjectPtrHash()(
var);
993 struct std::equal_to<
tvm::relax::Var> {
995 return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
Managed reference to BaseAttrsNode.
Definition: attrs.h:134
Base node of all functions.
Definition: function.h:139
Managed reference to BaseFuncNode.
Definition: function.h:234
Managed reference to DictAttrsNode.
Definition: attrs.h:166
Reference to PrimExprNode.
Definition: expr.h:129
Base node of all non-primitive expressions.
Definition: expr.h:422
Optional< ObjectRef > struct_info_
Stores the result of structure information of the expression that encapsulate both static shape and r...
Definition: expr.h:429
Managed reference to RelaxExprNode.
Definition: expr.h:446
Definition: source_map.h:113
Array< Binding > bindings
Definition: expr.h:683
Span span
Definition: expr.h:684
static void RegisterReflection()
Definition: expr.h:686
TVM_DECLARE_BASE_OBJECT_INFO(BindingBlockNode, Object)
BindingBlock(Array< Binding > bindings, Span span=Span())
BindingBlockNode * CopyOnWrite()
TVM_DEFINE_OBJECT_REF_METHODS(BindingBlock, ObjectRef, BindingBlockNode)
The base class of a variable binding in Relax.
Definition: expr.h:582
TVM_DECLARE_BASE_OBJECT_INFO(BindingNode, Object)
Var var
The return variable to bound to.
Definition: expr.h:586
static void RegisterReflection()
Definition: expr.h:588
Span span
Definition: expr.h:584
const BindingNode * operator->() const
Definition: expr.h:608
TVM_DEFINE_DEFAULT_COPY_MOVE_AND_ASSIGN(Binding)
Binding(ObjectPtr< Object > n)
Definition: expr.h:606
const BindingNode * get() const
Definition: expr.h:609
Call corresponds to callable invocation. Corresponds to operation in computational graph terminology.
Definition: expr.h:144
TVM_DECLARE_FINAL_OBJECT_INFO(CallNode, ExprNode)
static void RegisterReflection()
Definition: expr.h:168
tvm::Array< Expr > args
The arguments(inputs) of the call.
Definition: expr.h:155
static constexpr const char * _type_key
Definition: expr.h:177
Expr op
The operator(function) being invoked.
Definition: expr.h:152
Attrs attrs
The additional attributes.
Definition: expr.h:158
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:166
TVM_DEFINE_OBJECT_REF_COW_METHOD(CallNode)
Call(Expr op, Array< Expr > args, Attrs attrs=Attrs(), Array< StructInfo > sinfo_args=Array< StructInfo >(), Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Call, Expr, CallNode)
Constant tensor.
Definition: expr.h:432
runtime::NDArray data
The data of the tensor.
Definition: expr.h:435
static void RegisterReflection()
Definition: expr.h:443
TVM_DECLARE_FINAL_OBJECT_INFO(ConstantNode, LeafExprNode)
bool is_scalar() const
Definition: expr.h:441
TensorType tensor_type() const
TVM_DEFINE_OBJECT_REF_METHODS(Constant, LeafExpr, ConstantNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(ConstantNode)
Constant(runtime::NDArray data, Optional< StructInfo > struct_info_annotation=std::nullopt, Span span=Span())
The constructor.
Represent a data type constant.
Definition: expr.h:550
DataType value
The data value.
Definition: expr.h:553
TVM_DECLARE_FINAL_OBJECT_INFO(DataTypeImmNode, LeafExprNode)
static void RegisterReflection()
Definition: expr.h:555
Managed reference to DataTypeImm.
Definition: expr.h:568
TVM_DEFINE_OBJECT_REF_METHODS(DataTypeImm, LeafExpr, DataTypeImmNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataTypeImmNode)
DataTypeImm(DataType value, Span span=Span())
The constructor.
TVM_DECLARE_FINAL_OBJECT_INFO(DataflowBlockNode, BindingBlockNode)
static void RegisterReflection()
Definition: expr.h:710
TVM_DEFINE_OBJECT_REF_METHODS(DataflowBlock, BindingBlock, DataflowBlockNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataflowBlockNode)
DataflowBlock(Array< Binding > bindings, Span span=Span())
A sub-type of the variable node used to mark dataflow variables from normal visible "function local" ...
Definition: expr.h:402
TVM_DECLARE_FINAL_OBJECT_INFO(DataflowVarNode, VarNode)
static void RegisterReflection()
Definition: expr.h:404
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataflowVarNode)
DataflowVar(Id vid, Optional< StructInfo > struct_info_annotation, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(DataflowVar, Var, DataflowVarNode)
DataflowVar(String name_hint, Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:416
The extern function, which can represent packed function.
Definition: expr.h:932
static void RegisterReflection()
Definition: expr.h:937
String global_symbol
The name of global symbol.
Definition: expr.h:935
TVM_DECLARE_FINAL_OBJECT_INFO(ExternFuncNode, BaseFuncNode)
TVM_DEFINE_OBJECT_REF_METHODS(ExternFunc, BaseFunc, ExternFuncNode)
ExternFunc(String global_symbol, StructInfo struct_info, Span span=Span())
ExternFunc(String global_symbol, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ExternFuncNode)
A Relax function.
Definition: expr.h:837
static void RegisterReflection()
Definition: expr.h:848
Array< Var > params
The parameters to the function.
Definition: expr.h:840
TVM_DECLARE_FINAL_OBJECT_INFO(FunctionNode, BaseFuncNode)
SeqExpr body
The body of the function.
Definition: expr.h:842
StructInfo ret_struct_info
The return type of the function.
Definition: expr.h:844
bool is_pure
Whether the function is annotated as pure or not.
Definition: expr.h:846
TVM_DEFINE_OBJECT_REF_METHODS(Function, BaseFunc, FunctionNode)
static Function CreateEmpty(Array< Var > params, StructInfo ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span())
Mimics the constructor but without body Expr.
TVM_DEFINE_OBJECT_REF_COW_METHOD(FunctionNode)
Function(Array< Var > params, Expr body, Optional< StructInfo > ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span())
Construct a Relax Function.
The unique identifier of variables.
Definition: expr.h:49
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:64
static void RegisterReflection()
Definition: expr.h:58
TVM_DECLARE_FINAL_OBJECT_INFO(IdNode, Object)
static constexpr const char * _type_key
Definition: expr.h:65
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
Id(String name_hint)
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Id, ObjectRef, IdNode)
Condition expression.
Definition: expr.h:779
static void RegisterReflection()
Definition: expr.h:788
SeqExpr true_branch
The expression evaluated when condition is true.
Definition: expr.h:784
Expr cond
The condition.
Definition: expr.h:782
TVM_DECLARE_FINAL_OBJECT_INFO(IfNode, ExprNode)
SeqExpr false_branch
The expression evaluated when condition is false.
Definition: expr.h:786
TVM_DEFINE_OBJECT_REF_COW_METHOD(IfNode)
If(Expr cond, Expr true_branch, Expr false_branch, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(If, Expr, IfNode)
Base type of all (non-function) leaf Exprs.
Definition: expr.h:309
TVM_DECLARE_BASE_OBJECT_INFO(LeafExprNode, ExprNode)
Managed reference to BaseExprNode.
Definition: expr.h:320
TVM_DEFINE_OBJECT_REF_METHODS(LeafExpr, Expr, LeafExprNode)
Runtime-match the value to the struct info.
Definition: expr.h:620
Expr value
The input value to match cast.
Definition: expr.h:623
StructInfo struct_info
The struct info pattern to match to.
Definition: expr.h:625
TVM_DECLARE_FINAL_OBJECT_INFO(MatchCastNode, BindingNode)
static void RegisterReflection()
Definition: expr.h:627
Managed reference to MatchCastNode.
Definition: expr.h:642
TVM_DEFINE_OBJECT_REF_METHODS(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:474
static void RegisterReflection()
Definition: expr.h:479
PrimExpr value
The prim expr representing the value.
Definition: expr.h:477
TVM_DECLARE_FINAL_OBJECT_INFO(PrimValueNode, LeafExprNode)
Managed reference to PrimValueNode.
Definition: expr.h:492
TVM_DEFINE_OBJECT_REF_COW_METHOD(PrimValueNode)
static PrimValue Int64(int64_t value, Span span=Span())
Create a int64 prim value.
PrimValue(PrimExpr value, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(PrimValue, LeafExpr, PrimValueNode)
A sequence of blocks followed by an expression.
Definition: expr.h:731
Expr body
Definition: expr.h:734
TVM_DECLARE_FINAL_OBJECT_INFO(SeqExprNode, ExprNode)
static void RegisterReflection()
Definition: expr.h:736
Array< BindingBlock > blocks
Definition: expr.h:733
SeqExpr(Array< BindingBlock > blocks, Expr body, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(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:327
TVM_DECLARE_FINAL_OBJECT_INFO(ShapeExprNode, LeafExprNode)
Array< PrimExpr > values
Definition: expr.h:330
static void RegisterReflection()
Definition: expr.h:332
TVM_DEFINE_OBJECT_REF_METHODS(ShapeExpr, LeafExpr, ShapeExprNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(ShapeExprNode)
ShapeExpr(Array< PrimExpr > values, Span span=Span())
Represent a string literal constant.
Definition: expr.h:516
TVM_DECLARE_FINAL_OBJECT_INFO(StringImmNode, LeafExprNode)
String value
The data value.
Definition: expr.h:519
static void RegisterReflection()
Definition: expr.h:521
Managed reference to StringImm.
Definition: expr.h:534
StringImm(String value, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(StringImm, LeafExpr, StringImmNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(StringImmNode)
Base type of all structure information.
Definition: expr.h:110
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:116
static constexpr const uint32_t _type_child_slots
Definition: expr.h:127
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:124
static void RegisterReflection()
Definition: expr.h:118
static constexpr const char * _type_key
Definition: expr.h:125
TVM_DECLARE_BASE_OBJECT_INFO(StructInfoNode, Object)
Managed reference to StructInfoNode.
Definition: expr.h:135
TVM_DEFINE_OBJECT_REF_METHODS(StructInfo, ObjectRef, StructInfoNode)
Managed reference to TensorTypeNode.
Definition: type.h:98
Get index-th field out of a tuple.
Definition: expr.h:264
static void RegisterReflection()
Definition: expr.h:271
TVM_DECLARE_FINAL_OBJECT_INFO(TupleGetItemNode, ExprNode)
int index
which value to get
Definition: expr.h:269
Expr tuple
The tuple Expression.
Definition: expr.h:267
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleGetItemNode)
TupleGetItem(Expr tuple, int index, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(TupleGetItem, Expr, TupleGetItemNode)
Tuple container.
Definition: expr.h:210
static void RegisterReflection()
Definition: expr.h:215
tvm::Array< Expr > fields
the fields of the tuple
Definition: expr.h:213
TVM_DECLARE_FINAL_OBJECT_INFO(TupleNode, ExprNode)
static constexpr const char * _type_key
Definition: expr.h:220
Tuple(tvm::Array< Expr > fields, Span span=Span())
The constructor.
Tuple(tvm::Array< RelaxExpr > fields, Span span=Span())
Utility constructor to handle conversion to relax::Expr.
Definition: expr.h:248
TVM_DEFINE_OBJECT_REF_METHODS(Tuple, Expr, TupleNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleNode)
static void RegisterReflection()
Definition: expr.h:655
Expr value
The binding value.
Definition: expr.h:653
TVM_DECLARE_FINAL_OBJECT_INFO(VarBindingNode, BindingNode)
bool SEqual(const VarBindingNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
uint64_t SHash(uint64_t init_hash, ffi::TypedFunction< uint64_t(AnyView, uint64_t, bool)> hash) const
TVM_DEFINE_OBJECT_REF_COW_METHOD(VarBindingNode)
VarBinding(Var var, Expr value, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(VarBinding, Binding, VarBindingNode)
The variable class for all Relax bindings.
Definition: expr.h:349
uint64_t SHash(uint64_t init_hash, ffi::TypedFunction< uint64_t(AnyView, uint64_t, bool)> hash) const
Definition: expr.h:373
TVM_DECLARE_BASE_OBJECT_INFO(VarNode, LeafExprNode)
Id vid
The identifier of the variable, which is used for comparing stable equality across transformations.
Definition: expr.h:353
static void RegisterReflection()
Definition: expr.h:358
const String & name_hint() const
Definition: expr.h:356
bool SEqual(const VarNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition: expr.h:367
TVM_DEFINE_OBJECT_REF_METHODS(Var, LeafExpr, VarNode)
Var(String name_hint, Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:389
Var(Id vid, Optional< StructInfo > struct_info_annotation, Span span=Span())
Runtime primitive data type.
Definition: data_type.h:47
Managed NDArray. The array is backed by reference counted blocks.
Definition: ndarray.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:921
constexpr const char * kWorkspaceSize
The required workspace for an external function.
Definition: expr.h:915
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:928
constexpr const char * kComposite
Treat the function as a composite operator.
Definition: expr.h:911
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:909
constexpr const char * kPrimitive
Mark the function as a primitive function.
Definition: expr.h:904
constexpr const char * kPartitionedFromPattern
Indicate the function was created by the Pattern Partitioning Pass.
Definition: expr.h:913
If WithFields(If if_expr, Optional< Expr > opt_cond=Optional< Expr >(), Optional< Expr > opt_true_branch=Optional< Expr >(), Optional< Expr > opt_false_branch=Optional< Expr >(), Optional< Span > opt_span=Optional< Span >())
Returns if_expr with the given properties. A null property denotes 'no change'. Returns if_expr if al...
Call WithFields(Call call, Optional< Expr > opt_op=Optional< Expr >(), Optional< Array< Expr >> opt_args=Optional< Array< Expr >>(), Optional< Attrs > opt_attrs=Optional< Attrs >(), Optional< Array< StructInfo >> opt_sinfo_args=Optional< Array< StructInfo >>(), Optional< Span > opt_span=Optional< Span >())
Returns call with the given properties. A null property denotes 'no change'. Returns call if all prop...
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.