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  uint64_t SHash(uint64_t init_hash,
469  ffi::TypedFunction<uint64_t(AnyView, uint64_t, bool)> hash) const {
470  return hash(name_hint, init_hash, false);
471  }
472 
473  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar;
475 };
476 
481 class GlobalVar : public RelaxExpr {
482  public:
483  TVM_DLL explicit GlobalVar(ffi::String name_hint, Span span = {});
484 
487 };
488 
493 class IntImmNode : public PrimExprNode {
494  public:
496  int64_t value;
497 
498  static void RegisterReflection() {
499  namespace refl = tvm::ffi::reflection;
500  refl::ObjectDef<IntImmNode>().def_ro("value", &IntImmNode::value);
501  }
503 };
504 
510 class IntImm : public PrimExpr {
511  public:
518  TVM_DLL IntImm(DataType dtype, int64_t value, Span span = Span());
519 
522 };
523 
528 class FloatImmNode : public PrimExprNode {
529  public:
531  double value;
532 
533  static void RegisterReflection() {
534  namespace refl = tvm::ffi::reflection;
535  refl::ObjectDef<FloatImmNode>().def_ro("value", &FloatImmNode::value);
536  }
538 };
539 
545 class FloatImm : public PrimExpr {
546  public:
553  TVM_DLL FloatImm(DataType dtype, double value, Span span = Span());
554 
557 };
558 
565 class Bool : public IntImm {
566  public:
567  explicit Bool(bool value, Span span = Span()) : IntImm(DataType::Bool(), value, span) {}
568  Bool operator!() const { return Bool((*this)->value == 0); }
569  operator bool() const { return (*this)->value != 0; }
570 
572 };
573 
574 // Overload operators to make sure we have the most fine grained types.
575 inline Bool operator||(const Bool& a, bool b) { return Bool(a.operator bool() || b); }
576 inline Bool operator||(bool a, const Bool& b) { return Bool(a || b.operator bool()); }
577 inline Bool operator||(const Bool& a, const Bool& b) {
578  return Bool(a.operator bool() || b.operator bool());
579 }
580 inline Bool operator&&(const Bool& a, bool b) { return Bool(a.operator bool() && b); }
581 inline Bool operator&&(bool a, const Bool& b) { return Bool(a && b.operator bool()); }
582 inline Bool operator&&(const Bool& a, const Bool& b) {
583  return Bool(a.operator bool() && b.operator bool());
584 }
585 
586 inline bool operator==(const Bool& a, bool b) { return a.operator bool() == b; }
587 inline bool operator==(bool a, const Bool& b) { return a == b.operator bool(); }
588 inline bool operator==(const Bool& a, const Bool& b) {
589  return a.operator bool() == b.operator bool();
590 }
591 
600 class Integer : public IntImm {
601  public:
602  Integer() {}
606  explicit Integer(ObjectPtr<IntImmNode> node) : IntImm(node) {}
610  explicit Integer(ffi::UnsafeInit tag) : IntImm(tag) {}
614  Integer(int value, Span span = Span()) : IntImm(DataType::Int(32), value, span) {} // NOLINT(*)
619  Integer(IntImm other) : IntImm(std::move(other)) {} // NOLINT(*)
625  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
626  explicit Integer(Enum value) : Integer(static_cast<int>(value)) {
627  static_assert(std::is_same<int, typename std::underlying_type<Enum>::type>::value,
628  "declare enum to be enum int to use visitor");
629  }
634  Integer& operator=(const IntImm& other) {
635  data_ = ffi::details::ObjectUnsafe::ObjectPtrFromObjectRef<Object>(other);
636  return *this;
637  }
641  int64_t IntValue() const {
642  ICHECK(data_ != nullptr) << " Trying to reference a null Integer";
643  return (*this)->value;
644  }
645  // comparators
646  Bool operator==(int other) const {
647  if (data_ == nullptr) return Bool(false);
648  return Bool((*this)->value == other);
649  }
650  Bool operator!=(int other) const { return !(*this == other); }
651  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
652  Bool operator==(Enum other) const {
653  return *this == static_cast<int>(other);
654  }
655  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
656  Bool operator!=(Enum other) const {
657  return *this != static_cast<int>(other);
658  }
659 };
660 
662 class RangeNode : public Object {
663  public:
669  mutable Span span;
673  : min(min), extent(extent), span(span) {}
674 
675  static void RegisterReflection() {
676  namespace refl = tvm::ffi::reflection;
677  refl::ObjectDef<RangeNode>()
678  .def_ro("min", &RangeNode::min)
679  .def_ro("extent", &RangeNode::extent)
680  .def_ro("span", &RangeNode::span, refl::AttachFieldFlag::SEqHashIgnore());
681  }
682 
683  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
684 
686 };
687 
689 class Range : public ObjectRef {
690  public:
697  TVM_DLL Range(PrimExpr begin, PrimExpr end, Span span = Span());
708  static Range FromMinExtent(PrimExpr min, PrimExpr extent, Span span = Span());
709  // declare range.
711 };
712 
713 namespace ffi {
714 // Type traits to enable automatic conversion into IntImm, Integer, and Bool
715 // when called through the FFI
716 template <>
717 inline constexpr bool use_default_type_traits_v<IntImm> = false;
718 
719 // specialize to enable implicit conversion from const char*
720 template <>
721 struct TypeTraits<IntImm> : public ObjectRefWithFallbackTraitsBase<IntImm, int64_t> {
722  TVM_FFI_INLINE static IntImm ConvertFallbackValue(int64_t value) {
723  auto dtype =
725  ? DataType::Int(64)
726  : DataType::Int(32);
727  return IntImm(dtype, value);
728  }
729 };
730 
731 template <>
732 inline constexpr bool use_default_type_traits_v<Integer> = false;
733 
734 template <>
735 struct TypeTraits<Integer> : public ObjectRefWithFallbackTraitsBase<Integer, int64_t> {
736  TVM_FFI_INLINE static Integer ConvertFallbackValue(int64_t value) {
738  }
739 };
740 
741 template <>
742 inline constexpr bool use_default_type_traits_v<FloatImm> = false;
743 
744 template <>
745 struct TypeTraits<FloatImm> : public ObjectRefWithFallbackTraitsBase<FloatImm, double> {
746  TVM_FFI_INLINE static FloatImm ConvertFallbackValue(double value) {
747  return FloatImm(runtime::DataType::Float(32), value);
748  }
749 };
750 
751 template <>
752 inline constexpr bool use_default_type_traits_v<Bool> = false;
753 
754 template <>
755 struct TypeTraits<Bool> : public ObjectRefWithFallbackTraitsBase<Bool, int64_t> {
756  TVM_FFI_INLINE static Bool ConvertFallbackValue(int64_t value) { return Bool(value != 0); }
757 };
758 
759 // define automatic conversion from bool, int64_t, double to PrimExpr
760 TVM_FFI_INLINE PrimExpr TypeTraits<PrimExpr>::ConvertFallbackValue(StrictBool value) {
761  return IntImm(DataType::Bool(), value, Span());
762 }
763 
766 }
767 
770 }
771 } // namespace ffi
772 } // namespace tvm
773 
774 /* \brief Allow tvm.GLobalVar as key in STL tables
775  *
776  * For most IR expressions, it would be ambiguous whether the
777  * expression should follow reference equality or structural equality.
778  * This is not the case for variables, which do not contain nested
779  * internal structure, and are frequently used as keys in lookup
780  * tables.
781  *
782  * Providing `std::hash` and `std::equal_to` specializations for
783  * `tvm::GlobalVar` allows it to be used as a key in STL tables. For
784  * other IR expressions, the user must specify the type of equality
785  * used (e.g. `std::unordered_set<T, StructuralHash, StructuralEqual>`
786  * or `std::unordered_set<T, ObjectPtrHash, ObjectPtrEqual>`).
787  */
788 template <>
789 struct std::hash<tvm::GlobalVar> {
790  std::size_t operator()(const tvm::GlobalVar& var) const {
791  return tvm::runtime::ObjectPtrHash()(var);
792  }
793 };
794 
795 template <>
796 struct std::equal_to<tvm::GlobalVar> {
797  bool operator()(const tvm::GlobalVar& var_a, const tvm::GlobalVar& var_b) const {
798  return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
799  }
800 };
801 #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:565
Bool operator!() const
Definition: expr.h:568
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Bool, IntImm, IntImmNode)
Bool(bool value, Span span=Span())
Definition: expr.h:567
Constant floating point literals in the program.
Definition: expr.h:528
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.FloatImm", FloatImmNode, PrimExprNode)
double value
The constant value content.
Definition: expr.h:531
static void RegisterReflection()
Definition: expr.h:533
Managed reference class to FloatImmNode.
Definition: expr.h:545
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)
ffi::String name_hint
The name of the variable, this only acts as a hint.
Definition: expr.h:456
uint64_t SHash(uint64_t init_hash, ffi::TypedFunction< uint64_t(AnyView, uint64_t, bool)> hash) const
Definition: expr.h:468
static void RegisterReflection()
Definition: expr.h:458
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:473
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:481
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:493
static void RegisterReflection()
Definition: expr.h:498
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.IntImm", IntImmNode, PrimExprNode)
int64_t value
the Internal value.
Definition: expr.h:496
Managed reference class to IntImmNode.
Definition: expr.h:510
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:600
Bool operator!=(Enum other) const
Definition: expr.h:656
Integer()
Definition: expr.h:602
Bool operator!=(int other) const
Definition: expr.h:650
Integer(Enum value)
Constructor from enum.
Definition: expr.h:626
Bool operator==(int other) const
Definition: expr.h:646
Integer(ffi::UnsafeInit tag)
constructor with UnsafeInit
Definition: expr.h:610
Integer(IntImm other)
Construct integer from int imm.
Definition: expr.h:619
int64_t IntValue() const
convert to int64_t
Definition: expr.h:641
Integer(ObjectPtr< IntImmNode > node)
constructor from node.
Definition: expr.h:606
Bool operator==(Enum other) const
Definition: expr.h:652
Integer & operator=(const IntImm &other)
Assign an expression to integer.
Definition: expr.h:634
Integer(int value, Span span=Span())
Construct integer from int value.
Definition: expr.h:614
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:662
static void RegisterReflection()
Definition: expr.h:675
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Range", RangeNode, Object)
PrimExpr min
beginning of the node
Definition: expr.h:665
RangeNode(PrimExpr min, PrimExpr extent, Span span=Span())
Definition: expr.h:672
RangeNode()
constructor
Definition: expr.h:671
PrimExpr extent
the extend of range
Definition: expr.h:667
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:683
Span span
the location of this range in the source
Definition: expr.h:669
Range container
Definition: expr.h:689
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:291
static DataType Bool(int lanes=1, bool is_scalable=false)
Construct a bool type.
Definition: data_type.h:383
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:274
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:752
constexpr bool use_default_type_traits_v< Integer >
Definition: expr.h:732
constexpr bool use_default_type_traits_v< FloatImm >
Definition: expr.h:742
constexpr bool use_default_type_traits_v< IntImm >
Definition: expr.h:717
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:756
static TVM_FFI_INLINE FloatImm ConvertFallbackValue(double value)
Definition: expr.h:746
static TVM_FFI_INLINE IntImm ConvertFallbackValue(int64_t value)
Definition: expr.h:722
static TVM_FFI_INLINE Integer ConvertFallbackValue(int64_t value)
Definition: expr.h:736
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(StrictBool value)
Definition: expr.h:760
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