Halide 22.0.0 Halide compiler and libraries

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