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 using tvm::String;
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 const char* _type_key = "ir.BaseExpr";
67 
68  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
69 
70  static constexpr const uint32_t _type_child_slots = 64;
72 };
73 
78 class BaseExpr : public ObjectRef {
79  public:
81 };
82 
95 class PrimExprNode : public BaseExprNode {
96  public:
112 
113  static void RegisterReflection() {
114  namespace refl = tvm::ffi::reflection;
115  refl::ObjectDef<PrimExprNode>().def_ro("dtype", &PrimExprNode::dtype);
116  }
117 
119 
120  static constexpr const char* _type_key = "ir.PrimExpr";
121  static constexpr const uint32_t _type_child_slots = 40;
123 };
124 
129 class PrimExpr : public BaseExpr {
130  public:
135  TVM_DLL PrimExpr(int32_t value); // NOLINT(*)
140  TVM_DLL PrimExpr(float value); // NOLINT(*)
141 
143  DataType dtype() const { return static_cast<const PrimExprNode*>(get())->dtype; }
144 
146 
151  TVM_DLL static PrimExpr ConvertFallbackValue(String value); // NOLINT(*)
152 };
153 
159 class PrimExprConvertibleNode : public Object {
160  public:
162  virtual PrimExpr ToPrimExpr() const = 0;
163 
164  static constexpr const char* _type_key = "ir.PrimExprConvertible";
166 };
167 
172 class PrimExprConvertible : public ObjectRef {
173  public:
175 };
176 
177 namespace ffi {
178 // define automatic conversion from bool, int64_t, double, String to PrimExpr
179 // These functions are declared early to avoid circular dependency
180 template <>
181 inline constexpr bool use_default_type_traits_v<PrimExpr> = false;
182 
183 template <>
184 struct TypeTraits<PrimExpr>
185  : public ObjectRefWithFallbackTraitsBase<PrimExpr, StrictBool, int64_t, double, String,
186  PrimExprConvertible> {
187  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(StrictBool value);
188  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(int64_t value);
189  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(double value);
190  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(String value) {
191  return PrimExpr::ConvertFallbackValue(value);
192  }
193  TVM_FFI_INLINE static PrimExpr ConvertFallbackValue(PrimExprConvertible value) {
194  return value->ToPrimExpr();
195  }
196 };
197 } // namespace ffi
198 
209 
220 
230 
241 
252 
263 
274 
285 
296 
307 
318 
329 
340 
350 
360 
369 
380 
391 
402 
412 
422 class RelaxExprNode : public BaseExprNode {
423  public:
429  mutable Optional<ObjectRef> struct_info_ = Optional<ObjectRef>();
430 
431  static void RegisterReflection() {
432  namespace refl = tvm::ffi::reflection;
433  refl::ObjectDef<RelaxExprNode>().def_ro("struct_info_", &RelaxExprNode::struct_info_,
434  refl::AttachFieldFlag::SEqHashIgnore());
435  }
436 
437  static constexpr const char* _type_key = "ir.RelaxExpr";
438  static constexpr const uint32_t _type_child_slots = 22;
440 };
441 
446 class RelaxExpr : public BaseExpr {
447  public:
449 };
450 
451 class GlobalVar;
460 class GlobalVarNode : public RelaxExprNode {
461  public:
463  String name_hint;
464 
465  static void RegisterReflection() {
466  namespace refl = tvm::ffi::reflection;
467  refl::ObjectDef<GlobalVarNode>().def_ro("name_hint", &GlobalVarNode::name_hint);
468  }
469 
470  bool SEqual(const GlobalVarNode* other,
471  ffi::TypedFunction<bool(AnyView, AnyView, bool, AnyView)> equal) const {
472  return equal(name_hint, other->name_hint, false, "name_hint");
473  }
474 
475  uint64_t SHash(uint64_t init_hash,
476  ffi::TypedFunction<uint64_t(AnyView, uint64_t, bool)> hash) const {
477  return hash(name_hint, init_hash, false);
478  }
479 
480  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindFreeVar;
481  static constexpr const char* _type_key = "ir.GlobalVar";
483 };
484 
489 class GlobalVar : public RelaxExpr {
490  public:
491  TVM_DLL explicit GlobalVar(String name_hint, Span span = {});
492 
495 };
496 
501 class IntImmNode : public PrimExprNode {
502  public:
504  int64_t value;
505 
506  static void RegisterReflection() {
507  namespace refl = tvm::ffi::reflection;
508  refl::ObjectDef<IntImmNode>().def_ro("value", &IntImmNode::value);
509  }
510 
511  static constexpr const char* _type_key = "ir.IntImm";
513 };
514 
520 class IntImm : public PrimExpr {
521  public:
528  TVM_DLL IntImm(DataType dtype, int64_t value, Span span = Span());
529 
532 };
533 
538 class FloatImmNode : public PrimExprNode {
539  public:
541  double value;
542 
543  static void RegisterReflection() {
544  namespace refl = tvm::ffi::reflection;
545  refl::ObjectDef<FloatImmNode>().def_ro("value", &FloatImmNode::value);
546  }
547 
548  static constexpr const char* _type_key = "ir.FloatImm";
550 };
551 
557 class FloatImm : public PrimExpr {
558  public:
565  TVM_DLL FloatImm(DataType dtype, double value, Span span = Span());
566 
569 };
570 
577 class Bool : public IntImm {
578  public:
579  explicit Bool(bool value, Span span = Span()) : IntImm(DataType::Bool(), value, span) {}
580  Bool operator!() const { return Bool((*this)->value == 0); }
581  operator bool() const { return (*this)->value != 0; }
582 
584 };
585 
586 // Overload operators to make sure we have the most fine grained types.
587 inline Bool operator||(const Bool& a, bool b) { return Bool(a.operator bool() || b); }
588 inline Bool operator||(bool a, const Bool& b) { return Bool(a || b.operator bool()); }
589 inline Bool operator||(const Bool& a, const Bool& b) {
590  return Bool(a.operator bool() || b.operator bool());
591 }
592 inline Bool operator&&(const Bool& a, bool b) { return Bool(a.operator bool() && b); }
593 inline Bool operator&&(bool a, const Bool& b) { return Bool(a && b.operator bool()); }
594 inline Bool operator&&(const Bool& a, const Bool& b) {
595  return Bool(a.operator bool() && b.operator bool());
596 }
597 
598 inline bool operator==(const Bool& a, bool b) { return a.operator bool() == b; }
599 inline bool operator==(bool a, const Bool& b) { return a == b.operator bool(); }
600 inline bool operator==(const Bool& a, const Bool& b) {
601  return a.operator bool() == b.operator bool();
602 }
603 
612 class Integer : public IntImm {
613  public:
614  Integer() {}
618  explicit Integer(ObjectPtr<Object> node) : IntImm(node) {}
622  Integer(int value, Span span = Span()) : IntImm(DataType::Int(32), value, span) {} // NOLINT(*)
627  Integer(IntImm other) : IntImm(std::move(other)) {} // NOLINT(*)
633  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
634  explicit Integer(Enum value) : Integer(static_cast<int>(value)) {
635  static_assert(std::is_same<int, typename std::underlying_type<Enum>::type>::value,
636  "declare enum to be enum int to use visitor");
637  }
642  Integer& operator=(const IntImm& other) {
643  data_ = ffi::details::ObjectUnsafe::ObjectPtrFromObjectRef<Object>(other);
644  return *this;
645  }
649  int64_t IntValue() const {
650  ICHECK(data_ != nullptr) << " Trying to reference a null Integer";
651  return (*this)->value;
652  }
653  // comparators
654  Bool operator==(int other) const {
655  if (data_ == nullptr) return Bool(false);
656  return Bool((*this)->value == other);
657  }
658  Bool operator!=(int other) const { return !(*this == other); }
659  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
660  Bool operator==(Enum other) const {
661  return *this == static_cast<int>(other);
662  }
663  template <typename Enum, typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
664  Bool operator!=(Enum other) const {
665  return *this != static_cast<int>(other);
666  }
667 };
668 
670 class RangeNode : public Object {
671  public:
677  mutable Span span;
681  : min(min), extent(extent), span(span) {}
682 
683  static void RegisterReflection() {
684  namespace refl = tvm::ffi::reflection;
685  refl::ObjectDef<RangeNode>()
686  .def_ro("min", &RangeNode::min)
687  .def_ro("extent", &RangeNode::extent)
688  .def_ro("span", &RangeNode::span, refl::AttachFieldFlag::SEqHashIgnore());
689  }
690 
691  static constexpr const char* _type_key = "ir.Range";
692  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
693 
695 };
696 
698 class Range : public ObjectRef {
699  public:
706  TVM_DLL Range(PrimExpr begin, PrimExpr end, Span span = Span());
717  static Range FromMinExtent(PrimExpr min, PrimExpr extent, Span span = Span());
718  // declare range.
720 };
721 
722 namespace ffi {
723 // Type traits to enable automatic conversion into IntImm, Integer, and Bool
724 // when called through the FFI
725 template <>
726 inline constexpr bool use_default_type_traits_v<IntImm> = false;
727 
728 // specialize to enable implicit conversion from const char*
729 template <>
730 struct TypeTraits<IntImm> : public ObjectRefWithFallbackTraitsBase<IntImm, int64_t> {
731  TVM_FFI_INLINE static IntImm ConvertFallbackValue(int64_t value) {
732  auto dtype =
734  ? DataType::Int(64)
735  : DataType::Int(32);
736  return IntImm(dtype, value);
737  }
738 };
739 
740 template <>
741 inline constexpr bool use_default_type_traits_v<Integer> = false;
742 
743 template <>
744 struct TypeTraits<Integer> : public ObjectRefWithFallbackTraitsBase<Integer, int64_t> {
745  TVM_FFI_INLINE static Integer ConvertFallbackValue(int64_t value) {
747  }
748 };
749 
750 template <>
751 inline constexpr bool use_default_type_traits_v<FloatImm> = false;
752 
753 template <>
754 struct TypeTraits<FloatImm> : public ObjectRefWithFallbackTraitsBase<FloatImm, double> {
755  TVM_FFI_INLINE static FloatImm ConvertFallbackValue(double value) {
756  return FloatImm(runtime::DataType::Float(32), value);
757  }
758 };
759 
760 template <>
761 inline constexpr bool use_default_type_traits_v<Bool> = false;
762 
763 template <>
764 struct TypeTraits<Bool> : public ObjectRefWithFallbackTraitsBase<Bool, int64_t> {
765  TVM_FFI_INLINE static Bool ConvertFallbackValue(int64_t value) { return Bool(value != 0); }
766 };
767 
768 // define automatic conversion from bool, int64_t, double to PrimExpr
769 TVM_FFI_INLINE PrimExpr TypeTraits<PrimExpr>::ConvertFallbackValue(StrictBool value) {
770  return IntImm(DataType::Bool(), value, Span());
771 }
772 
775 }
776 
779 }
780 } // namespace ffi
781 } // namespace tvm
782 
783 /* \brief Allow tvm.GLobalVar as key in STL tables
784  *
785  * For most IR expressions, it would be ambiguous whether the
786  * expression should follow reference equality or structural equality.
787  * This is not the case for variables, which do not contain nested
788  * internal structure, and are frequently used as keys in lookup
789  * tables.
790  *
791  * Providing `std::hash` and `std::equal_to` specializations for
792  * `tvm::GlobalVar` allows it to be used as a key in STL tables. For
793  * other IR expressions, the user must specify the type of equality
794  * used (e.g. `std::unordered_set<T, StructuralHash, StructuralEqual>`
795  * or `std::unordered_set<T, ObjectPtrHash, ObjectPtrEqual>`).
796  */
797 template <>
798 struct std::hash<tvm::GlobalVar> {
799  std::size_t operator()(const tvm::GlobalVar& var) const {
800  return tvm::runtime::ObjectPtrHash()(var);
801  }
802 };
803 
804 template <>
805 struct std::equal_to<tvm::GlobalVar> {
806  bool operator()(const tvm::GlobalVar& var_a, const tvm::GlobalVar& var_b) const {
807  return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
808  }
809 };
810 #endif // TVM_IR_EXPR_H_
Base type of all the expressions.
Definition: expr.h:51
static constexpr const char * _type_key
Definition: expr.h:66
static constexpr const uint32_t _type_child_slots
Definition: expr.h:70
static void RegisterReflection()
Definition: expr.h:59
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:68
TVM_DECLARE_BASE_OBJECT_INFO(BaseExprNode, Object)
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:57
Managed reference to BaseExprNode.
Definition: expr.h:78
TVM_DEFINE_OBJECT_REF_METHODS(BaseExpr, ObjectRef, BaseExprNode)
Boolean constant.
Definition: expr.h:577
Bool operator!() const
Definition: expr.h:580
Bool(bool value, Span span=Span())
Definition: expr.h:579
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(Bool, IntImm, IntImmNode)
Constant floating point literals in the program.
Definition: expr.h:538
TVM_DECLARE_FINAL_OBJECT_INFO(FloatImmNode, PrimExprNode)
double value
The constant value content.
Definition: expr.h:541
static constexpr const char * _type_key
Definition: expr.h:548
static void RegisterReflection()
Definition: expr.h:543
Managed reference class to FloatImmNode.
Definition: expr.h:557
TVM_DEFINE_OBJECT_REF_COW_METHOD(FloatImmNode)
TVM_DEFINE_OBJECT_REF_METHODS(FloatImm, PrimExpr, FloatImmNode)
FloatImm(DataType dtype, double value, Span span=Span())
Constructor.
Global variable that lives in the top-level module.
Definition: expr.h:460
TVM_DECLARE_FINAL_OBJECT_INFO(GlobalVarNode, RelaxExprNode)
uint64_t SHash(uint64_t init_hash, ffi::TypedFunction< uint64_t(AnyView, uint64_t, bool)> hash) const
Definition: expr.h:475
static void RegisterReflection()
Definition: expr.h:465
static constexpr const char * _type_key
Definition: expr.h:481
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:480
String name_hint
The name of the variable, this only acts as a hint.
Definition: expr.h:463
bool SEqual(const GlobalVarNode *other, ffi::TypedFunction< bool(AnyView, AnyView, bool, AnyView)> equal) const
Definition: expr.h:470
Managed reference to GlobalVarNode.
Definition: expr.h:489
GlobalVar(String name_hint, Span span={})
TVM_DEFINE_OBJECT_REF_COW_METHOD(GlobalVarNode)
TVM_DEFINE_OBJECT_REF_METHODS(GlobalVar, RelaxExpr, GlobalVarNode)
Constant integer literals in the program.
Definition: expr.h:501
TVM_DECLARE_FINAL_OBJECT_INFO(IntImmNode, PrimExprNode)
static void RegisterReflection()
Definition: expr.h:506
static constexpr const char * _type_key
Definition: expr.h:511
int64_t value
the Internal value.
Definition: expr.h:504
Managed reference class to IntImmNode.
Definition: expr.h:520
TVM_DEFINE_OBJECT_REF_COW_METHOD(IntImmNode)
TVM_DEFINE_OBJECT_REF_METHODS(IntImm, PrimExpr, IntImmNode)
IntImm(DataType dtype, int64_t value, Span span=Span())
Constructor.
Container of constant int that adds more constructors.
Definition: expr.h:612
Bool operator!=(Enum other) const
Definition: expr.h:664
Integer(ObjectPtr< Object > node)
constructor from node.
Definition: expr.h:618
Integer()
Definition: expr.h:614
Bool operator!=(int other) const
Definition: expr.h:658
Integer(Enum value)
Constructor from enum.
Definition: expr.h:634
Bool operator==(int other) const
Definition: expr.h:654
Integer(IntImm other)
Construct integer from int imm.
Definition: expr.h:627
int64_t IntValue() const
convert to int64_t
Definition: expr.h:649
Bool operator==(Enum other) const
Definition: expr.h:660
Integer & operator=(const IntImm &other)
Assign an expression to integer.
Definition: expr.h:642
Integer(int value, Span span=Span())
Construct integer from int value.
Definition: expr.h:622
Base class for other IR constructs that can be converted to PrimExpr. This is useful for the FFI to c...
Definition: expr.h:159
TVM_DECLARE_BASE_OBJECT_INFO(PrimExprConvertibleNode, Object)
static constexpr const char * _type_key
Definition: expr.h:164
virtual ~PrimExprConvertibleNode()
Definition: expr.h:161
virtual PrimExpr ToPrimExpr() const =0
Managed reference to PrimExprConvertibleNode.
Definition: expr.h:172
TVM_DEFINE_OBJECT_REF_METHODS(PrimExprConvertible, ObjectRef, PrimExprConvertibleNode)
Base node of all primitive expressions.
Definition: expr.h:95
static constexpr const uint32_t _type_child_slots
Definition: expr.h:121
TVM_OBJECT_ENABLE_SCRIPT_PRINTER()
DataType dtype
The runtime data type of the primitive expression.
Definition: expr.h:111
static constexpr const char * _type_key
Definition: expr.h:120
static void RegisterReflection()
Definition: expr.h:113
TVM_DECLARE_BASE_OBJECT_INFO(PrimExprNode, BaseExprNode)
Reference to PrimExprNode.
Definition: expr.h:129
DataType dtype() const
Definition: expr.h:143
TVM_DEFINE_OBJECT_REF_METHODS(PrimExpr, BaseExpr, PrimExprNode)
PrimExpr(float value)
construct from float.
PrimExpr(int32_t value)
construct from integer.
static PrimExpr ConvertFallbackValue(String value)
construct from string to form a StringImm.
range over one dimension
Definition: expr.h:670
static void RegisterReflection()
Definition: expr.h:683
PrimExpr min
beginning of the node
Definition: expr.h:673
RangeNode(PrimExpr min, PrimExpr extent, Span span=Span())
Definition: expr.h:680
static constexpr const char * _type_key
Definition: expr.h:691
TVM_DECLARE_FINAL_OBJECT_INFO(RangeNode, Object)
RangeNode()
constructor
Definition: expr.h:679
PrimExpr extent
the extend of range
Definition: expr.h:675
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: expr.h:692
Span span
the location of this range in the source
Definition: expr.h:677
Range container
Definition: expr.h:698
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
TVM_DEFINE_OBJECT_REF_METHODS(Range, ObjectRef, RangeNode)
Base node of all non-primitive expressions.
Definition: expr.h:422
static constexpr const char * _type_key
Definition: expr.h:437
Optional< ObjectRef > struct_info_
Stores the result of structure information of the expression that encapsulate both static shape and r...
Definition: expr.h:429
static void RegisterReflection()
Definition: expr.h:431
TVM_DECLARE_BASE_OBJECT_INFO(RelaxExprNode, BaseExprNode)
static constexpr const uint32_t _type_child_slots
Definition: expr.h:438
Managed reference to RelaxExprNode.
Definition: expr.h:446
TVM_DEFINE_OBJECT_REF_METHODS(RelaxExpr, BaseExpr, RelaxExprNode)
Definition: source_map.h:113
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:181
constexpr bool use_default_type_traits_v< Bool >
Definition: expr.h:761
constexpr bool use_default_type_traits_v< Integer >
Definition: expr.h:741
constexpr bool use_default_type_traits_v< FloatImm >
Definition: expr.h:751
constexpr bool use_default_type_traits_v< IntImm >
Definition: expr.h:726
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:765
static TVM_FFI_INLINE FloatImm ConvertFallbackValue(double value)
Definition: expr.h:755
static TVM_FFI_INLINE IntImm ConvertFallbackValue(int64_t value)
Definition: expr.h:731
static TVM_FFI_INLINE Integer ConvertFallbackValue(int64_t value)
Definition: expr.h:745
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(StrictBool value)
Definition: expr.h:769
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(String value)
Definition: expr.h:190
static TVM_FFI_INLINE PrimExpr ConvertFallbackValue(PrimExprConvertible value)
Definition: expr.h:193