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/node.h>
32 #include <tvm/runtime/object.h>
33 
34 #include <algorithm>
35 #include <functional>
36 #include <limits>
37 #include <string>
38 #include <type_traits>
39 
40 namespace tvm {
41 
42 // Forward-declare VirtualDevice to avoid circular imports.
43 class VirtualDevice;
44 
49 class BaseExprNode : public Object {
50  public:
55  mutable Span span;
56 
57  static void RegisterReflection() {
58  namespace refl = tvm::ffi::reflection;
59  // span do not participate in structural equal and hash.
60  refl::ObjectDef<BaseExprNode>().def_ro("span", &BaseExprNode::span, refl::DefaultValue(Span()),
61  refl::AttachFieldFlag::SEqHashIgnore());
62  }
63 
64  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
65 
66  static constexpr const uint32_t _type_child_slots = 64;
67  TVM_FFI_DECLARE_OBJECT_INFO("ir.BaseExpr", BaseExprNode, Object);
68 };
69 
74 class BaseExpr : public ObjectRef {
75  public:
77 };
78 
91 class PrimExprNode : public BaseExprNode {
92  public:
108 
109  static void RegisterReflection() {
110  namespace refl = tvm::ffi::reflection;
111  refl::ObjectDef<PrimExprNode>().def_ro("dtype", &PrimExprNode::dtype);
112  }
113 
115 
116  static constexpr const uint32_t _type_child_slots = 40;
118 };
119 
124 class PrimExpr : public BaseExpr {
125  public:
130  TVM_DLL PrimExpr(int32_t value); // NOLINT(*)
135  TVM_DLL PrimExpr(float value); // NOLINT(*)
136 
138  DataType dtype() const { return static_cast<const PrimExprNode*>(get())->dtype; }
139 
141 
146  TVM_DLL static PrimExpr ConvertFallbackValue(ffi::String value); // NOLINT(*)
147 };
148 
154 class PrimExprConvertibleNode : public Object {
155  public:
157  virtual PrimExpr ToPrimExpr() const = 0;
158  TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExprConvertible", PrimExprConvertibleNode, Object);
159 };
160 
165 class PrimExprConvertible : public ObjectRef {
166  public:
169 };
170 
171 namespace ffi {
172 // define automatic conversion from bool, int64_t, double, ffi::String to PrimExpr
173 // These functions are declared early to avoid circular dependency
174 template <>
175 inline constexpr bool use_default_type_traits_v<PrimExpr> = false;
176 
177 template <>
178 struct TypeTraits<PrimExpr>
179  : public ObjectRefWithFallbackTraitsBase<PrimExpr, StrictBool, int64_t, double, ffi::String,
180  PrimExprConvertible> {
181  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(StrictBool value);
182  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(int64_t value);
183  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(double value);
184  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(ffi::String value) {
185  return PrimExpr::ConvertFallbackValue(value);
186  }
187  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(PrimExprConvertible value) {
188  return value->ToPrimExpr();
189  }
190 };
191 } // namespace ffi
192 
203 
214 
224 
235 
246 
257 
268 
279 
290 
301 
312 
323 
334 
344 
354 
363 
374 
385 
396 
406 
416 class RelaxExprNode : public BaseExprNode {
417  public:
423  mutable ffi::Optional<ObjectRef> struct_info_ = ffi::Optional<ObjectRef>();
424 
425  static void RegisterReflection() {
426  namespace refl = tvm::ffi::reflection;
427  refl::ObjectDef<RelaxExprNode>().def_ro("struct_info_", &RelaxExprNode::struct_info_,
428  refl::AttachFieldFlag::SEqHashIgnore());
429  }
430 
431  static constexpr const uint32_t _type_child_slots = 22;
433 };
434 
439 class RelaxExpr : public BaseExpr {
440  public:
442 };
443 
444 class GlobalVar;
453 class GlobalVarNode : public RelaxExprNode {
454  public:
456  ffi::String name_hint;
457 
458  static void RegisterReflection() {
459  namespace refl = tvm::ffi::reflection;
460  refl::ObjectDef<GlobalVarNode>().def_ro("name_hint", &GlobalVarNode::name_hint);
461  }
462 
463  bool SEqual(const GlobalVarNode* other,
464  ffi::TypedFunction<bool(AnyView, AnyView, bool, AnyView)> equal) const {
465  return equal(name_hint, other->name_hint, false, "name_hint");
466  }
467 
468  int64_t SHash(int64_t init_hash, ffi::TypedFunction<int64_t(AnyView, int64_t, bool)> hash) const {
469  return hash(name_hint, init_hash, false);
470  }
471 
472  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar;
474 };
475 
480 class GlobalVar : public RelaxExpr {
481  public:
482  TVM_DLL explicit GlobalVar(ffi::String name_hint, Span span = {});
483 
486 };
487 
492 class IntImmNode : public PrimExprNode {
493  public:
495  int64_t value;
496 
497  static void RegisterReflection() {
498  namespace refl = tvm::ffi::reflection;
499  refl::ObjectDef<IntImmNode>().def_ro("value", &IntImmNode::value);
500  }
502 };
503 
509 class IntImm : public PrimExpr {
510  public:
517  TVM_DLL IntImm(DataType dtype, int64_t value, Span span = Span());
518 
521 };
522 
527 class FloatImmNode : public PrimExprNode {
528  public:
530  double value;
531 
532  static void RegisterReflection() {
533  namespace refl = tvm::ffi::reflection;
534  refl::ObjectDef<FloatImmNode>().def_ro("value", &FloatImmNode::value);
535  }
537 };
538 
544 class FloatImm : public PrimExpr {
545  public:
552  TVM_DLL FloatImm(DataType dtype, double value, Span span = Span());
553 
556 };
557 
564 class Bool : public IntImm {
565  public:
566  explicit Bool(bool value, Span span = Span()) : IntImm(DataType::Bool(), value, span) {}
567  Bool operator!() const { return Bool((*this)->value == 0); }
568  operator bool() const { return (*this)->value != 0; }
569 
571 };
572 
573 // Overload operators to make sure we have the most fine grained types.
574 inline Bool operator||(const Bool& a, bool b) { return Bool(a.operator bool() || b); }
575 inline Bool operator||(bool a, const Bool& b) { return Bool(a || b.operator bool()); }
576 inline Bool operator||(const Bool& a, const Bool& b) {
577  return Bool(a.operator bool() || b.operator bool());
578 }
579 inline Bool operator&&(const Bool& a, bool b) { return Bool(a.operator bool() && b); }
580 inline Bool operator&&(bool a, const Bool& b) { return Bool(a && b.operator bool()); }
581 inline Bool operator&&(const Bool& a, const Bool& b) {
582  return Bool(a.operator bool() && b.operator bool());
583 }
584 
585 inline bool operator==(const Bool& a, bool b) { return a.operator bool() == b; }
586 inline bool operator==(bool a, const Bool& b) { return a == b.operator bool(); }
587 inline bool operator==(const Bool& a, const Bool& b) {
588  return a.operator bool() == b.operator bool();
589 }
590 
599 class Integer : public IntImm {
600  public:
601  Integer() {}
605  explicit Integer(ObjectPtr<IntImmNode> node) : IntImm(node) {}
609  explicit Integer(ffi::UnsafeInit tag) : IntImm(tag) {}
613  Integer(int value, Span span = Span()) : IntImm(DataType::Int(32), value, span) {} // NOLINT(*)
618  Integer(IntImm other) : IntImm(std::move(other)) {} // NOLINT(*)
624  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
625  explicit Integer(Enum value) : Integer(static_cast<int>(value)) {
626  static_assert(std::is_same<int, typename std::underlying_type<Enum>::type>::value,
627  "declare enum to be enum int to use visitor");
628  }
633  Integer& operator=(const IntImm& other) {
634  data_ = ffi::details::ObjectUnsafe::ObjectPtrFromObjectRef<Object>(other);
635  return *this;
636  }
640  int64_t IntValue() const {
641  ICHECK(data_ != nullptr) << " Trying to reference a null Integer";
642  return (*this)->value;
643  }
644  // comparators
645  Bool operator==(int other) const {
646  if (data_ == nullptr) return Bool(false);
647  return Bool((*this)->value == other);
648  }
649  Bool operator!=(int other) const { return !(*this == other); }
650  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
651  Bool operator==(Enum other) const {
652  return *this == static_cast<int>(other);
653  }
654  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
655  Bool operator!=(Enum other) const {
656  return *this != static_cast<int>(other);
657  }
658 };
659 
661 class RangeNode : public Object {
662  public:
668  mutable Span span;
672  : min(min), extent(extent), span(span) {}
673 
674  static void RegisterReflection() {
675  namespace refl = tvm::ffi::reflection;
676  refl::ObjectDef<RangeNode>()
677  .def_ro("min", &RangeNode::min)
678  .def_ro("extent", &RangeNode::extent)
679  .def_ro("span", &RangeNode::span, refl::AttachFieldFlag::SEqHashIgnore());
680  }
681 
682  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
683 
685 };
686 
688 class Range : public ObjectRef {
689  public:
696  TVM_DLL Range(PrimExpr begin, PrimExpr end, Span span = Span());
707  static Range FromMinExtent(PrimExpr min, PrimExpr extent, Span span = Span());
708  // declare range.
710 };
711 
712 namespace ffi {
713 // Type traits to enable automatic conversion into IntImm, Integer, and Bool
714 // when called through the FFI
715 template <>
716 inline constexpr bool use_default_type_traits_v<IntImm> = false;
717 
718 // specialize to enable implicit conversion from const char*
719 template <>
720 struct TypeTraits<IntImm> : public ObjectRefWithFallbackTraitsBase<IntImm, int64_t> {
721  TVM_FFI_INLINE static IntImm ConvertFallbackValue(int64_t value) {
722  auto dtype =
724  ? DataType::Int(64)
725  : DataType::Int(32);
726  return IntImm(dtype, value);
727  }
728 };
729 
730 template <>
731 inline constexpr bool use_default_type_traits_v<Integer> = false;
732 
733 template <>
734 struct TypeTraits<Integer> : public ObjectRefWithFallbackTraitsBase<Integer, int64_t> {
735  TVM_FFI_INLINE static Integer ConvertFallbackValue(int64_t value) {
737  }
738 };
739 
740 template <>
741 inline constexpr bool use_default_type_traits_v<FloatImm> = false;
742 
743 template <>
744 struct TypeTraits<FloatImm> : public ObjectRefWithFallbackTraitsBase<FloatImm, double> {
745  TVM_FFI_INLINE static FloatImm ConvertFallbackValue(double value) {
746  return FloatImm(runtime::DataType::Float(32), value);
747  }
748 };
749 
750 template <>
751 inline constexpr bool use_default_type_traits_v<Bool> = false;
752 
753 template <>
754 struct TypeTraits<Bool> : public ObjectRefWithFallbackTraitsBase<Bool, int64_t> {
755  TVM_FFI_INLINE static Bool ConvertFallbackValue(int64_t value) { return Bool(value != 0); }
756 };
757 
758 // define automatic conversion from bool, int64_t, double to PrimExpr
759 TVM_FFI_INLINE PrimExpr TypeTraits<PrimExpr>::ConvertFallbackValue(StrictBool value) {
760  return IntImm(DataType::Bool(), value, Span());
761 }
762 
765 }
766 
769 }
770 } // namespace ffi
771 } // namespace tvm
772 
773 /* \brief Allow tvm.GLobalVar as key in STL tables
774  *
775  * For most IR expressions, it would be ambiguous whether the
776  * expression should follow reference equality or structural equality.
777  * This is not the case for variables, which do not contain nested
778  * internal structure, and are frequently used as keys in lookup
779  * tables.
780  *
781  * Providing `std::hash` and `std::equal_to` specializations for
782  * `tvm::GlobalVar` allows it to be used as a key in STL tables. For
783  * other IR expressions, the user must specify the type of equality
784  * used (e.g. `std::unordered_set<T, StructuralHash, StructuralEqual>`
785  * or `std::unordered_set<T, ObjectPtrHash, ObjectPtrEqual>`).
786  */
787 template <>
788 struct std::hash<tvm::GlobalVar> {
789  std::size_t operator()(const tvm::GlobalVar& var) const {
790  return tvm::runtime::ObjectPtrHash()(var);
791  }
792 };
793 
794 template <>
795 struct std::equal_to<tvm::GlobalVar> {
796  bool operator()(const tvm::GlobalVar& var_a, const tvm::GlobalVar& var_b) const {
797  return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
798  }
799 };
800 #endif // TVM_IR_EXPR_H_
Base type of all the expressions.
Definition: expr.h:49
TVM_FFI_DECLARE_OBJECT_INFO("ir.BaseExpr", BaseExprNode, Object)
static constexpr const uint32_t _type_child_slots
Definition: expr.h:66
static void RegisterReflection()
Definition: expr.h:57
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:64
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:55
Managed reference to BaseExprNode.
Definition: expr.h:74
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(BaseExpr, ObjectRef, BaseExprNode)
Boolean constant.
Definition: expr.h:564
Bool operator!() const
Definition: expr.h:567
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Bool, IntImm, IntImmNode)
Bool(bool value, Span span=Span())
Definition: expr.h:566
Constant floating point literals in the program.
Definition: expr.h:527
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.FloatImm", FloatImmNode, PrimExprNode)
double value
The constant value content.
Definition: expr.h:530
static void RegisterReflection()
Definition: expr.h:532
Managed reference class to FloatImmNode.
Definition: expr.h:544
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:453
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:468
ffi::String name_hint
The name of the variable, this only acts as a hint.
Definition: expr.h:456
static void RegisterReflection()
Definition: expr.h:458
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:472
bool SEqual(const GlobalVarNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition: expr.h:463
Managed reference to GlobalVarNode.
Definition: expr.h:480
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:492
static void RegisterReflection()
Definition: expr.h:497
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.IntImm", IntImmNode, PrimExprNode)
int64_t value
the Internal value.
Definition: expr.h:495
Managed reference class to IntImmNode.
Definition: expr.h:509
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:599
Bool operator!=(Enum other) const
Definition: expr.h:655
Integer()
Definition: expr.h:601
Bool operator!=(int other) const
Definition: expr.h:649
Integer(Enum value)
Constructor from enum.
Definition: expr.h:625
Bool operator==(int other) const
Definition: expr.h:645
Integer(ffi::UnsafeInit tag)
constructor with UnsafeInit
Definition: expr.h:609
Integer(IntImm other)
Construct integer from int imm.
Definition: expr.h:618
int64_t IntValue() const
convert to int64_t
Definition: expr.h:640
Integer(ObjectPtr< IntImmNode > node)
constructor from node.
Definition: expr.h:605
Bool operator==(Enum other) const
Definition: expr.h:651
Integer & operator=(const IntImm &other)
Assign an expression to integer.
Definition: expr.h:633
Integer(int value, Span span=Span())
Construct integer from int value.
Definition: expr.h:613
Base class for other IR constructs that can be converted to PrimExpr. This is useful for the FFI to c...
Definition: expr.h:154
TVM_FFI_DECLARE_OBJECT_INFO("ir.PrimExprConvertible", PrimExprConvertibleNode, Object)
virtual ~PrimExprConvertibleNode()
Definition: expr.h:156
virtual PrimExpr ToPrimExpr() const =0
Managed reference to PrimExprConvertibleNode.
Definition: expr.h:165
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(PrimExprConvertible, ObjectRef, PrimExprConvertibleNode)
Base node of all primitive expressions.
Definition: expr.h:91
static constexpr const uint32_t _type_child_slots
Definition: expr.h:116
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:107
static void RegisterReflection()
Definition: expr.h:109
Reference to PrimExprNode.
Definition: expr.h:124
DataType dtype() const
Definition: expr.h:138
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:661
static void RegisterReflection()
Definition: expr.h:674
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Range", RangeNode, Object)
PrimExpr min
beginning of the node
Definition: expr.h:664
RangeNode(PrimExpr min, PrimExpr extent, Span span=Span())
Definition: expr.h:671
RangeNode()
constructor
Definition: expr.h:670
PrimExpr extent
the extend of range
Definition: expr.h:666
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:682
Span span
the location of this range in the source
Definition: expr.h:668
Range container
Definition: expr.h:688
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: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
TVM_FFI_DECLARE_OBJECT_INFO("ir.RelaxExpr", RelaxExprNode, BaseExprNode)
static void RegisterReflection()
Definition: expr.h:425
static constexpr const uint32_t _type_child_slots
Definition: expr.h:431
Managed reference to RelaxExprNode.
Definition: expr.h:439
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:294
static DataType Bool(int lanes=1, bool is_scalable=false)
Construct a bool type.
Definition: data_type.h:386
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:277
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:175
constexpr bool use_default_type_traits_v< Bool >
Definition: expr.h:751
constexpr bool use_default_type_traits_v< Integer >
Definition: expr.h:731
constexpr bool use_default_type_traits_v< FloatImm >
Definition: expr.h:741
constexpr bool use_default_type_traits_v< IntImm >
Definition: expr.h:716
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 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
Definitions and helper macros for IR/AST nodes.
A managed object in the TVM runtime.
A map from source names to source code.
static TVM_FFI_INLINE Bool ConvertFallbackValue(int64_t value)
Definition: expr.h:755
static TVM_FFI_INLINE FloatImm ConvertFallbackValue(double value)
Definition: expr.h:745
static TVM_FFI_INLINE IntImm ConvertFallbackValue(int64_t value)
Definition: expr.h:721
static TVM_FFI_INLINE Integer ConvertFallbackValue(int64_t value)
Definition: expr.h:735
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(StrictBool value)
Definition: expr.h:759
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(ffi::String value)
Definition: expr.h:184
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(PrimExprConvertible value)
Definition: expr.h:187