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