25 #ifndef TVM_TIR_EXPR_H_
26 #define TVM_TIR_EXPR_H_
43 #include <unordered_map>
59 v->Visit(
"dtype", &
dtype);
60 v->Visit(
"value", &
value);
61 v->Visit(
"span", &
span);
70 static constexpr
const char*
_type_key =
"tir.StringImm";
95 v->Visit(
"dtype", &
dtype);
96 v->Visit(
"value", &
value);
97 v->Visit(
"span", &
span);
128 template <
typename T>
137 v->Visit(
"dtype", &(this->
dtype));
140 v->Visit(
"span", &
span);
250 static constexpr
const char*
_type_key =
"tir.FloorDiv";
267 static constexpr
const char*
_type_key =
"tir.FloorMod";
319 template <
typename T>
328 v->Visit(
"dtype", &(this->
dtype));
331 v->Visit(
"span", &
span);
458 v->Visit(
"dtype", &(this->
dtype));
461 v->Visit(
"span", &
span);
498 v->Visit(
"dtype", &
dtype);
501 v->Visit(
"span", &
span);
536 v->Visit(
"dtype", &
dtype);
538 v->Visit(
"span", &
span);
582 v->Visit(
"dtype", &
dtype);
586 v->Visit(
"span", &
span);
637 v->Visit(
"dtype", &(this->
dtype));
638 v->Visit(
"buffer", &
buffer);
641 v->Visit(
"span", &
span);
656 static constexpr
const char*
_type_key =
"tir.BufferLoad";
669 void LegalizeDType();
705 v->Visit(
"dtype", &(this->
dtype));
708 v->Visit(
"span", &
span);
722 static constexpr
const char*
_type_key =
"tir.ProducerLoad";
757 v->Visit(
"dtype", &
dtype);
758 v->Visit(
"base", &
base);
759 v->Visit(
"stride", &
stride);
760 v->Visit(
"lanes", &
lanes);
761 v->Visit(
"span", &
span);
800 v->Visit(
"dtype", &
dtype);
801 v->Visit(
"value", &
value);
802 v->Visit(
"lanes", &
lanes);
803 v->Visit(
"span", &
span);
816 static constexpr
const char*
_type_key =
"tir.Broadcast";
844 v->Visit(
"dtype", &
dtype);
845 v->Visit(
"var", &
var);
846 v->Visit(
"value", &
value);
847 v->Visit(
"body", &
body);
848 v->Visit(
"span", &
span);
894 v->Visit(
"dtype", &
dtype);
896 v->Visit(
"args", &
args);
897 v->Visit(
"span", &
span);
938 v->Visit(
"dtype", &
dtype);
941 v->Visit(
"span", &
span);
1001 v->Visit(
"lhs", &
lhs);
1002 v->Visit(
"rhs", &
rhs);
1003 v->Visit(
"result", &
result);
1005 v->Visit(
"span", &
span);
1058 v->Visit(
"dtype", &
dtype);
1060 v->Visit(
"source", &
source);
1061 v->Visit(
"init", &
init);
1062 v->Visit(
"axis", &
axis);
1065 v->Visit(
"span", &
span);
1107 v->Visit(
"dtype", &
dtype);
1108 v->Visit(
"span", &
span);
1147 template <
typename K,
typename V>
1149 std::unordered_map<K, V>
ret;
1150 for (
auto kv : dmap) {
1151 ret[kv.first] = kv.second;
1167 template <
typename PODSub
class>
1169 auto type_code = val.type_code();
1171 type_code ==
kTVMStr || val.template IsObjectRef<tvm::runtime::String>();
1179 template <
typename PODSub
class>
1181 if (
auto opt = TryFrom(val)) {
1184 return val.template AsObjectRef<tvm::tir::StringImm>();
1194 template <
typename PODSub
class>
1196 if (
auto opt = val.TryAsBool()) {
1207 return PrimExpr::FromObject_(val.template AsObjectRef<ObjectRef>());
Runtime Array container types.
Symbolic n-dimensional array, to represent a memory buffer.
@ kTVMBytes
Definition: c_runtime_api.h:187
@ kTVMDataType
Definition: c_runtime_api.h:180
@ kTVMStr
Definition: c_runtime_api.h:186
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:56
Constant floating point literals in the program.
Definition: expr.h:548
Constant integer literals in the program.
Definition: expr.h:501
Base node of all primitive expressions.
Definition: expr.h:86
DataType dtype
The runtime data type of the primitive expression.
Definition: expr.h:102
Reference to PrimExprNode.
Definition: expr.h:115
DataType dtype() const
Definition: expr.h:129
Managed reference to RelayExprNode.
Definition: expr.h:442
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:137
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:121
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:198
Definition: source_map.h:120
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Runtime primitive data type.
Definition: data_type.h:43
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:219
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Reference to string objects.
Definition: string.h:98
a + b
Definition: expr.h:157
static constexpr const char * _type_key
Definition: expr.h:159
Managed reference to AddNode.
Definition: expr.h:166
TVM_DEFINE_OBJECT_REF_COW_METHOD(AddNode)
TVM_DEFINE_OBJECT_REF_METHODS(Add, PrimExpr, AddNode)
Add(PrimExpr a, PrimExpr b, Span span=Span())
a && b
Definition: expr.h:450
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:468
PrimExpr a
The left operand.
Definition: expr.h:453
bool SEqualReduce(const AndNode *other, SEqualReducer equal) const
Definition: expr.h:464
static constexpr const char * _type_key
Definition: expr.h:474
PrimExpr b
The right operand.
Definition: expr.h:455
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:457
TVM_DECLARE_FINAL_OBJECT_INFO(AndNode, PrimExprNode)
Managed reference to AndNode.
Definition: expr.h:482
TVM_DEFINE_OBJECT_REF_COW_METHOD(AndNode)
And(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(And, PrimExpr, AndNode)
Any shape.
Definition: expr.h:1104
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:1106
TVM_DECLARE_FINAL_OBJECT_INFO(AnyNode, PrimExprNode)
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:1115
SizeVar ToSizeVar() const
Convert to SizeVar.
Definition: expr.h:1121
bool SEqualReduce(const AnyNode *other, SEqualReducer equal) const
Definition: expr.h:1111
static constexpr const char * _type_key
Definition: expr.h:1123
Var ToVar() const
Convert to var.
Definition: expr.h:1118
Managed reference to AnyNode.
Definition: expr.h:1131
TVM_DEFINE_OBJECT_REF_COW_METHOD(AnyNode)
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(Any, PrimExpr, AnyNode)
Base template to implement binary ops.
Definition: expr.h:129
PrimExpr b
The right operand.
Definition: expr.h:134
bool SEqualReduce(const T *other, SEqualReducer equal) const
Definition: expr.h:143
TVM_DECLARE_FINAL_OBJECT_INFO(T, PrimExprNode)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:136
PrimExpr a
The left operand.
Definition: expr.h:132
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:147
Create a vector where all the elements are value.
Definition: expr.h:792
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:799
static constexpr const char * _type_key
Definition: expr.h:816
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:810
TVM_DECLARE_FINAL_OBJECT_INFO(BroadcastNode, PrimExprNode)
bool SEqualReduce(const BroadcastNode *other, SEqualReducer equal) const
Definition: expr.h:806
PrimExpr value
The base value.
Definition: expr.h:795
PrimExpr lanes
The number of lanes.
Definition: expr.h:797
Managed reference to BroadcastNode.
Definition: expr.h:824
Broadcast(PrimExpr value, PrimExpr lanes, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(Broadcast, PrimExpr, BroadcastNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(BroadcastNode)
Load value from the high dimension buffer.
Definition: expr.h:627
friend class VectorTypeRewriter
Definition: expr.h:672
friend class CustomDatatypesLowerer
Definition: expr.h:671
TVM_DECLARE_FINAL_OBJECT_INFO(BufferLoadNode, PrimExprNode)
Array< PrimExpr > indices
The indices location to be loaded.
Definition: expr.h:632
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:636
friend class Vectorizer
Definition: expr.h:673
Buffer buffer
The buffer variable.
Definition: expr.h:630
bool SEqualReduce(const BufferLoadNode *other, SEqualReducer equal) const
Definition: expr.h:644
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:649
static constexpr const char * _type_key
Definition: expr.h:656
Optional< PrimExpr > predicate
The predicate mask for loading values.
Definition: expr.h:634
Managed reference to BufferLoadNode.
Definition: expr.h:680
TVM_DEFINE_OBJECT_REF_COW_METHOD(BufferLoadNode)
TVM_DEFINE_OBJECT_REF_METHODS(BufferLoad, PrimExpr, BufferLoadNode)
BufferLoad(Buffer buffer, Array< PrimExpr > indices, Optional< PrimExpr > predicate=NullOpt, Span span=Span())
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types,...
Definition: buffer.h:174
Call node.
Definition: expr.h:881
RelayExpr op
The operator(function) being invoked.
Definition: expr.h:889
bool SEqualReduce(const CallNode *other, SEqualReducer equal) const
Definition: expr.h:900
static constexpr const char * _type_key
Definition: expr.h:910
Array< PrimExpr > args
The arguments.
Definition: expr.h:892
TVM_DECLARE_FINAL_OBJECT_INFO(CallNode, PrimExprNode)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:893
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:904
Managed reference to CallNode.
Definition: expr.h:918
TVM_DEFINE_OBJECT_REF_COW_METHOD(CallNode)
TVM_DEFINE_OBJECT_REF_METHODS(Call, PrimExpr, CallNode)
Call(DataType dtype, RelayExpr op, Array< PrimExpr > args, Span span=Span())
Cast value from one data type to another.
Definition: expr.h:89
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:104
PrimExpr value
Original data type.
Definition: expr.h:92
bool SEqualReduce(const CastNode *other, SEqualReducer equal) const
Definition: expr.h:100
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:94
TVM_DECLARE_FINAL_OBJECT_INFO(CastNode, PrimExprNode)
static constexpr const char * _type_key
Definition: expr.h:109
Managed reference to CastNode.
Definition: expr.h:117
TVM_DEFINE_OBJECT_REF_COW_METHOD(CastNode)
TVM_DEFINE_OBJECT_REF_METHODS(Cast, PrimExpr, CastNode)
Cast(DataType dtype, PrimExpr value, Span span=Span())
Base template to implement comparison ops.
Definition: expr.h:320
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:327
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:338
bool SEqualReduce(const T *other, SEqualReducer equal) const
Definition: expr.h:334
TVM_DECLARE_FINAL_OBJECT_INFO(T, PrimExprNode)
PrimExpr a
The left operand.
Definition: expr.h:323
PrimExpr b
The right operand.
Definition: expr.h:325
A commutative reducer node to represent a commutative binary operator with identity element.
Definition: expr.h:978
static constexpr const bool _type_has_method_shash_reduce
Definition: expr.h:1022
Array< Var > rhs
The right argument of reducer.
Definition: expr.h:983
Array< Var > lhs
The left argument of reducer.
Definition: expr.h:981
static constexpr const char * _type_key
Definition: expr.h:1020
static constexpr const bool _type_has_method_sequal_reduce
Definition: expr.h:1021
bool SEqualReduce(const CommReducerNode *other, SEqualReducer equal) const
Definition: expr.h:1008
Array< PrimExpr > operator()(Array< PrimExpr > a, Array< PrimExpr > b) const
Function call operator to combine a and b.
Array< PrimExpr > result
The result of reducer.
Definition: expr.h:985
TVM_DECLARE_FINAL_OBJECT_INFO(CommReducerNode, Object)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:1000
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:1013
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:998
Array< PrimExpr > identity_element
The identity element of reducer, which leaves other elements unchanged when combined with it,...
Definition: expr.h:991
Managed reference to CommReducerNode.
Definition: expr.h:1030
CommReducer(Array< Var > lhs, Array< Var > rhs, Array< PrimExpr > result, Array< PrimExpr > identity_element, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(CommReducer, ObjectRef, CommReducerNode)
Managed reference to DataProducerNode.
Definition: buffer.h:313
a / b in the C semnatics.
Definition: expr.h:211
static constexpr const char * _type_key
Definition: expr.h:213
Managed reference to DivNode.
Definition: expr.h:220
TVM_DEFINE_OBJECT_REF_COW_METHOD(DivNode)
Div(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(Div, PrimExpr, DivNode)
a == b
Definition: expr.h:348
static constexpr const char * _type_key
Definition: expr.h:350
Managed reference to EQNode.
Definition: expr.h:357
TVM_DEFINE_OBJECT_REF_METHODS(EQ, PrimExpr, EQNode)
EQ(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(EQNode)
Floor division, floor(a/b)
Definition: expr.h:248
static constexpr const char * _type_key
Definition: expr.h:250
Managed reference to FloorDivNode.
Definition: expr.h:257
TVM_DEFINE_OBJECT_REF_METHODS(FloorDiv, PrimExpr, FloorDivNode)
FloorDiv(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(FloorDivNode)
The remainder of the floordiv.
Definition: expr.h:265
static constexpr const char * _type_key
Definition: expr.h:267
Managed reference to FloorModNode.
Definition: expr.h:274
TVM_DEFINE_OBJECT_REF_COW_METHOD(FloorModNode)
TVM_DEFINE_OBJECT_REF_METHODS(FloorMod, PrimExpr, FloorModNode)
FloorMod(PrimExpr a, PrimExpr b, Span span=Span())
a >= b
Definition: expr.h:433
static constexpr const char * _type_key
Definition: expr.h:435
Managed reference to GENode.
Definition: expr.h:442
TVM_DEFINE_OBJECT_REF_METHODS(GE, PrimExpr, GENode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(GENode)
GE(PrimExpr a, PrimExpr b, Span span=Span())
a > b
Definition: expr.h:416
static constexpr const char * _type_key
Definition: expr.h:418
Managed reference to GTNode.
Definition: expr.h:425
TVM_DEFINE_OBJECT_REF_METHODS(GT, PrimExpr, GTNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(GTNode)
GT(PrimExpr a, PrimExpr b, Span span=Span())
Iteration Variable, represents an iteration over an integer interval.
Definition: var.h:315
Managed reference to LENode.
Definition: expr.h:408
LE(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(LENode)
TVM_DEFINE_OBJECT_REF_METHODS(LE, PrimExpr, LENode)
a < b
Definition: expr.h:382
static constexpr const char * _type_key
Definition: expr.h:384
Managed reference to LTNode.
Definition: expr.h:391
TVM_DEFINE_OBJECT_REF_COW_METHOD(LTNode)
LT(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(LT, PrimExpr, LTNode)
Let binding. Bind var to value then evaluate body.
Definition: expr.h:834
Var var
The variable.
Definition: expr.h:837
static constexpr const char * _type_key
Definition: expr.h:863
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:856
PrimExpr value
The value to be binded.
Definition: expr.h:839
TVM_DECLARE_FINAL_OBJECT_INFO(LetNode, PrimExprNode)
bool SEqualReduce(const LetNode *other, SEqualReducer equal) const
Definition: expr.h:851
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:843
PrimExpr body
The result expression.
Definition: expr.h:841
Managed reference to LetNode.
Definition: expr.h:871
TVM_DEFINE_OBJECT_REF_METHODS(Let, PrimExpr, LetNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(LetNode)
Let(Var var, PrimExpr value, PrimExpr body, Span span=Span())
max(a, b)
Definition: expr.h:299
static constexpr const char * _type_key
Definition: expr.h:301
Managed reference to MaxNode.
Definition: expr.h:308
TVM_DEFINE_OBJECT_REF_METHODS(Max, PrimExpr, MaxNode)
Max(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(MaxNode)
min(a, b)
Definition: expr.h:282
static constexpr const char * _type_key
Definition: expr.h:284
Managed reference to MinNode.
Definition: expr.h:291
Min(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(Min, PrimExpr, MinNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(MinNode)
a % b in the C semnatics.
Definition: expr.h:231
static constexpr const char * _type_key
Definition: expr.h:233
Managed reference to ModNode.
Definition: expr.h:240
TVM_DEFINE_OBJECT_REF_METHODS(Mod, PrimExpr, ModNode)
Mod(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ModNode)
a * b
Definition: expr.h:191
static constexpr const char * _type_key
Definition: expr.h:193
Managed reference to MulNode.
Definition: expr.h:200
Mul(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(Mul, PrimExpr, MulNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(MulNode)
a != b
Definition: expr.h:365
static constexpr const char * _type_key
Definition: expr.h:367
Managed reference to NENode.
Definition: expr.h:374
NE(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(NENode)
TVM_DEFINE_OBJECT_REF_METHODS(NE, PrimExpr, NENode)
TVM_DECLARE_FINAL_OBJECT_INFO(NotNode, PrimExprNode)
PrimExpr a
The input operand.
Definition: expr.h:533
static constexpr const char * _type_key
Definition: expr.h:550
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:535
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:545
bool SEqualReduce(const NotNode *other, SEqualReducer equal) const
Definition: expr.h:541
Managed reference to NotNode.
Definition: expr.h:558
TVM_DEFINE_OBJECT_REF_COW_METHOD(NotNode)
Not(PrimExpr a, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(Not, PrimExpr, NotNode)
a || b
Definition: expr.h:490
bool SEqualReduce(const OrNode *other, SEqualReducer equal) const
Definition: expr.h:504
PrimExpr b
The right operand.
Definition: expr.h:495
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:508
PrimExpr a
The left operand.
Definition: expr.h:493
TVM_DECLARE_FINAL_OBJECT_INFO(OrNode, PrimExprNode)
static constexpr const char * _type_key
Definition: expr.h:514
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:497
Managed reference to OrNode.
Definition: expr.h:522
TVM_DEFINE_OBJECT_REF_METHODS(Or, PrimExpr, OrNode)
Or(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(OrNode)
Load value from the result produced by the producer.
Definition: expr.h:697
static constexpr const char * _type_key
Definition: expr.h:722
Array< PrimExpr > indices
The location arguments.
Definition: expr.h:702
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:704
bool SEqualReduce(const ProducerLoadNode *other, SEqualReducer equal) const
Definition: expr.h:711
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:716
DataProducer producer
The buffer producer.
Definition: expr.h:700
TVM_DECLARE_FINAL_OBJECT_INFO(ProducerLoadNode, PrimExprNode)
Managed reference to ProducerLoadNode.
Definition: expr.h:730
TVM_DEFINE_OBJECT_REF_METHODS(ProducerLoad, PrimExpr, ProducerLoadNode)
ProducerLoad(DataProducer producer, Array< PrimExpr > indices, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ProducerLoadNode)
Construct a vector with lanes elements where its i-th element equals base + i * stride....
Definition: expr.h:747
static constexpr const char * _type_key
Definition: expr.h:776
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:756
PrimExpr stride
The stride of each step.
Definition: expr.h:752
TVM_DECLARE_FINAL_OBJECT_INFO(RampNode, PrimExprNode)
PrimExpr lanes
Total number of lanes.
Definition: expr.h:754
bool SEqualReduce(const RampNode *other, SEqualReducer equal) const
Definition: expr.h:764
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:769
PrimExpr base
The base value.
Definition: expr.h:750
Managed reference to RampNode.
Definition: expr.h:784
TVM_DEFINE_OBJECT_REF_COW_METHOD(RampNode)
TVM_DEFINE_OBJECT_REF_METHODS(Ramp, PrimExpr, RampNode)
Ramp(PrimExpr base, PrimExpr stride, PrimExpr lanes, Span span=Span())
Reduction operator.
Definition: expr.h:1039
Array< PrimExpr > init
The init operand.
Definition: expr.h:1046
int value_index
the index of this reduce node
Definition: expr.h:1055
static constexpr const char * _type_key
Definition: expr.h:1086
TVM_DECLARE_FINAL_OBJECT_INFO(ReduceNode, PrimExprNode)
Array< IterVar > axis
The reduction axis.
Definition: expr.h:1048
CommReducer combiner
The commutative combiner.
Definition: expr.h:1042
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:1057
bool SEqualReduce(const ReduceNode *other, SEqualReducer equal) const
Definition: expr.h:1068
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:1076
Array< PrimExpr > source
The source operand.
Definition: expr.h:1044
PrimExpr condition
Predicate on the reduction Only add the body to reduction if condition is true.
Definition: expr.h:1053
Managed reference to ReduceNode.
Definition: expr.h:1094
TVM_DEFINE_OBJECT_REF_COW_METHOD(ReduceNode)
TVM_DEFINE_OBJECT_REF_METHODS(Reduce, PrimExpr, ReduceNode)
Reduce(CommReducer combiner, Array< PrimExpr > src, Array< IterVar > rdom, PrimExpr condition, int value_index, Array< PrimExpr > init, Span span=Span())
return true_value if condition is true, otherwise return false_value.
Definition: expr.h:572
PrimExpr condition
The condition.
Definition: expr.h:575
PrimExpr true_value
value to be returned when condition is true.
Definition: expr.h:577
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:594
static constexpr const char * _type_key
Definition: expr.h:601
bool SEqualReduce(const SelectNode *other, SEqualReducer equal) const
Definition: expr.h:589
TVM_DECLARE_FINAL_OBJECT_INFO(SelectNode, PrimExprNode)
PrimExpr false_value
value to be returned when condition is false.
Definition: expr.h:579
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:581
Managed reference to SelectNode.
Definition: expr.h:609
TVM_DEFINE_OBJECT_REF_COW_METHOD(SelectNode)
TVM_DEFINE_OBJECT_REF_METHODS(Select, PrimExpr, SelectNode)
Select(PrimExpr condition, PrimExpr true_value, PrimExpr false_value, Span span=Span())
Shuffle instruction. vec = concat(vectors) result = (vec[indices[0]], vec[indices[1]] ....
Definition: expr.h:930
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:949
Array< PrimExpr > indices
The indices of each element.
Definition: expr.h:935
static constexpr const char * _type_key
Definition: expr.h:955
TVM_DECLARE_FINAL_OBJECT_INFO(ShuffleNode, PrimExprNode)
Array< PrimExpr > vectors
the input vectors.
Definition: expr.h:933
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:937
bool SEqualReduce(const ShuffleNode *other, SEqualReducer equal) const
Definition: expr.h:944
Managed reference to ShuffleNode.
Definition: expr.h:963
static PrimExpr Concat(Array< PrimExpr > vectors, Span span=Span())
Shuffle(Array< PrimExpr > vectors, Array< PrimExpr > indices, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ShuffleNode)
TVM_DEFINE_OBJECT_REF_METHODS(Shuffle, PrimExpr, ShuffleNode)
static PrimExpr ExtractElement(PrimExpr vector, int index, Span span=Span())
a named variable represents a tensor index size
Definition: var.h:151
String constants, only used in asserts.
Definition: expr.h:53
String value
The constant value content.
Definition: expr.h:56
bool SEqualReduce(const StringImmNode *other, SEqualReducer equal) const
Definition: expr.h:64
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:68
static constexpr const char * _type_key
Definition: expr.h:70
TVM_DECLARE_FINAL_OBJECT_INFO(StringImmNode, PrimExprNode)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:58
Managed reference to StringImmNode.
Definition: expr.h:78
StringImm(String value, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(StringImmNode)
TVM_DEFINE_OBJECT_REF_METHODS(StringImm, PrimExpr, StringImmNode)
a - b
Definition: expr.h:174
static constexpr const char * _type_key
Definition: expr.h:176
Managed reference to SubNode.
Definition: expr.h:183
Sub(PrimExpr a, PrimExpr b, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(Sub, PrimExpr, SubNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(SubNode)
a named variable in TIR
Definition: var.h:89
Defines the Functor data structures.
Runtime Map container types.
tvm::Span Span
Definition: base.h:65
Box< bool > Bool
Boxed version of C++ bool.
Definition: boxed_primitive.h:121
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
std::unordered_map< K, V > as_unordered_map(const Map< K, V > &dmap)
Definition: expr.h:1148
tvm::FloatImmNode FloatImmNode
Definition: expr.h:50
tvm::IntImmNode IntImmNode
Definition: expr.h:49
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
PrimExpr ret(PrimExpr value, Span span=Span())
Return the value.
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
constexpr runtime::NullOptType NullOpt
Definition: optional.h:169
Definitions and helper macros for IR/AST nodes.
Runtime String container types.
ObjectRef hash functor.
Definition: object.h:655
static PrimExpr From(const PODSubclass &val)
Definition: expr.h:1195
static Optional< tvm::tir::StringImm > TryFrom(const PODSubclass &val)
Definition: expr.h:1168
static tvm::tir::StringImm From(const PODSubclass &val)
Definition: expr.h:1180
Type trait to specify special value conversion rules from TVMArgValue and TVMRetValue.
Definition: packed_func.h:1246
a <= b
Definition: expr.h:399
static constexpr const char * _type_key
Definition: expr.h:401