Halide
Expr.h
Go to the documentation of this file.
1 #ifndef HALIDE_EXPR_H
2 #define HALIDE_EXPR_H
3 
4 /** \file
5  * Base classes for Halide expressions (\ref Halide::Expr) and statements (\ref Halide::Internal::Stmt)
6  */
7 
8 #include <string>
9 #include <vector>
10 
11 #include "IntrusivePtr.h"
12 #include "Type.h"
13 
14 namespace Halide {
15 
16 struct bfloat16_t;
17 struct float16_t;
18 
19 namespace Internal {
20 
21 class IRMutator;
22 class IRVisitor;
23 
24 /** All our IR node types get unique IDs for the purposes of RTTI */
25 enum class IRNodeType {
26  // Exprs, in order of strength. Code in IRMatch.h and the
27  // simplifier relies on this order for canonicalization of
28  // expressions, so you may need to update those modules if you
29  // change this list.
30  IntImm,
31  UIntImm,
32  FloatImm,
33  StringImm,
34  Broadcast,
35  Cast,
37  Variable,
38  Add,
39  Sub,
40  Mod,
41  Mul,
42  Div,
43  Min,
44  Max,
45  EQ,
46  NE,
47  LT,
48  LE,
49  GT,
50  GE,
51  And,
52  Or,
53  Not,
54  Select,
55  Load,
56  Ramp,
57  Call,
58  Let,
59  Shuffle,
61  // Stmts
62  LetStmt,
63  AssertStmt,
65  For,
66  Acquire,
67  Store,
68  Provide,
69  Allocate,
70  Free,
71  Realize,
72  Block,
73  Fork,
74  IfThenElse,
75  Evaluate,
76  Prefetch,
77  Atomic
78 };
79 
81 
82 /** The abstract base classes for a node in the Halide IR. */
83 struct IRNode {
84 
85  /** We use the visitor pattern to traverse IR nodes throughout the
86  * compiler, so we have a virtual accept method which accepts
87  * visitors.
88  */
89  virtual void accept(IRVisitor *v) const = 0;
91  : node_type(t) {
92  }
93  virtual ~IRNode() = default;
94 
95  /** These classes are all managed with intrusive reference
96  * counting, so we also track a reference count. It's mutable
97  * so that we can do reference counting even through const
98  * references to IR nodes.
99  */
101 
102  /** Each IR node subclass has a unique identifier. We can compare
103  * these values to do runtime type identification. We don't
104  * compile with rtti because that injects run-time type
105  * identification stuff everywhere (and often breaks when linking
106  * external libraries compiled without it), and we only want it
107  * for IR nodes. One might want to put this value in the vtable,
108  * but that adds another level of indirection, and for Exprs we
109  * have 32 free bits in between the ref count and the Type
110  * anyway, so this doesn't increase the memory footprint of an IR node.
111  */
113 };
114 
115 template<>
116 inline RefCount &ref_count<IRNode>(const IRNode *t) noexcept {
117  return t->ref_count;
118 }
119 
120 template<>
121 inline void destroy<IRNode>(const IRNode *t) {
122  delete t;
123 }
124 
125 /** IR nodes are split into expressions and statements. These are
126  similar to expressions and statements in C - expressions
127  represent some value and have some type (e.g. x + 3), and
128  statements are side-effecting pieces of code that do not
129  represent a value (e.g. assert(x > 3)) */
130 
131 /** A base class for statement nodes. They have no properties or
132  methods beyond base IR nodes for now. */
133 struct BaseStmtNode : public IRNode {
135  : IRNode(t) {
136  }
137  virtual Stmt mutate_stmt(IRMutator *v) const = 0;
138 };
139 
140 /** A base class for expression nodes. They all contain their types
141  * (e.g. Int(32), Float(32)) */
142 struct BaseExprNode : public IRNode {
144  : IRNode(t) {
145  }
146  virtual Expr mutate_expr(IRMutator *v) const = 0;
148 };
149 
150 /** We use the "curiously recurring template pattern" to avoid
151  duplicated code in the IR Nodes. These classes live between the
152  abstract base classes and the actual IR Nodes in the
153  inheritance hierarchy. It provides an implementation of the
154  accept function necessary for the visitor pattern to work, and
155  a concrete instantiation of a unique IRNodeType per class. */
156 template<typename T>
157 struct ExprNode : public BaseExprNode {
158  void accept(IRVisitor *v) const override;
159  Expr mutate_expr(IRMutator *v) const override;
161  : BaseExprNode(T::_node_type) {
162  }
163  ~ExprNode() override = default;
164 };
165 
166 template<typename T>
167 struct StmtNode : public BaseStmtNode {
168  void accept(IRVisitor *v) const override;
169  Stmt mutate_stmt(IRMutator *v) const override;
171  : BaseStmtNode(T::_node_type) {
172  }
173  ~StmtNode() override = default;
174 };
175 
176 /** IR nodes are passed around opaque handles to them. This is a
177  base class for those handles. It manages the reference count,
178  and dispatches visitors. */
179 struct IRHandle : public IntrusivePtr<const IRNode> {
181  IRHandle() = default;
182 
184  IRHandle(const IRNode *p)
185  : IntrusivePtr<const IRNode>(p) {
186  }
187 
188  /** Dispatch to the correct visitor method for this node. E.g. if
189  * this node is actually an Add node, then this will call
190  * IRVisitor::visit(const Add *) */
191  void accept(IRVisitor *v) const {
192  ptr->accept(v);
193  }
194 
195  /** Downcast this ir node to its actual type (e.g. Add, or
196  * Select). This returns nullptr if the node is not of the requested
197  * type. Example usage:
198  *
199  * if (const Add *add = node->as<Add>()) {
200  * // This is an add node
201  * }
202  */
203  template<typename T>
204  const T *as() const {
205  if (ptr && ptr->node_type == T::_node_type) {
206  return (const T *)ptr;
207  }
208  return nullptr;
209  }
210 
212  return ptr->node_type;
213  }
214 };
215 
216 /** Integer constants */
217 struct IntImm : public ExprNode<IntImm> {
219 
220  static const IntImm *make(Type t, int64_t value);
221 
223 };
224 
225 /** Unsigned integer constants */
226 struct UIntImm : public ExprNode<UIntImm> {
228 
229  static const UIntImm *make(Type t, uint64_t value);
230 
232 };
233 
234 /** Floating point constants */
235 struct FloatImm : public ExprNode<FloatImm> {
236  double value;
237 
238  static const FloatImm *make(Type t, double value);
239 
241 };
242 
243 /** String constants */
244 struct StringImm : public ExprNode<StringImm> {
245  std::string value;
246 
247  static const StringImm *make(const std::string &val);
248 
250 };
251 
252 } // namespace Internal
253 
254 /** A fragment of Halide syntax. It's implemented as reference-counted
255  * handle to a concrete expression node, but it's immutable, so you
256  * can treat it as a value type. */
257 struct Expr : public Internal::IRHandle {
258  /** Make an undefined expression */
260  Expr() = default;
261 
262  /** Make an expression from a concrete expression node pointer (e.g. Add) */
265  : IRHandle(n) {
266  }
267 
268  /** Make an expression representing numeric constants of various types. */
269  // @{
270  explicit Expr(int8_t x)
271  : IRHandle(Internal::IntImm::make(Int(8), x)) {
272  }
273  explicit Expr(int16_t x)
274  : IRHandle(Internal::IntImm::make(Int(16), x)) {
275  }
277  : IRHandle(Internal::IntImm::make(Int(32), x)) {
278  }
279  explicit Expr(int64_t x)
280  : IRHandle(Internal::IntImm::make(Int(64), x)) {
281  }
282  explicit Expr(uint8_t x)
283  : IRHandle(Internal::UIntImm::make(UInt(8), x)) {
284  }
285  explicit Expr(uint16_t x)
286  : IRHandle(Internal::UIntImm::make(UInt(16), x)) {
287  }
288  explicit Expr(uint32_t x)
289  : IRHandle(Internal::UIntImm::make(UInt(32), x)) {
290  }
291  explicit Expr(uint64_t x)
292  : IRHandle(Internal::UIntImm::make(UInt(64), x)) {
293  }
295  : IRHandle(Internal::FloatImm::make(Float(16), (double)x)) {
296  }
298  : IRHandle(Internal::FloatImm::make(BFloat(16), (double)x)) {
299  }
300  Expr(float x)
301  : IRHandle(Internal::FloatImm::make(Float(32), x)) {
302  }
303  explicit Expr(double x)
304  : IRHandle(Internal::FloatImm::make(Float(64), x)) {
305  }
306  // @}
307 
308  /** Make an expression representing a const string (i.e. a StringImm) */
309  Expr(const std::string &s)
310  : IRHandle(Internal::StringImm::make(s)) {
311  }
312 
313  /** Override get() to return a BaseExprNode * instead of an IRNode * */
315  const Internal::BaseExprNode *get() const {
316  return (const Internal::BaseExprNode *)ptr;
317  }
318 
319  /** Get the type of this expression node */
321  Type type() const {
322  return get()->type;
323  }
324 };
325 
326 /** This lets you use an Expr as a key in a map of the form
327  * map<Expr, Foo, ExprCompare> */
328 struct ExprCompare {
329  bool operator()(const Expr &a, const Expr &b) const {
330  return a.get() < b.get();
331  }
332 };
333 
334 /** A single-dimensional span. Includes all numbers between min and
335  * (min + extent - 1). */
336 struct Range {
338 
339  Range() = default;
340  Range(const Expr &min_in, const Expr &extent_in);
341 };
342 
343 /** A multi-dimensional box. The outer product of the elements */
344 typedef std::vector<Range> Region;
345 
346 /** An enum describing different address spaces to be used with Func::store_in. */
347 enum class MemoryType {
348  /** Let Halide select a storage type automatically */
349  Auto,
350 
351  /** Heap/global memory. Allocated using halide_malloc, or
352  * halide_device_malloc */
353  Heap,
354 
355  /** Stack memory. Allocated using alloca. Requires a constant
356  * size. Corresponds to per-thread local memory on the GPU. If all
357  * accesses are at constant coordinates, may be promoted into the
358  * register file at the discretion of the register allocator. */
359  Stack,
360 
361  /** Register memory. The allocation should be promoted into the
362  * register file. All stores must be at constant coordinates. May
363  * be spilled to the stack at the discretion of the register
364  * allocator. */
365  Register,
366 
367  /** Allocation is stored in GPU shared memory. Also known as
368  * "local" in OpenCL, and "threadgroup" in metal. Can be shared
369  * across GPU threads within the same block. */
370  GPUShared,
371 
372  /** Allocation is stored in GPU texture memory and accessed through
373  * hardware sampler */
374  GPUTexture,
375 
376  /** Allocate Locked Cache Memory to act as local memory */
377  LockedCache,
378  /** Vector Tightly Coupled Memory. HVX (Hexagon) local memory available on
379  * v65+. This memory has higher performance and lower power. Ideal for
380  * intermediate buffers. Necessary for vgather-vscatter instructions
381  * on Hexagon */
382  VTCM,
383 
384  /** AMX Tile register for X86. Any data that would be used in an AMX matrix
385  * multiplication must first be loaded into an AMX tile register. */
386  AMXTile,
387 };
388 
389 namespace Internal {
390 
391 /** An enum describing a type of loop traversal. Used in schedules,
392  * and in the For loop IR node. Serial is a conventional ordered for
393  * loop. Iterations occur in increasing order, and each iteration must
394  * appear to have finished before the next begins. Parallel, GPUBlock,
395  * and GPUThread are parallel and unordered: iterations may occur in
396  * any order, and multiple iterations may occur
397  * simultaneously. Vectorized and GPULane are parallel and
398  * synchronous: they act as if all iterations occur at the same time
399  * in lockstep. */
400 enum class ForType {
401  Serial,
402  Parallel,
403  Vectorized,
404  Unrolled,
405  Extern,
406  GPUBlock,
407  GPUThread,
408  GPULane,
409 };
410 
411 /** Check if for_type executes for loop iterations in parallel and unordered. */
412 bool is_unordered_parallel(ForType for_type);
413 
414 /** Returns true if for_type executes for loop iterations in parallel. */
415 bool is_parallel(ForType for_type);
416 
417 /** A reference-counted handle to a statement node. */
418 struct Stmt : public IRHandle {
419  Stmt() = default;
420  Stmt(const BaseStmtNode *n)
421  : IRHandle(n) {
422  }
423 
424  /** Override get() to return a BaseStmtNode * instead of an IRNode * */
426  const BaseStmtNode *get() const {
427  return (const Internal::BaseStmtNode *)ptr;
428  }
429 
430  /** This lets you use a Stmt as a key in a map of the form
431  * map<Stmt, Foo, Stmt::Compare> */
432  struct Compare {
433  bool operator()(const Stmt &a, const Stmt &b) const {
434  return a.ptr < b.ptr;
435  }
436  };
437 };
438 
439 } // namespace Internal
440 } // namespace Halide
441 
442 #endif
int32_t
signed __INT32_TYPE__ int32_t
Definition: runtime_internal.h:24
Halide::MemoryType::GPUTexture
@ GPUTexture
Allocation is stored in GPU texture memory and accessed through hardware sampler.
Halide::Internal::IRNodeType::Cast
@ Cast
Halide::Internal::ForType::Unrolled
@ Unrolled
Halide::Internal::destroy< IRNode >
void destroy< IRNode >(const IRNode *t)
Definition: Expr.h:121
Halide::Internal::ForType::GPULane
@ GPULane
Halide::Internal::ForType::Parallel
@ Parallel
Halide::Expr::Expr
Expr(int8_t x)
Make an expression representing numeric constants of various types.
Definition: Expr.h:270
Halide::Region
std::vector< Range > Region
A multi-dimensional box.
Definition: Expr.h:344
Halide::MemoryType::VTCM
@ VTCM
Vector Tightly Coupled Memory.
Halide::Internal::StrongestExprNodeType
constexpr IRNodeType StrongestExprNodeType
Definition: Expr.h:80
Halide::Range::Range
Range()=default
uint8_t
unsigned __INT8_TYPE__ uint8_t
Definition: runtime_internal.h:29
Halide::Internal::IRNodeType::Not
@ Not
Halide::Internal::IRNodeType::Select
@ Select
Halide::Internal::IRNodeType::Block
@ Block
Halide::Expr::Expr
Expr(uint64_t x)
Definition: Expr.h:291
uint16_t
unsigned __INT16_TYPE__ uint16_t
Definition: runtime_internal.h:27
Halide::Internal::IRNodeType::LE
@ LE
Halide::Internal::IRNodeType::For
@ For
Halide::Internal::BaseExprNode::type
Type type
Definition: Expr.h:147
Halide::Float
Type Float(int bits, int lanes=1)
Construct a floating-point type.
Definition: Type.h:536
Halide::Internal::IRVisitor
A base class for algorithms that need to recursively walk over the IR.
Definition: IRVisitor.h:19
Halide::Expr::Expr
Expr(uint16_t x)
Definition: Expr.h:285
Halide::Internal::IRNodeType
IRNodeType
All our IR node types get unique IDs for the purposes of RTTI.
Definition: Expr.h:25
Halide::Internal::IRNodeType::EQ
@ EQ
Halide::Internal::ForType::Vectorized
@ Vectorized
Halide::Internal::FloatImm
Floating point constants.
Definition: Expr.h:235
Halide::Internal::IRNodeType::Evaluate
@ Evaluate
Halide::Internal::IRNodeType::Or
@ Or
Halide::Internal::IRHandle::node_type
IRNodeType node_type() const
Definition: Expr.h:211
Halide::Internal::UIntImm::make
static const UIntImm * make(Type t, uint64_t value)
int8_t
signed __INT8_TYPE__ int8_t
Definition: runtime_internal.h:28
Halide::Internal::ForType
ForType
An enum describing a type of loop traversal.
Definition: Expr.h:400
Halide::Internal::IRNodeType::LetStmt
@ LetStmt
Halide::Internal::ExprNode
We use the "curiously recurring template pattern" to avoid duplicated code in the IR Nodes.
Definition: Expr.h:157
Halide::Internal::IRNodeType::LT
@ LT
Halide::Internal::IntImm
Integer constants.
Definition: Expr.h:217
Halide::Internal::IRNodeType::Provide
@ Provide
Halide::Internal::ExprNode::accept
void accept(IRVisitor *v) const override
We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept ...
Halide::Internal::ForType::GPUBlock
@ GPUBlock
Halide::Internal::IRNodeType::Min
@ Min
Halide::Expr::Expr
Expr(int16_t x)
Definition: Expr.h:273
Halide::MemoryType::LockedCache
@ LockedCache
Allocate Locked Cache Memory to act as local memory.
Halide::ExprCompare
This lets you use an Expr as a key in a map of the form map<Expr, Foo, ExprCompare>
Definition: Expr.h:328
Halide::Range
A single-dimensional span.
Definition: Expr.h:336
Halide::Internal::IRNodeType::GE
@ GE
Halide::Internal::Stmt::Stmt
Stmt(const BaseStmtNode *n)
Definition: Expr.h:420
Halide::Internal::is_unordered_parallel
bool is_unordered_parallel(ForType for_type)
Check if for_type executes for loop iterations in parallel and unordered.
Halide::Internal::IntrusivePtr
Intrusive shared pointers have a reference count (a RefCount object) stored in the class itself.
Definition: IntrusivePtr.h:68
Halide::Expr::Expr
Expr(float16_t x)
Definition: Expr.h:294
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition: Expr.h:418
Halide::Internal::UIntImm::_node_type
static const IRNodeType _node_type
Definition: Expr.h:231
uint64_t
unsigned __INT64_TYPE__ uint64_t
Definition: runtime_internal.h:23
Halide::Expr::Expr
Expr(double x)
Definition: Expr.h:303
Halide::Internal::IRNodeType::Variable
@ Variable
Halide::Type
Types in the halide type system.
Definition: Type.h:276
Halide::Expr::Expr
Expr(uint32_t x)
Definition: Expr.h:288
Halide::Internal::IRNodeType::ProducerConsumer
@ ProducerConsumer
Halide::Internal::BaseStmtNode
IR nodes are split into expressions and statements.
Definition: Expr.h:133
Halide::Internal::IRHandle::accept
void accept(IRVisitor *v) const
Dispatch to the correct visitor method for this node.
Definition: Expr.h:191
Halide::Internal::BaseStmtNode::mutate_stmt
virtual Stmt mutate_stmt(IRMutator *v) const =0
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19
Halide::Expr::Expr
HALIDE_ALWAYS_INLINE Expr()=default
Make an undefined expression.
Halide::Internal::ExprNode::ExprNode
ExprNode()
Definition: Expr.h:160
Halide::Internal::IRNode::accept
virtual void accept(IRVisitor *v) const =0
We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept ...
Halide::Internal::ExprNode::~ExprNode
~ExprNode() override=default
Halide::Internal::IRHandle::IRHandle
HALIDE_ALWAYS_INLINE IRHandle(const IRNode *p)
Definition: Expr.h:184
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Internal::IRNodeType::Fork
@ Fork
Halide::Internal::StringImm::make
static const StringImm * make(const std::string &val)
Halide::Internal::Stmt::Compare::operator()
bool operator()(const Stmt &a, const Stmt &b) const
Definition: Expr.h:433
Halide::Internal::IntrusivePtr< const IRNode >::ptr
const IRNode * ptr
Definition: IntrusivePtr.h:91
Halide::Internal::ForType::Serial
@ Serial
Halide::Internal::IRNodeType::Broadcast
@ Broadcast
Halide::Internal::IRNodeType::Free
@ Free
Halide::Internal::IRNodeType::Add
@ Add
Halide::Internal::Stmt::Stmt
Stmt()=default
Halide::Internal::ForType::GPUThread
@ GPUThread
Halide::Internal::ref_count< IRNode >
RefCount & ref_count< IRNode >(const IRNode *t) noexcept
Definition: Expr.h:116
Halide::Internal::StringImm::value
std::string value
Definition: Expr.h:245
Halide::Internal::IRNodeType::Sub
@ Sub
Halide::Internal::IRNodeType::FloatImm
@ FloatImm
Halide::Internal::StringImm::_node_type
static const IRNodeType _node_type
Definition: Expr.h:249
HALIDE_ALWAYS_INLINE
#define HALIDE_ALWAYS_INLINE
Definition: HalideRuntime.h:40
Halide::Internal::IRNodeType::AssertStmt
@ AssertStmt
Halide::Expr::type
HALIDE_ALWAYS_INLINE Type type() const
Get the type of this expression node.
Definition: Expr.h:321
Halide::Internal::IRNode::~IRNode
virtual ~IRNode()=default
Halide::Internal::IRNodeType::IntImm
@ IntImm
Halide::Internal::IRHandle::IRHandle
HALIDE_ALWAYS_INLINE IRHandle()=default
Halide::UInt
Type UInt(int bits, int lanes=1)
Constructing an unsigned integer type.
Definition: Type.h:531
Halide::Internal::ForType::Extern
@ Extern
Halide::Internal::IRNodeType::And
@ And
int64_t
signed __INT64_TYPE__ int64_t
Definition: runtime_internal.h:22
Halide::MemoryType::Register
@ Register
Register memory.
Halide::Internal::IRNodeType::Max
@ Max
Halide::Internal::BaseExprNode
A base class for expression nodes.
Definition: Expr.h:142
Halide::Expr::Expr
Expr(int64_t x)
Definition: Expr.h:279
Halide::Internal::BaseExprNode::mutate_expr
virtual Expr mutate_expr(IRMutator *v) const =0
Halide::BFloat
Type BFloat(int bits, int lanes=1)
Construct a floating-point type in the bfloat format.
Definition: Type.h:541
Type.h
Halide::Internal::IntImm::make
static const IntImm * make(Type t, int64_t value)
Halide::Internal::IRNodeType::VectorReduce
@ VectorReduce
Halide::Internal::IRNode
The abstract base classes for a node in the Halide IR.
Definition: Expr.h:83
Halide::Internal::StmtNode::StmtNode
StmtNode()
Definition: Expr.h:170
Halide::Internal::IRMutator
A base class for passes over the IR which modify it (e.g.
Definition: IRMutator.h:26
Halide::Internal::IRNodeType::Let
@ Let
Halide::Internal::is_parallel
bool is_parallel(ForType for_type)
Returns true if for_type executes for loop iterations in parallel.
Halide::Internal::IntImm::value
int64_t value
Definition: Expr.h:218
Halide::Internal::IRNode::ref_count
RefCount ref_count
These classes are all managed with intrusive reference counting, so we also track a reference count.
Definition: Expr.h:100
Halide::Internal::IRNode::IRNode
IRNode(IRNodeType t)
Definition: Expr.h:90
Halide::bfloat16_t
Class that provides a type that implements half precision floating point using the bfloat16 format.
Definition: Float16.h:158
Halide::MemoryType::GPUShared
@ GPUShared
Allocation is stored in GPU shared memory.
Halide::Internal::IRNodeType::NE
@ NE
Halide::Internal::FloatImm::make
static const FloatImm * make(Type t, double value)
Halide::Internal::IRNodeType::Reinterpret
@ Reinterpret
Halide::Internal::Stmt::get
const HALIDE_ALWAYS_INLINE BaseStmtNode * get() const
Override get() to return a BaseStmtNode * instead of an IRNode *.
Definition: Expr.h:426
Halide::Internal::IRNodeType::IfThenElse
@ IfThenElse
Halide::Internal::BaseStmtNode::BaseStmtNode
BaseStmtNode(IRNodeType t)
Definition: Expr.h:134
Halide::Internal::IRNodeType::Mul
@ Mul
Halide::Internal::FloatImm::value
double value
Definition: Expr.h:236
Halide::Expr::Expr
HALIDE_ALWAYS_INLINE Expr(const Internal::BaseExprNode *n)
Make an expression from a concrete expression node pointer (e.g.
Definition: Expr.h:264
Halide::Internal::IRNodeType::GT
@ GT
Halide::ExprCompare::operator()
bool operator()(const Expr &a, const Expr &b) const
Definition: Expr.h:329
Halide::Internal::StmtNode::~StmtNode
~StmtNode() override=default
Halide::Internal::IRNodeType::UIntImm
@ UIntImm
Halide::Internal::IRNodeType::StringImm
@ StringImm
Halide::Internal::IRNodeType::Ramp
@ Ramp
Halide::MemoryType::Auto
@ Auto
Let Halide select a storage type automatically.
Halide::Internal::IRHandle
IR nodes are passed around opaque handles to them.
Definition: Expr.h:179
Halide::Internal::IRNode::node_type
IRNodeType node_type
Each IR node subclass has a unique identifier.
Definition: Expr.h:112
Halide::Internal::RefCount
A class representing a reference count to be used with IntrusivePtr.
Definition: IntrusivePtr.h:19
Halide::MemoryType::AMXTile
@ AMXTile
AMX Tile register for X86.
Halide::Expr::Expr
Expr(uint8_t x)
Definition: Expr.h:282
int16_t
signed __INT16_TYPE__ int16_t
Definition: runtime_internal.h:26
Halide::Expr
A fragment of Halide syntax.
Definition: Expr.h:257
Halide::Internal::IRNodeType::Acquire
@ Acquire
Halide::float16_t
Class that provides a type that implements half precision floating point (IEEE754 2008 binary16) in s...
Definition: Float16.h:17
Halide::MemoryType
MemoryType
An enum describing different address spaces to be used with Func::store_in.
Definition: Expr.h:347
Halide::Expr::Expr
Expr(const std::string &s)
Make an expression representing a const string (i.e.
Definition: Expr.h:309
Halide::Internal::Atomic
Lock all the Store nodes in the body statement.
Definition: IR.h:911
Halide::Internal::IRNodeType::Realize
@ Realize
Halide::Internal::IntImm::_node_type
static const IRNodeType _node_type
Definition: Expr.h:222
Halide::Internal::IRNodeType::Mod
@ Mod
Halide::Expr::get
const HALIDE_ALWAYS_INLINE Internal::BaseExprNode * get() const
Override get() to return a BaseExprNode * instead of an IRNode *.
Definition: Expr.h:315
uint32_t
unsigned __INT32_TYPE__ uint32_t
Definition: runtime_internal.h:25
Halide::Internal::IRNodeType::Shuffle
@ Shuffle
Halide::MemoryType::Stack
@ Stack
Stack memory.
Halide::Internal::FloatImm::_node_type
static const IRNodeType _node_type
Definition: Expr.h:240
Halide::Internal::StmtNode::accept
void accept(IRVisitor *v) const override
We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept ...
Halide::Internal::UIntImm
Unsigned integer constants.
Definition: Expr.h:226
Halide::Internal::StmtNode
Definition: Expr.h:167
Halide::MemoryType::Heap
@ Heap
Heap/global memory.
Halide::Internal::IRNodeType::Store
@ Store
Halide::Internal::IRNodeType::Prefetch
@ Prefetch
Halide::Internal::ExprNode::mutate_expr
Expr mutate_expr(IRMutator *v) const override
Halide::Internal::IRNodeType::Allocate
@ Allocate
Halide::Internal::IRNodeType::Div
@ Div
IntrusivePtr.h
Halide::Range::extent
Expr extent
Definition: Expr.h:337
Halide::Expr::Expr
Expr(int32_t x)
Definition: Expr.h:276
Halide::Internal::Stmt::Compare
This lets you use a Stmt as a key in a map of the form map<Stmt, Foo, Stmt::Compare>
Definition: Expr.h:432
Halide::Internal::BaseExprNode::BaseExprNode
BaseExprNode(IRNodeType t)
Definition: Expr.h:143
Halide::Internal::IRNodeType::Call
@ Call
Halide::Internal::IRHandle::as
const T * as() const
Downcast this ir node to its actual type (e.g.
Definition: Expr.h:204
Halide::Internal::UIntImm::value
uint64_t value
Definition: Expr.h:227
Halide::Expr::Expr
Expr(float x)
Definition: Expr.h:300
Halide::Expr::Expr
Expr(bfloat16_t x)
Definition: Expr.h:297
Halide::Internal::StringImm
String constants.
Definition: Expr.h:244
Halide::Range::min
Expr min
Definition: Expr.h:337
Halide::Internal::StmtNode::mutate_stmt
Stmt mutate_stmt(IRMutator *v) const override
Halide::Internal::IRNodeType::Load
@ Load
Halide::Int
Type Int(int bits, int lanes=1)
Constructing a signed integer type.
Definition: Type.h:526