tvm
expr.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
24 #ifndef TVM_IR_EXPR_H_
25 #define TVM_IR_EXPR_H_
26 
27 #include <tvm/ffi/reflection/registry.h>
28 #include <tvm/ffi/string.h>
29 #include <tvm/ir/source_map.h>
30 #include <tvm/ir/type.h>
31 #include <tvm/node/cast.h>
32 #include <tvm/node/repr_printer.h>
34 #include <tvm/runtime/object.h>
35 
36 #include <algorithm>
37 #include <functional>
38 #include <limits>
39 #include <string>
40 #include <type_traits>
41 
42 namespace tvm {
43 
44 // Forward-declare VirtualDevice to avoid circular imports.
45 class VirtualDevice;
46 
51 class BaseExprNode : public Object {
52  public:
57  mutable Span span;
58 
59  static void RegisterReflection() {
60  namespace refl = tvm::ffi::reflection;
61  // span do not participate in structural equal and hash.
62  refl::ObjectDef<BaseExprNode>().def_ro("span", &BaseExprNode::span, refl::DefaultValue(Span()),
63  refl::AttachFieldFlag::SEqHashIgnore());
64  }
65 
66  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
67 
68  static constexpr const uint32_t _type_child_slots = 64;
69  TVM_FFI_DECLARE_OBJECT_INFO("ir.BaseExpr", BaseExprNode, Object);
70 };
71 
76 class BaseExpr : public ObjectRef {
77  public:
79 };
80 
93 class PrimExprNode : public BaseExprNode {
94  public:
110 
111  static void RegisterReflection() {
112  namespace refl = tvm::ffi::reflection;
113  refl::ObjectDef<PrimExprNode>().def_ro("dtype", &PrimExprNode::dtype);
114  }
115 
117 
118  static constexpr const uint32_t _type_child_slots = 40;
120 };
121 
126 class PrimExpr : public BaseExpr {
127  public:
132  TVM_DLL PrimExpr(int32_t value); // NOLINT(*)
137  TVM_DLL PrimExpr(float value); // NOLINT(*)
138 
140  DataType dtype() const { return static_cast<const PrimExprNode*>(get())->dtype; }
141 
143 
148  TVM_DLL static PrimExpr ConvertFallbackValue(ffi::String value); // NOLINT(*)
149 };
150 
156 class PrimExprConvertibleNode : public Object {
157  public:
159  virtual PrimExpr ToPrimExpr() const = 0;
160  TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExprConvertible", PrimExprConvertibleNode, Object);
161 };
162 
167 class PrimExprConvertible : public ObjectRef {
168  public:
171 };
172 
173 namespace ffi {
174 // define automatic conversion from bool, int64_t, double, ffi::String to PrimExpr
175 // These functions are declared early to avoid circular dependency
176 template <>
177 inline constexpr bool use_default_type_traits_v<PrimExpr> = false;
178 
179 template <>
180 struct TypeTraits<PrimExpr>
181  : public ObjectRefWithFallbackTraitsBase<PrimExpr, StrictBool, int64_t, double, ffi::String,
182  PrimExprConvertible> {
183  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(StrictBool value);
184  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(int64_t value);
185  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(double value);
186  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(ffi::String value) {
187  return PrimExpr::ConvertFallbackValue(value);
188  }
189  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(PrimExprConvertible value) {
190  return value->ToPrimExpr();
191  }
192 };
193 } // namespace ffi
194 
205 
216 
226 
237 
248 
259 
270 
281 
292 
303 
314 
325 
336 
346 
356 
365 
376 
387 
398 
408 
418 class RelaxExprNode : public BaseExprNode {
419  public:
425  mutable ffi::Optional<ObjectRef> struct_info_ = ffi::Optional<ObjectRef>();
426 
427  static void RegisterReflection() {
428  namespace refl = tvm::ffi::reflection;
429  refl::ObjectDef<RelaxExprNode>().def_ro("struct_info_", &RelaxExprNode::struct_info_,
430  refl::AttachFieldFlag::SEqHashIgnore());
431  }
432 
433  static constexpr const uint32_t _type_child_slots = 22;
435 };
436 
441 class RelaxExpr : public BaseExpr {
442  public:
444 };
445 
446 class GlobalVar;
455 class GlobalVarNode : public RelaxExprNode {
456  public:
458  ffi::String name_hint;
459 
460  static void RegisterReflection() {
461  namespace refl = tvm::ffi::reflection;
462  refl::ObjectDef<GlobalVarNode>().def_ro("name_hint", &GlobalVarNode::name_hint);
463  }
464 
465  bool SEqual(const GlobalVarNode* other,
466  ffi::TypedFunction<bool(AnyView, AnyView, bool, AnyView)> equal) const {
467  return equal(name_hint, other->name_hint, false, "name_hint");
468  }
469 
470  int64_t SHash(int64_t init_hash, ffi::TypedFunction<int64_t(AnyView, int64_t, bool)> hash) const {
471  return hash(name_hint, init_hash, false);
472  }
473 
474  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar;
476 };
477 
482 class GlobalVar : public RelaxExpr {
483  public:
484  TVM_DLL explicit GlobalVar(ffi::String name_hint, Span span = {});
485 
488 };
489 
494 class IntImmNode : public PrimExprNode {
495  public:
497  int64_t value;
498 
499  static void RegisterReflection() {
500  namespace refl = tvm::ffi::reflection;
501  refl::ObjectDef<IntImmNode>().def_ro("value", &IntImmNode::value);
502  }
504 };
505 
511 class IntImm : public PrimExpr {
512  public:
519  TVM_DLL IntImm(DataType dtype, int64_t value, Span span = Span());
520 
523 };
524 
529 class FloatImmNode : public PrimExprNode {
530  public:
532  double value;
533 
534  static void RegisterReflection() {
535  namespace refl = tvm::ffi::reflection;
536  refl::ObjectDef<FloatImmNode>().def_ro("value", &FloatImmNode::value);
537  }
539 };
540 
546 class FloatImm : public PrimExpr {
547  public:
554  TVM_DLL FloatImm(DataType dtype, double value, Span span = Span());
555 
558 };
559 
566 class Bool : public IntImm {
567  public:
568  explicit Bool(bool value, Span span = Span()) : IntImm(DataType::Bool(), value, span) {}
569  Bool operator!() const { return Bool((*this)->value == 0); }
570  operator bool() const { return (*this)->value != 0; }
571 
573 };
574 
575 // Overload operators to make sure we have the most fine grained types.
576 inline Bool operator||(const Bool& a, bool b) { return Bool(a.operator bool() || b); }
577 inline Bool operator||(bool a, const Bool& b) { return Bool(a || b.operator bool()); }
578 inline Bool operator||(const Bool& a, const Bool& b) {
579  return Bool(a.operator bool() || b.operator bool());
580 }
581 inline Bool operator&&(const Bool& a, bool b) { return Bool(a.operator bool() && b); }
582 inline Bool operator&&(bool a, const Bool& b) { return Bool(a && b.operator bool()); }
583 inline Bool operator&&(const Bool& a, const Bool& b) {
584  return Bool(a.operator bool() && b.operator bool());
585 }
586 
587 inline bool operator==(const Bool& a, bool b) { return a.operator bool() == b; }
588 inline bool operator==(bool a, const Bool& b) { return a == b.operator bool(); }
589 inline bool operator==(const Bool& a, const Bool& b) {
590  return a.operator bool() == b.operator bool();
591 }
592 
601 class Integer : public IntImm {
602  public:
603  Integer() {}
607  explicit Integer(ObjectPtr<IntImmNode> node) : IntImm(node) {}
611  explicit Integer(ffi::UnsafeInit tag) : IntImm(tag) {}
615  Integer(int value, Span span = Span()) : IntImm(DataType::Int(32), value, span) {} // NOLINT(*)
620  Integer(IntImm other) : IntImm(std::move(other)) {} // NOLINT(*)
626  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
627  explicit Integer(Enum value) : Integer(static_cast<int>(value)) {
628  static_assert(std::is_same<int, typename std::underlying_type<Enum>::type>::value,
629  "declare enum to be enum int to use visitor");
630  }
635  Integer& operator=(const IntImm& other) {
636  data_ = ffi::details::ObjectUnsafe::ObjectPtrFromObjectRef<Object>(other);
637  return *this;
638  }
642  int64_t IntValue() const {
643  TVM_FFI_ICHECK(data_ != nullptr) << " Trying to reference a null Integer";
644  return (*this)->value;
645  }
646  // comparators
647  Bool operator==(int other) const {
648  if (data_ == nullptr) return Bool(false);
649  return Bool((*this)->value == other);
650  }
651  Bool operator!=(int other) const { return !(*this == other); }
652  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
653  Bool operator==(Enum other) const {
654  return *this == static_cast<int>(other);
655  }
656  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
657  Bool operator!=(Enum other) const {
658  return *this != static_cast<int>(other);
659  }
660 };
661 
663 class RangeNode : public Object {
664  public:
670  mutable Span span;
674  : min(min), extent(extent), span(span) {}
675 
676  static void RegisterReflection() {
677  namespace refl = tvm::ffi::reflection;
678  refl::ObjectDef<RangeNode>()
679  .def_ro("min", &RangeNode::min)
680  .def_ro("extent", &RangeNode::extent)
681  .def_ro("span", &RangeNode::span, refl::AttachFieldFlag::SEqHashIgnore());
682  }
683 
684  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
685 
687 };
688 
690 class Range : public ObjectRef {
691  public:
698  TVM_DLL Range(PrimExpr begin, PrimExpr end, Span span = Span());
709  static Range FromMinExtent(PrimExpr min, PrimExpr extent, Span span = Span());
710  // declare range.
712 };
713 
714 namespace ffi {
715 // Type traits to enable automatic conversion into IntImm, Integer, and Bool
716 // when called through the FFI
717 template <>
718 inline constexpr bool use_default_type_traits_v<IntImm> = false;
719 
720 // specialize to enable implicit conversion from const char*
721 template <>
722 struct TypeTraits<IntImm> : public ObjectRefWithFallbackTraitsBase<IntImm, int64_t> {
723  TVM_FFI_INLINE static IntImm ConvertFallbackValue(int64_t value) {
724  auto dtype =
726  ? DataType::Int(64)
727  : DataType::Int(32);
728  return IntImm(dtype, value);
729  }
730 };
731 
732 template <>
733 inline constexpr bool use_default_type_traits_v<Integer> = false;
734 
735 template <>
736 struct TypeTraits<Integer> : public ObjectRefWithFallbackTraitsBase<Integer, int64_t> {
737  TVM_FFI_INLINE static Integer ConvertFallbackValue(int64_t value) {
739  }
740 };
741 
742 template <>
743 inline constexpr bool use_default_type_traits_v<FloatImm> = false;
744 
745 template <>
746 struct TypeTraits<FloatImm> : public ObjectRefWithFallbackTraitsBase<FloatImm, double> {
747  TVM_FFI_INLINE static FloatImm ConvertFallbackValue(double value) {
748  return FloatImm(runtime::DataType::Float(32), value);
749  }
750 };
751 
752 template <>
753 inline constexpr bool use_default_type_traits_v<Bool> = false;
754 
755 template <>
756 struct TypeTraits<Bool> : public ObjectRefWithFallbackTraitsBase<Bool, int64_t> {
757  TVM_FFI_INLINE static Bool ConvertFallbackValue(int64_t value) { return Bool(value != 0); }
758 };
759 
760 // define automatic conversion from bool, int64_t, double to PrimExpr
761 TVM_FFI_INLINE PrimExpr TypeTraits<PrimExpr>::ConvertFallbackValue(StrictBool value) {
762  return IntImm(DataType::Bool(), value, Span());
763 }
764 
767 }
768 
771 }
772 } // namespace ffi
773 } // namespace tvm
774 
775 /* \brief Allow tvm.GLobalVar as key in STL tables
776  *
777  * For most IR expressions, it would be ambiguous whether the
778  * expression should follow reference equality or structural equality.
779  * This is not the case for variables, which do not contain nested
780  * internal structure, and are frequently used as keys in lookup
781  * tables.
782  *
783  * Providing `std::hash` and `std::equal_to` specializations for
784  * `tvm::GlobalVar` allows it to be used as a key in STL tables. For
785  * other IR expressions, the user must specify the type of equality
786  * used (e.g. `std::unordered_set<T, StructuralHash, StructuralEqual>`
787  * or `std::unordered_set<T, ObjectPtrHash, ObjectPtrEqual>`).
788  */
789 template <>
790 struct std::hash<tvm::GlobalVar> {
791  std::size_t operator()(const tvm::GlobalVar& var) const {
792  return tvm::runtime::ObjectPtrHash()(var);
793  }
794 };
795 
796 template <>
797 struct std::equal_to<tvm::GlobalVar> {
798  bool operator()(const tvm::GlobalVar& var_a, const tvm::GlobalVar& var_b) const {
799  return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
800  }
801 };
802 #endif // TVM_IR_EXPR_H_
Value casting helpers.
Base type of all the expressions.
Definition: expr.h:51
TVM_FFI_DECLARE_OBJECT_INFO("ir.BaseExpr", BaseExprNode, Object)
static constexpr const uint32_t _type_child_slots
Definition: expr.h:68
static void RegisterReflection()
Definition: expr.h:59
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:66
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:57
Managed reference to BaseExprNode.
Definition: expr.h:76
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(BaseExpr, ObjectRef, BaseExprNode)
Boolean constant.
Definition: expr.h:566
Bool operator!() const
Definition: expr.h:569
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Bool, IntImm, IntImmNode)
Bool(bool value, Span span=Span())
Definition: expr.h:568
Constant floating point literals in the program.
Definition: expr.h:529
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.FloatImm", FloatImmNode, PrimExprNode)
double value
The constant value content.
Definition: expr.h:532
static void RegisterReflection()
Definition: expr.h:534
Managed reference class to FloatImmNode.
Definition: expr.h:546
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(FloatImm, PrimExpr, FloatImmNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(FloatImmNode)
FloatImm(DataType dtype, double value, Span span=Span())
Constructor.
Global variable that lives in the top-level module.
Definition: expr.h:455
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.GlobalVar", GlobalVarNode, RelaxExprNode)
int64_t SHash(int64_t init_hash, ffi::TypedFunction< int64_t(AnyView, int64_t, bool)> hash) const
Definition: expr.h:470
ffi::String name_hint
The name of the variable, this only acts as a hint.
Definition: expr.h:458
static void RegisterReflection()
Definition: expr.h:460
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:474
bool SEqual(const GlobalVarNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition: expr.h:465
Managed reference to GlobalVarNode.
Definition: expr.h:482
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(GlobalVar, RelaxExpr, GlobalVarNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(GlobalVarNode)
GlobalVar(ffi::String name_hint, Span span={})
Constant integer literals in the program.
Definition: expr.h:494
static void RegisterReflection()
Definition: expr.h:499
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.IntImm", IntImmNode, PrimExprNode)
int64_t value
the Internal value.
Definition: expr.h:497
Managed reference class to IntImmNode.
Definition: expr.h:511
TVM_DEFINE_OBJECT_REF_COW_METHOD(IntImmNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(IntImm, PrimExpr, IntImmNode)
IntImm(DataType dtype, int64_t value, Span span=Span())
Constructor.
Container of constant int that adds more constructors.
Definition: expr.h:601
Bool operator!=(Enum other) const
Definition: expr.h:657
Integer()
Definition: expr.h:603
Bool operator!=(int other) const
Definition: expr.h:651
Integer(Enum value)
Constructor from enum.
Definition: expr.h:627
Bool operator==(int other) const
Definition: expr.h:647
Integer(ffi::UnsafeInit tag)
constructor with UnsafeInit
Definition: expr.h:611
Integer(IntImm other)
Construct integer from int imm.
Definition: expr.h:620
int64_t IntValue() const
convert to int64_t
Definition: expr.h:642
Integer(ObjectPtr< IntImmNode > node)
constructor from node.
Definition: expr.h:607
Bool operator==(Enum other) const
Definition: expr.h:653
Integer & operator=(const IntImm &other)
Assign an expression to integer.
Definition: expr.h:635
Integer(int value, Span span=Span())
Construct integer from int value.
Definition: expr.h:615
Base class for other IR constructs that can be converted to PrimExpr. This is useful for the FFI to c...
Definition: expr.h:156
TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExprConvertible", PrimExprConvertibleNode, Object)
virtual ~PrimExprConvertibleNode()
Definition: expr.h:158
virtual PrimExpr ToPrimExpr() const =0
Managed reference to PrimExprConvertibleNode.
Definition: expr.h:167
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(PrimExprConvertible, ObjectRef, PrimExprConvertibleNode)
Base node of all primitive expressions.
Definition: expr.h:93
static constexpr const uint32_t _type_child_slots
Definition: expr.h:118
TVM_OBJECT_ENABLE_SCRIPT_PRINTER()
TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExpr", PrimExprNode, BaseExprNode)
DataType dtype
The runtime data type of the primitive expression.
Definition: expr.h:109
static void RegisterReflection()
Definition: expr.h:111
Reference to PrimExprNode.
Definition: expr.h:126
DataType dtype() const
Definition: expr.h:140
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(PrimExpr, BaseExpr, PrimExprNode)
PrimExpr(float value)
construct from float.
PrimExpr(int32_t value)
construct from integer.
static PrimExpr ConvertFallbackValue(ffi::String value)
construct from string to form a StringImm.
range over one dimension
Definition: expr.h:663
static void RegisterReflection()
Definition: expr.h:676
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Range", RangeNode, Object)
PrimExpr min
beginning of the node
Definition: expr.h:666
RangeNode(PrimExpr min, PrimExpr extent, Span span=Span())
Definition: expr.h:673
RangeNode()
constructor
Definition: expr.h:672
PrimExpr extent
the extend of range
Definition: expr.h:668
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:684
Span span
the location of this range in the source
Definition: expr.h:670
Range container
Definition: expr.h:690
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Range, ObjectRef, RangeNode)
static Range FromMinExtent(PrimExpr min, PrimExpr extent, Span span=Span())
construct a new range with min and extent The corresponding constructor is removed,...
Range(PrimExpr begin, PrimExpr end, Span span=Span())
constructor by begin and end
Base node of all non-primitive expressions.
Definition: expr.h:418
ffi::Optional< ObjectRef > struct_info_
Stores the result of structure information of the expression that encapsulate both static shape and r...
Definition: expr.h:425
TVM_FFI_DECLARE_OBJECT_INFO("ir.RelaxExpr", RelaxExprNode, BaseExprNode)
static void RegisterReflection()
Definition: expr.h:427
static constexpr const uint32_t _type_child_slots
Definition: expr.h:433
Managed reference to RelaxExprNode.
Definition: expr.h:441
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(RelaxExpr, BaseExpr, RelaxExprNode)
Definition: source_map.h:111
Runtime primitive data type.
Definition: data_type.h:47
static DataType Float(int bits, int lanes=1)
Construct an float type.
Definition: data_type.h:295
static DataType Bool(int lanes=1, bool is_scalable=false)
Construct a bool type.
Definition: data_type.h:387
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:278
IR/AST nodes for the unified type system in TVM.
Definition: repr_printer.h:91
constexpr bool use_default_type_traits_v< PrimExpr >
Definition: expr.h:177
constexpr bool use_default_type_traits_v< Bool >
Definition: expr.h:753
constexpr bool use_default_type_traits_v< Integer >
Definition: expr.h:733
constexpr bool use_default_type_traits_v< FloatImm >
Definition: expr.h:743
constexpr bool use_default_type_traits_v< IntImm >
Definition: expr.h:718
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
PrimExpr operator!=(PrimExpr a, PrimExpr b)
not_equal
PrimExpr max(PrimExpr a, PrimExpr b, Span span=Span())
take maximum of two values
PrimExpr operator/(PrimExpr a, PrimExpr b)
division operator
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
PrimExpr operator>>(PrimExpr a, PrimExpr b)
right shift operator
PrimExpr operator<(PrimExpr a, PrimExpr b)
less
PrimExpr operator|(PrimExpr a, PrimExpr b)
take bitwise or of two values
PrimExpr operator==(PrimExpr a, PrimExpr b)
equal
PrimExpr operator~(PrimExpr a)
take bitwise negation of two values
PrimExpr operator>=(PrimExpr a, PrimExpr b)
greater_equal
PrimExpr operator<=(PrimExpr a, PrimExpr b)
less_equal
PrimExpr operator*(PrimExpr a, PrimExpr b)
multiplication operator
PrimExpr operator&(PrimExpr a, PrimExpr b)
take bitwise and of two values
PrimExpr min(PrimExpr a, PrimExpr b, Span span=Span())
take minimum of two values
PrimExpr operator!(PrimExpr a)
not
PrimExpr operator^(PrimExpr a, PrimExpr b)
take bitwise xor of two values
PrimExpr operator-(PrimExpr a, PrimExpr b)
subtraction operator
PrimExpr operator||(PrimExpr a, PrimExpr b)
or
PrimExpr operator>(PrimExpr a, PrimExpr b)
greater
PrimExpr operator+(PrimExpr a, PrimExpr b)
add operator
PrimExpr operator<<(PrimExpr a, PrimExpr b)
left shift operator
PrimExpr operator&&(PrimExpr a, PrimExpr b)
and
A managed object in the TVM runtime.
Printer class to print repr string of each AST/IR nodes.
A map from source names to source code.
static TVM_FFI_INLINE Bool ConvertFallbackValue(int64_t value)
Definition: expr.h:757
static TVM_FFI_INLINE FloatImm ConvertFallbackValue(double value)
Definition: expr.h:747
static TVM_FFI_INLINE IntImm ConvertFallbackValue(int64_t value)
Definition: expr.h:723
static TVM_FFI_INLINE Integer ConvertFallbackValue(int64_t value)
Definition: expr.h:737
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(StrictBool value)
Definition: expr.h:761
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(ffi::String value)
Definition: expr.h:186
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(PrimExprConvertible value)
Definition: expr.h:189