Halide 22.0.0 Halide compiler and libraries

IRVisitor.h
Go to the documentation of this file.
1#ifndef HALIDE_IR_VISITOR_H
2#define HALIDE_IR_VISITOR_H
3
4#include <set>
5
6#include "IR.h"
7
8/** \file
9 * Defines the base class for things that recursively walk over the IR
10 */
11
12 namespace Halide {
13 namespace Internal {
14
15/** A base class for algorithms that need to recursively walk over the
16 * IR. The default implementations just recursively walk over the
17 * children. Override the ones you care about.
18 */
19 class IRVisitor {
20 public:
21 IRVisitor() = default;
22 virtual ~IRVisitor() = default;
23
24 protected:
25 // ExprNode<> and StmtNode<> are allowed to call visit (to implement accept())
26 template<typename T>
27 friend struct ExprNode;
28
29 template<typename T>
30 friend struct StmtNode;
31
32 virtual void visit(const IntImm *);
33 virtual void visit(const UIntImm *);
34 virtual void visit(const FloatImm *);
35 virtual void visit(const StringImm *);
36 virtual void visit(const Cast *);
37 virtual void visit(const Reinterpret *);
38 virtual void visit(const Variable *);
39 virtual void visit(const Add *);
40 virtual void visit(const Sub *);
41 virtual void visit(const Mul *);
42 virtual void visit(const Div *);
43 virtual void visit(const Mod *);
44 virtual void visit(const Min *);
45 virtual void visit(const Max *);
46 virtual void visit(const EQ *);
47 virtual void visit(const NE *);
48 virtual void visit(const LT *);
49 virtual void visit(const LE *);
50 virtual void visit(const GT *);
51 virtual void visit(const GE *);
52 virtual void visit(const And *);
53 virtual void visit(const Or *);
54 virtual void visit(const Not *);
55 virtual void visit(const Select *);
56 virtual void visit(const Load *);
57 virtual void visit(const Ramp *);
58 virtual void visit(const Broadcast *);
59 virtual void visit(const Call *);
60 virtual void visit(const Let *);
61 virtual void visit(const LetStmt *);
62 virtual void visit(const AssertStmt *);
63 virtual void visit(const ProducerConsumer *);
64 virtual void visit(const For *);
65 virtual void visit(const Store *);
66 virtual void visit(const Provide *);
67 virtual void visit(const Allocate *);
68 virtual void visit(const Free *);
69 virtual void visit(const Realize *);
70 virtual void visit(const Block *);
71 virtual void visit(const IfThenElse *);
72 virtual void visit(const Evaluate *);
73 virtual void visit(const Shuffle *);
74 virtual void visit(const VectorReduce *);
75 virtual void visit(const Prefetch *);
76 virtual void visit(const Fork *);
77 virtual void visit(const Acquire *);
78 virtual void visit(const Atomic *);
79 virtual void visit(const HoistedStorage *);
80};
81
82/** A base class for algorithms that walk recursively over the IR
83 * without visiting the same node twice. This is for passes that are
84 * capable of interpreting the IR as a DAG instead of a tree. */
85 class IRGraphVisitor : public IRVisitor {
86 protected:
87 /** By default these methods add the node to the visited set, and
88 * return whether or not it was already there. If it wasn't there,
89 * it delegates to the appropriate visit method. You can override
90 * them if you like. */
91 // @{
92 virtual void include(const Expr &);
93 virtual void include(const Stmt &);
94 // @}
95
96 private:
97 /** The nodes visited so far. Only includes nodes with a ref count greater
98 * than one, because we know that nodes with a ref count of 1 will only be
99 * visited once if their parents are only visited once. */
100 std::set<const IRNode *> visited;
101
102 protected:
103 /** These methods should call 'include' on the children to only
104 * visit them if they haven't been visited already. */
105 // @{
106 void visit(const IntImm *) override;
107 void visit(const UIntImm *) override;
108 void visit(const FloatImm *) override;
109 void visit(const StringImm *) override;
110 void visit(const Cast *) override;
111 void visit(const Reinterpret *) override;
112 void visit(const Variable *) override;
113 void visit(const Add *) override;
114 void visit(const Sub *) override;
115 void visit(const Mul *) override;
116 void visit(const Div *) override;
117 void visit(const Mod *) override;
118 void visit(const Min *) override;
119 void visit(const Max *) override;
120 void visit(const EQ *) override;
121 void visit(const NE *) override;
122 void visit(const LT *) override;
123 void visit(const LE *) override;
124 void visit(const GT *) override;
125 void visit(const GE *) override;
126 void visit(const And *) override;
127 void visit(const Or *) override;
128 void visit(const Not *) override;
129 void visit(const Select *) override;
130 void visit(const Load *) override;
131 void visit(const Ramp *) override;
132 void visit(const Broadcast *) override;
133 void visit(const Call *) override;
134 void visit(const Let *) override;
135 void visit(const LetStmt *) override;
136 void visit(const AssertStmt *) override;
137 void visit(const ProducerConsumer *) override;
138 void visit(const For *) override;
139 void visit(const Store *) override;
140 void visit(const Provide *) override;
141 void visit(const Allocate *) override;
142 void visit(const Free *) override;
143 void visit(const Realize *) override;
144 void visit(const Block *) override;
145 void visit(const IfThenElse *) override;
146 void visit(const Evaluate *) override;
147 void visit(const Shuffle *) override;
148 void visit(const VectorReduce *) override;
149 void visit(const Prefetch *) override;
150 void visit(const Acquire *) override;
151 void visit(const Fork *) override;
152 void visit(const Atomic *) override;
153 void visit(const HoistedStorage *) override;
154 // @}
155};
156
157/** A visitor/mutator capable of passing arbitrary arguments to the
158 * visit methods using CRTP and returning any types from them. All
159 * Expr visitors must have the same signature, and all Stmt visitors
160 * must have the same signature. Does not have default implementations
161 * of the visit methods. */
162 template<typename T, typename ExprRet, typename StmtRet>
163 class VariadicVisitor {
164 private:
165 template<typename... Args>
166 ExprRet dispatch_expr(const BaseExprNode *node, Args &&...args) {
167 if (node == nullptr) {
168 return ExprRet{};
169 }
170 switch (node->node_type) {
171 case IRNodeType::IntImm:
172 return ((T *)this)->visit((const IntImm *)node, std::forward<Args>(args)...);
173 case IRNodeType::UIntImm:
174 return ((T *)this)->visit((const UIntImm *)node, std::forward<Args>(args)...);
175 case IRNodeType::FloatImm:
176 return ((T *)this)->visit((const FloatImm *)node, std::forward<Args>(args)...);
177 case IRNodeType::StringImm:
178 return ((T *)this)->visit((const StringImm *)node, std::forward<Args>(args)...);
179 case IRNodeType::Broadcast:
180 return ((T *)this)->visit((const Broadcast *)node, std::forward<Args>(args)...);
181 case IRNodeType::Cast:
182 return ((T *)this)->visit((const Cast *)node, std::forward<Args>(args)...);
183 case IRNodeType::Reinterpret:
184 return ((T *)this)->visit((const Reinterpret *)node, std::forward<Args>(args)...);
185 case IRNodeType::Variable:
186 return ((T *)this)->visit((const Variable *)node, std::forward<Args>(args)...);
187 case IRNodeType::Add:
188 return ((T *)this)->visit((const Add *)node, std::forward<Args>(args)...);
189 case IRNodeType::Sub:
190 return ((T *)this)->visit((const Sub *)node, std::forward<Args>(args)...);
191 case IRNodeType::Mod:
192 return ((T *)this)->visit((const Mod *)node, std::forward<Args>(args)...);
193 case IRNodeType::Mul:
194 return ((T *)this)->visit((const Mul *)node, std::forward<Args>(args)...);
195 case IRNodeType::Div:
196 return ((T *)this)->visit((const Div *)node, std::forward<Args>(args)...);
197 case IRNodeType::Min:
198 return ((T *)this)->visit((const Min *)node, std::forward<Args>(args)...);
199 case IRNodeType::Max:
200 return ((T *)this)->visit((const Max *)node, std::forward<Args>(args)...);
201 case IRNodeType::EQ:
202 return ((T *)this)->visit((const EQ *)node, std::forward<Args>(args)...);
203 case IRNodeType::NE:
204 return ((T *)this)->visit((const NE *)node, std::forward<Args>(args)...);
205 case IRNodeType::LT:
206 return ((T *)this)->visit((const LT *)node, std::forward<Args>(args)...);
207 case IRNodeType::LE:
208 return ((T *)this)->visit((const LE *)node, std::forward<Args>(args)...);
209 case IRNodeType::GT:
210 return ((T *)this)->visit((const GT *)node, std::forward<Args>(args)...);
211 case IRNodeType::GE:
212 return ((T *)this)->visit((const GE *)node, std::forward<Args>(args)...);
213 case IRNodeType::And:
214 return ((T *)this)->visit((const And *)node, std::forward<Args>(args)...);
215 case IRNodeType::Or:
216 return ((T *)this)->visit((const Or *)node, std::forward<Args>(args)...);
217 case IRNodeType::Not:
218 return ((T *)this)->visit((const Not *)node, std::forward<Args>(args)...);
219 case IRNodeType::Select:
220 return ((T *)this)->visit((const Select *)node, std::forward<Args>(args)...);
221 case IRNodeType::Load:
222 return ((T *)this)->visit((const Load *)node, std::forward<Args>(args)...);
223 case IRNodeType::Ramp:
224 return ((T *)this)->visit((const Ramp *)node, std::forward<Args>(args)...);
225 case IRNodeType::Call:
226 return ((T *)this)->visit((const Call *)node, std::forward<Args>(args)...);
227 case IRNodeType::Let:
228 return ((T *)this)->visit((const Let *)node, std::forward<Args>(args)...);
229 case IRNodeType::Shuffle:
230 return ((T *)this)->visit((const Shuffle *)node, std::forward<Args>(args)...);
231 case IRNodeType::VectorReduce:
232 return ((T *)this)->visit((const VectorReduce *)node, std::forward<Args>(args)...);
233 // Explicitly list the Stmt types rather than using a
234 // default case so that when new IR nodes are added we
235 // don't miss them here.
236 case IRNodeType::LetStmt:
237 case IRNodeType::AssertStmt:
238 case IRNodeType::ProducerConsumer:
239 case IRNodeType::For:
240 case IRNodeType::Acquire:
241 case IRNodeType::Store:
242 case IRNodeType::Provide:
243 case IRNodeType::Allocate:
244 case IRNodeType::Free:
245 case IRNodeType::Realize:
246 case IRNodeType::Block:
247 case IRNodeType::Fork:
248 case IRNodeType::IfThenElse:
249 case IRNodeType::Evaluate:
250 case IRNodeType::Prefetch:
251 case IRNodeType::Atomic:
252 case IRNodeType::HoistedStorage:
253 internal_error << "Unreachable";
254 }
255 return ExprRet{};
256 }
257
258 template<typename... Args>
259 StmtRet dispatch_stmt(const BaseStmtNode *node, Args &&...args) {
260 if (node == nullptr) {
261 return StmtRet{};
262 }
263 switch (node->node_type) {
264 case IRNodeType::IntImm:
265 case IRNodeType::UIntImm:
266 case IRNodeType::FloatImm:
267 case IRNodeType::StringImm:
268 case IRNodeType::Broadcast:
269 case IRNodeType::Cast:
270 case IRNodeType::Reinterpret:
271 case IRNodeType::Variable:
272 case IRNodeType::Add:
273 case IRNodeType::Sub:
274 case IRNodeType::Mod:
275 case IRNodeType::Mul:
276 case IRNodeType::Div:
277 case IRNodeType::Min:
278 case IRNodeType::Max:
279 case IRNodeType::EQ:
280 case IRNodeType::NE:
281 case IRNodeType::LT:
282 case IRNodeType::LE:
283 case IRNodeType::GT:
284 case IRNodeType::GE:
285 case IRNodeType::And:
286 case IRNodeType::Or:
287 case IRNodeType::Not:
288 case IRNodeType::Select:
289 case IRNodeType::Load:
290 case IRNodeType::Ramp:
291 case IRNodeType::Call:
292 case IRNodeType::Let:
293 case IRNodeType::Shuffle:
294 case IRNodeType::VectorReduce:
295 internal_error << "Unreachable";
296 break;
297 case IRNodeType::LetStmt:
298 return ((T *)this)->visit((const LetStmt *)node, std::forward<Args>(args)...);
299 case IRNodeType::AssertStmt:
300 return ((T *)this)->visit((const AssertStmt *)node, std::forward<Args>(args)...);
301 case IRNodeType::ProducerConsumer:
302 return ((T *)this)->visit((const ProducerConsumer *)node, std::forward<Args>(args)...);
303 case IRNodeType::For:
304 return ((T *)this)->visit((const For *)node, std::forward<Args>(args)...);
305 case IRNodeType::Acquire:
306 return ((T *)this)->visit((const Acquire *)node, std::forward<Args>(args)...);
307 case IRNodeType::Store:
308 return ((T *)this)->visit((const Store *)node, std::forward<Args>(args)...);
309 case IRNodeType::Provide:
310 return ((T *)this)->visit((const Provide *)node, std::forward<Args>(args)...);
311 case IRNodeType::Allocate:
312 return ((T *)this)->visit((const Allocate *)node, std::forward<Args>(args)...);
313 case IRNodeType::Free:
314 return ((T *)this)->visit((const Free *)node, std::forward<Args>(args)...);
315 case IRNodeType::Realize:
316 return ((T *)this)->visit((const Realize *)node, std::forward<Args>(args)...);
317 case IRNodeType::Block:
318 return ((T *)this)->visit((const Block *)node, std::forward<Args>(args)...);
319 case IRNodeType::Fork:
320 return ((T *)this)->visit((const Fork *)node, std::forward<Args>(args)...);
321 case IRNodeType::IfThenElse:
322 return ((T *)this)->visit((const IfThenElse *)node, std::forward<Args>(args)...);
323 case IRNodeType::Evaluate:
324 return ((T *)this)->visit((const Evaluate *)node, std::forward<Args>(args)...);
325 case IRNodeType::Prefetch:
326 return ((T *)this)->visit((const Prefetch *)node, std::forward<Args>(args)...);
327 case IRNodeType::Atomic:
328 return ((T *)this)->visit((const Atomic *)node, std::forward<Args>(args)...);
329 case IRNodeType::HoistedStorage:
330 return ((T *)this)->visit((const HoistedStorage *)node, std::forward<Args>(args)...);
331 }
332 return StmtRet{};
333 }
334
335 public:
336 template<typename... Args>
337 HALIDE_ALWAYS_INLINE StmtRet dispatch(const Stmt &s, Args &&...args) {
338 return dispatch_stmt(s.get(), std::forward<Args>(args)...);
339 }
340
341 template<typename... Args>
342 HALIDE_ALWAYS_INLINE StmtRet dispatch(Stmt &&s, Args &&...args) {
343 return dispatch_stmt(s.get(), std::forward<Args>(args)...);
344 }
345
346 template<typename... Args>
347 HALIDE_ALWAYS_INLINE ExprRet dispatch(const Expr &e, Args &&...args) {
348 return dispatch_expr(e.get(), std::forward<Args>(args)...);
349 }
350
351 template<typename... Args>
352 HALIDE_ALWAYS_INLINE ExprRet dispatch(Expr &&e, Args &&...args) {
353 return dispatch_expr(e.get(), std::forward<Args>(args)...);
354 }
355};
356
357} // namespace Internal
358} // namespace Halide
359
360#endif
internal_error
#define internal_error
Definition: Error.h:229
HALIDE_ALWAYS_INLINE
#define HALIDE_ALWAYS_INLINE
Definition: HalideRuntime.h:49
IR.h
Subtypes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Halide::Internal::IRGraphVisitor
A base class for algorithms that walk recursively over the IR without visiting the same node twice.
Definition: IRVisitor.h:85
Halide::Internal::IRGraphVisitor::visit
void visit(const Div *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Shuffle *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const NE *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Block *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const EQ *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Let *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Provide *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const StringImm *) override
Halide::Internal::IRGraphVisitor::include
virtual void include(const Expr &)
By default these methods add the node to the visited set, and return whether or not it was already th...
Halide::Internal::IRGraphVisitor::visit
void visit(const For *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const HoistedStorage *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Ramp *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Or *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const UIntImm *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Mul *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const AssertStmt *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const GE *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Min *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Free *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Add *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Acquire *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Store *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Max *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const IntImm *) override
These methods should call 'include' on the children to only visit them if they haven't been visited a...
Halide::Internal::IRGraphVisitor::visit
void visit(const IfThenElse *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const LT *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const VectorReduce *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Atomic *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Sub *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Not *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Mod *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const ProducerConsumer *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const LetStmt *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const LE *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Allocate *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Load *) override
Halide::Internal::IRGraphVisitor::include
virtual void include(const Stmt &)
Halide::Internal::IRGraphVisitor::visit
void visit(const Realize *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Prefetch *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const FloatImm *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Fork *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Call *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Reinterpret *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const And *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Variable *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Evaluate *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Broadcast *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const GT *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Cast *) override
Halide::Internal::IRGraphVisitor::visit
void visit(const Select *) override
Halide::Internal::IRVisitor
A base class for algorithms that need to recursively walk over the IR.
Definition: IRVisitor.h:19
Halide::Internal::IRVisitor::visit
virtual void visit(const NE *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Mul *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Max *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Select *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Load *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Div *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Fork *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Sub *)
Halide::Internal::IRVisitor::visit
virtual void visit(const LE *)
Halide::Internal::IRVisitor::~IRVisitor
virtual ~IRVisitor()=default
Halide::Internal::IRVisitor::visit
virtual void visit(const ProducerConsumer *)
Halide::Internal::IRVisitor::visit
virtual void visit(const VectorReduce *)
Halide::Internal::IRVisitor::visit
virtual void visit(const GE *)
Halide::Internal::IRVisitor::visit
virtual void visit(const StringImm *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Allocate *)
Halide::Internal::IRVisitor::visit
virtual void visit(const IfThenElse *)
Halide::Internal::IRVisitor::visit
virtual void visit(const For *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Prefetch *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Block *)
Halide::Internal::IRVisitor::visit
virtual void visit(const UIntImm *)
Halide::Internal::IRVisitor::visit
virtual void visit(const HoistedStorage *)
Halide::Internal::IRVisitor::visit
virtual void visit(const FloatImm *)
Halide::Internal::IRVisitor::visit
virtual void visit(const GT *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Mod *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Acquire *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Atomic *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Ramp *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Free *)
Halide::Internal::IRVisitor::visit
virtual void visit(const IntImm *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Or *)
Halide::Internal::IRVisitor::visit
virtual void visit(const EQ *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Broadcast *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Call *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Min *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Variable *)
Halide::Internal::IRVisitor::IRVisitor
IRVisitor()=default
Halide::Internal::IRVisitor::visit
virtual void visit(const Realize *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Add *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Shuffle *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Reinterpret *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Evaluate *)
Halide::Internal::IRVisitor::visit
virtual void visit(const AssertStmt *)
Halide::Internal::IRVisitor::visit
virtual void visit(const And *)
Halide::Internal::IRVisitor::visit
virtual void visit(const LetStmt *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Store *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Provide *)
Halide::Internal::IRVisitor::visit
virtual void visit(const LT *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Cast *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Not *)
Halide::Internal::IRVisitor::visit
virtual void visit(const Let *)
Halide::Internal::VariadicVisitor
A visitor/mutator capable of passing arbitrary arguments to the visit methods using CRTP and returnin...
Definition: IRVisitor.h:163
Halide::Internal::VariadicVisitor::dispatch
HALIDE_ALWAYS_INLINE StmtRet dispatch(const Stmt &s, Args &&...args)
Definition: IRVisitor.h:337
Halide::Internal::VariadicVisitor::dispatch
HALIDE_ALWAYS_INLINE ExprRet dispatch(Expr &&e, Args &&...args)
Definition: IRVisitor.h:352
Halide::Internal::VariadicVisitor::dispatch
HALIDE_ALWAYS_INLINE StmtRet dispatch(Stmt &&s, Args &&...args)
Definition: IRVisitor.h:342
Halide::Internal::VariadicVisitor::dispatch
HALIDE_ALWAYS_INLINE ExprRet dispatch(const Expr &e, Args &&...args)
Definition: IRVisitor.h:347
Halide::Internal::IRNodeType::VectorReduce
@ VectorReduce
Halide::Internal::IRNodeType::UIntImm
@ UIntImm
Halide::Internal::IRNodeType::Prefetch
@ Prefetch
Halide::Internal::IRNodeType::Reinterpret
@ Reinterpret
Halide::Internal::IRNodeType::ProducerConsumer
@ ProducerConsumer
Halide::Internal::IRNodeType::EQ
@ EQ
Halide::Internal::IRNodeType::Provide
@ Provide
Halide::Internal::IRNodeType::Fork
@ Fork
Halide::Internal::IRNodeType::For
@ For
Halide::Internal::IRNodeType::Or
@ Or
Halide::Internal::IRNodeType::FloatImm
@ FloatImm
Halide::Internal::IRNodeType::Div
@ Div
Halide::Internal::IRNodeType::Variable
@ Variable
Halide::Internal::IRNodeType::Cast
@ Cast
Halide::Internal::IRNodeType::Atomic
@ Atomic
Halide::Internal::IRNodeType::AssertStmt
@ AssertStmt
Halide::Internal::IRNodeType::Mul
@ Mul
Halide::Internal::IRNodeType::Max
@ Max
Halide::Internal::IRNodeType::StringImm
@ StringImm
Halide::Internal::IRNodeType::Min
@ Min
Halide::Internal::IRNodeType::Mod
@ Mod
Halide::Internal::IRNodeType::Acquire
@ Acquire
Halide::Internal::IRNodeType::Ramp
@ Ramp
Halide::Internal::IRNodeType::LetStmt
@ LetStmt
Halide::Internal::IRNodeType::Not
@ Not
Halide::Internal::IRNodeType::IfThenElse
@ IfThenElse
Halide::Internal::IRNodeType::Evaluate
@ Evaluate
Halide::Internal::IRNodeType::Free
@ Free
Halide::Internal::IRNodeType::HoistedStorage
@ HoistedStorage
Halide::Internal::IRNodeType::Broadcast
@ Broadcast
Halide::Internal::IRNodeType::And
@ And
Halide::Internal::IRNodeType::Call
@ Call
Halide::Internal::IRNodeType::LT
@ LT
Halide::Internal::IRNodeType::Allocate
@ Allocate
Halide::Internal::IRNodeType::Let
@ Let
Halide::Internal::IRNodeType::Realize
@ Realize
Halide::Internal::IRNodeType::GT
@ GT
Halide::Internal::IRNodeType::LE
@ LE
Halide::Internal::IRNodeType::IntImm
@ IntImm
Halide::Internal::IRNodeType::NE
@ NE
Halide::Internal::IRNodeType::Select
@ Select
Halide::Internal::IRNodeType::Block
@ Block
Halide::Internal::IRNodeType::Sub
@ Sub
Halide::Internal::IRNodeType::Shuffle
@ Shuffle
Halide::Internal::IRNodeType::Add
@ Add
Halide::Internal::IRNodeType::Load
@ Load
Halide::Internal::IRNodeType::GE
@ GE
Halide::Internal::IRNodeType::Store
@ Store
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Expr
A fragment of Halide syntax.
Definition: Expr.h:258
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::Internal::Acquire
Definition: IR.h:872
Halide::Internal::Add
The sum of two expressions.
Definition: IR.h:56
Halide::Internal::Allocate
Allocate a scratch area called with the given name, type, and size.
Definition: IR.h:371
Halide::Internal::And
Logical and - are both expressions true.
Definition: IR.h:175
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:294
Halide::Internal::Atomic
Lock all the Store nodes in the body statement.
Definition: IR.h:994
Halide::Internal::BaseExprNode
A base class for expression nodes.
Definition: Expr.h:143
Halide::Internal::BaseStmtNode
IR nodes are split into expressions and statements.
Definition: Expr.h:134
Halide::Internal::Block
A sequence of statements to be executed in-order.
Definition: IR.h:442
Halide::Internal::Broadcast
A vector with 'lanes' elements, in which every element is 'value'.
Definition: IR.h:259
Halide::Internal::Call
A function call.
Definition: IR.h:490
Halide::Internal::Cast
The actual IR nodes begin here.
Definition: IR.h:30
Halide::Internal::Div
The ratio of two expressions.
Definition: IR.h:83
Halide::Internal::EQ
Is the first expression equal to the second.
Definition: IR.h:121
Halide::Internal::Evaluate
Evaluate and discard an expression, presumably because it has some side-effect.
Definition: IR.h:476
Halide::Internal::ExprNode
We use the "curiously recurring template pattern" to avoid duplicated code in the IR Nodes.
Definition: Expr.h:158
Halide::Internal::FloatImm
Floating point constants.
Definition: Expr.h:236
Halide::Internal::For
A for loop.
Definition: IR.h:848
Halide::Internal::Fork
A pair of statements executed concurrently.
Definition: IR.h:457
Halide::Internal::Free
Free the resources associated with the given buffer.
Definition: IR.h:413
Halide::Internal::GE
Is the first expression greater than or equal to the second.
Definition: IR.h:166
Halide::Internal::GT
Is the first expression greater than the second.
Definition: IR.h:157
Halide::Internal::HoistedStorage
Represents a location where storage will be hoisted to for a Func / Realize node with a given name.
Definition: IR.h:978
Halide::Internal::IRNode::node_type
IRNodeType node_type
Each IR node subclass has a unique identifier.
Definition: Expr.h:113
Halide::Internal::IfThenElse
An if-then-else block.
Definition: IR.h:466
Halide::Internal::IntImm
Integer constants.
Definition: Expr.h:218
Halide::Internal::LE
Is the first expression less than or equal to the second.
Definition: IR.h:148
Halide::Internal::LT
Is the first expression less than the second.
Definition: IR.h:139
Halide::Internal::Let
A let expression, like you might find in a functional language.
Definition: IR.h:271
Halide::Internal::LetStmt
The statement form of a let node.
Definition: IR.h:282
Halide::Internal::Load
Load a value from a named symbol if predicate is true.
Definition: IR.h:217
Halide::Internal::Max
The greater of two values.
Definition: IR.h:112
Halide::Internal::Min
The lesser of two values.
Definition: IR.h:103
Halide::Internal::Mod
The remainder of a / b.
Definition: IR.h:94
Halide::Internal::Mul
The product of two expressions.
Definition: IR.h:74
Halide::Internal::NE
Is the first expression not equal to the second.
Definition: IR.h:130
Halide::Internal::Not
Logical not - true if the expression false.
Definition: IR.h:193
Halide::Internal::Or
Logical or - is at least one of the expression true.
Definition: IR.h:184
Halide::Internal::Prefetch
Represent a multi-dimensional region of a Func or an ImageParam that needs to be prefetched.
Definition: IR.h:956
Halide::Internal::ProducerConsumer
This node is a helpful annotation to do with permissions.
Definition: IR.h:315
Halide::Internal::Provide
This defines the value of a function at a multi-dimensional location.
Definition: IR.h:354
Halide::Internal::Ramp
A linear ramp vector node.
Definition: IR.h:247
Halide::Internal::Realize
Allocate a multi-dimensional buffer of the given type and size.
Definition: IR.h:427
Halide::Internal::Reinterpret
Reinterpret value as another type, without affecting any of the bits (on little-endian systems).
Definition: IR.h:47
Halide::Internal::Select
A ternary operator.
Definition: IR.h:204
Halide::Internal::Shuffle
Construct a new vector by taking elements from another sequence of vectors.
Definition: IR.h:884
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition: Expr.h:427
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::StmtNode
Definition: Expr.h:168
Halide::Internal::Store
Store a 'value' to the buffer called 'name' at a given 'index' if 'predicate' is true.
Definition: IR.h:333
Halide::Internal::StringImm
String constants.
Definition: Expr.h:245
Halide::Internal::Sub
The difference of two expressions.
Definition: IR.h:65
Halide::Internal::UIntImm
Unsigned integer constants.
Definition: Expr.h:227
Halide::Internal::Variable
A named variable.
Definition: IR.h:801
Halide::Internal::VectorReduce
Horizontally reduce a vector to a scalar or narrower vector using the given commutative and associati...
Definition: IR.h:1012