Halide 22.0.0 Halide compiler and libraries

IR.h
Go to the documentation of this file.
1#ifndef HALIDE_IR_H
2#define HALIDE_IR_H
3
4/** \file
5 * Subtypes for Halide expressions (\ref Halide::Expr) and statements (\ref Halide::Internal::Stmt)
6 */
7
8#include <string>
9#include <vector>
10
11#include "Buffer.h"
12#include "Expr.h"
13#include "FunctionPtr.h"
14#include "LoopPartitioningDirective.h"
15#include "ModulusRemainder.h"
16#include "Parameter.h"
17#include "PrefetchDirective.h"
18#include "Reduction.h"
19#include "Type.h"
20
21 namespace Halide {
22 namespace Internal {
23
24 class Function;
25
26/** The actual IR nodes begin here. Remember that all the Expr
27 * nodes also have a public "type" property */
28
29/** Cast a node from one type to another. Can't change vector widths. */
30 struct Cast : public ExprNode<Cast> {
31 Expr value;
32
33 static Expr make(Type t, Expr v);
34
35 static const IRNodeType _node_type = IRNodeType::Cast;
36
37 /** Check if the cast is equivalent to a reinterpret. */
38 bool is_reinterpret() const {
39 return (type.is_int_or_uint() &&
40 value.type().is_int_or_uint() &&
41 type.bits() == value.type().bits());
42 }
43};
44
45/** Reinterpret value as another type, without affecting any of the bits
46 * (on little-endian systems). */
47 struct Reinterpret : public ExprNode<Reinterpret> {
48 Expr value;
49
50 static Expr make(Type t, Expr v);
51
52 static const IRNodeType _node_type = IRNodeType::Reinterpret;
53};
54
55/** The sum of two expressions */
56 struct Add : public ExprNode<Add> {
57 Expr a, b;
58
59 static Expr make(Expr a, Expr b);
60
61 static const IRNodeType _node_type = IRNodeType::Add;
62};
63
64/** The difference of two expressions */
65 struct Sub : public ExprNode<Sub> {
66 Expr a, b;
67
68 static Expr make(Expr a, Expr b);
69
70 static const IRNodeType _node_type = IRNodeType::Sub;
71};
72
73/** The product of two expressions */
74 struct Mul : public ExprNode<Mul> {
75 Expr a, b;
76
77 static Expr make(Expr a, Expr b);
78
79 static const IRNodeType _node_type = IRNodeType::Mul;
80};
81
82/** The ratio of two expressions */
83 struct Div : public ExprNode<Div> {
84 Expr a, b;
85
86 static Expr make(Expr a, Expr b);
87
88 static const IRNodeType _node_type = IRNodeType::Div;
89};
90
91/** The remainder of a / b. Mostly equivalent to '%' in C, except that
92 * the result here is always positive. For floats, this is equivalent
93 * to calling fmod. */
94 struct Mod : public ExprNode<Mod> {
95 Expr a, b;
96
97 static Expr make(Expr a, Expr b);
98
99 static const IRNodeType _node_type = IRNodeType::Mod;
100};
101
102/** The lesser of two values. */
103 struct Min : public ExprNode<Min> {
104 Expr a, b;
105
106 static Expr make(Expr a, Expr b);
107
108 static const IRNodeType _node_type = IRNodeType::Min;
109};
110
111/** The greater of two values */
112 struct Max : public ExprNode<Max> {
113 Expr a, b;
114
115 static Expr make(Expr a, Expr b);
116
117 static const IRNodeType _node_type = IRNodeType::Max;
118};
119
120/** Is the first expression equal to the second */
121 struct EQ : public ExprNode<EQ> {
122 Expr a, b;
123
124 static Expr make(Expr a, Expr b);
125
126 static const IRNodeType _node_type = IRNodeType::EQ;
127};
128
129/** Is the first expression not equal to the second */
130 struct NE : public ExprNode<NE> {
131 Expr a, b;
132
133 static Expr make(Expr a, Expr b);
134
135 static const IRNodeType _node_type = IRNodeType::NE;
136};
137
138/** Is the first expression less than the second. */
139 struct LT : public ExprNode<LT> {
140 Expr a, b;
141
142 static Expr make(Expr a, Expr b);
143
144 static const IRNodeType _node_type = IRNodeType::LT;
145};
146
147/** Is the first expression less than or equal to the second. */
148 struct LE : public ExprNode<LE> {
149 Expr a, b;
150
151 static Expr make(Expr a, Expr b);
152
153 static const IRNodeType _node_type = IRNodeType::LE;
154};
155
156/** Is the first expression greater than the second. */
157 struct GT : public ExprNode<GT> {
158 Expr a, b;
159
160 static Expr make(Expr a, Expr b);
161
162 static const IRNodeType _node_type = IRNodeType::GT;
163};
164
165/** Is the first expression greater than or equal to the second. */
166 struct GE : public ExprNode<GE> {
167 Expr a, b;
168
169 static Expr make(Expr a, Expr b);
170
171 static const IRNodeType _node_type = IRNodeType::GE;
172};
173
174/** Logical and - are both expressions true */
175 struct And : public ExprNode<And> {
176 Expr a, b;
177
178 static Expr make(Expr a, Expr b);
179
180 static const IRNodeType _node_type = IRNodeType::And;
181};
182
183/** Logical or - is at least one of the expression true */
184 struct Or : public ExprNode<Or> {
185 Expr a, b;
186
187 static Expr make(Expr a, Expr b);
188
189 static const IRNodeType _node_type = IRNodeType::Or;
190};
191
192/** Logical not - true if the expression false */
193 struct Not : public ExprNode<Not> {
194 Expr a;
195
196 static Expr make(Expr a);
197
198 static const IRNodeType _node_type = IRNodeType::Not;
199};
200
201/** A ternary operator. Evalutes 'true_value' and 'false_value',
202 * then selects between them based on 'condition'. Equivalent to
203 * the ternary operator in C. */
204 struct Select : public ExprNode<Select> {
205 Expr condition, true_value, false_value;
206
207 static Expr make(Expr condition, Expr true_value, Expr false_value);
208
209 static const IRNodeType _node_type = IRNodeType::Select;
210};
211
212/** Load a value from a named symbol if predicate is true. The buffer
213 * is treated as an array of the 'type' of this Load node. That is,
214 * the buffer has no inherent type. The name may be the name of an
215 * enclosing allocation, an input or output buffer, or any other
216 * symbol of type Handle(). */
217 struct Load : public ExprNode<Load> {
218 std::string name;
219
220 Expr predicate, index;
221
222 // If it's a load from an image argument or compiled-in constant
223 // image, this will point to that
224 Buffer<> image;
225
226 // If it's a load from an image parameter, this points to that
227 Parameter param;
228
229 // The alignment of the index. If the index is a vector, this is
230 // the alignment of the first lane.
231 ModulusRemainder alignment;
232
233 static Expr make(Type type, const std::string &name,
234 Expr index, Buffer<> image,
235 Parameter param,
236 Expr predicate,
237 ModulusRemainder alignment);
238
239 static const IRNodeType _node_type = IRNodeType::Load;
240};
241
242/** A linear ramp vector node. This is vector with 'lanes' elements,
243 * where element i is 'base' + i*'stride'. This is a convenient way to
244 * pass around vectors without busting them up into individual
245 * elements. E.g. a dense vector load from a buffer can use a ramp
246 * node with stride 1 as the index. */
247 struct Ramp : public ExprNode<Ramp> {
248 Expr base, stride;
249 int lanes;
250
251 static Expr make(Expr base, Expr stride, int lanes);
252
253 static const IRNodeType _node_type = IRNodeType::Ramp;
254};
255
256/** A vector with 'lanes' elements, in which every element is
257 * 'value'. This is a special case of the ramp node above, in which
258 * the stride is zero. */
259 struct Broadcast : public ExprNode<Broadcast> {
260 Expr value;
261 int lanes;
262
263 static Expr make(Expr value, int lanes);
264
265 static const IRNodeType _node_type = IRNodeType::Broadcast;
266};
267
268/** A let expression, like you might find in a functional
269 * language. Within the expression \ref Let::body, instances of the Var
270 * node \ref Let::name refer to \ref Let::value. */
271 struct Let : public ExprNode<Let> {
272 std::string name;
273 Expr value, body;
274
275 static Expr make(const std::string &name, Expr value, Expr body);
276
277 static const IRNodeType _node_type = IRNodeType::Let;
278};
279
280/** The statement form of a let node. Within the statement 'body',
281 * instances of the Var named 'name' refer to 'value' */
282 struct LetStmt : public StmtNode<LetStmt> {
283 std::string name;
284 Expr value;
285 Stmt body;
286
287 static Stmt make(const std::string &name, Expr value, Stmt body);
288
289 static const IRNodeType _node_type = IRNodeType::LetStmt;
290};
291
292/** If the 'condition' is false, then evaluate and return the message,
293 * which should be a call to an error function. */
294 struct AssertStmt : public StmtNode<AssertStmt> {
295 // if condition then val else error out with message
296 Expr condition;
297 Expr message;
298
299 static Stmt make(Expr condition, Expr message);
300
301 static const IRNodeType _node_type = IRNodeType::AssertStmt;
302};
303
304/** This node is a helpful annotation to do with permissions. If 'is_produce' is
305 * set to true, this represents a producer node which may also contain updates;
306 * otherwise, this represents a consumer node. If the producer node contains
307 * updates, the body of the node will be a block of 'produce' and 'update'
308 * in that order. In a producer node, the access is read-write only (or write
309 * only if it doesn't have updates). In a consumer node, the access is read-only.
310 * None of this is actually enforced, the node is purely for informative purposes
311 * to help out our analysis during lowering. For every unique ProducerConsumer,
312 * there is an associated Realize node with the same name that creates the buffer
313 * being read from or written to in the body of the ProducerConsumer.
314 */
315 struct ProducerConsumer : public StmtNode<ProducerConsumer> {
316 std::string name;
317 bool is_producer;
318 Stmt body;
319
320 static Stmt make(const std::string &name, bool is_producer, Stmt body);
321
322 static Stmt make_produce(const std::string &name, Stmt body);
323 static Stmt make_consume(const std::string &name, Stmt body);
324
325 static const IRNodeType _node_type = IRNodeType::ProducerConsumer;
326};
327
328/** Store a 'value' to the buffer called 'name' at a given 'index' if
329 * 'predicate' is true. The buffer is interpreted as an array of the
330 * same type as 'value'. The name may be the name of an enclosing
331 * Allocate node, an output buffer, or any other symbol of type
332 * Handle(). */
333 struct Store : public StmtNode<Store> {
334 std::string name;
335 Expr predicate, value, index;
336 // If it's a store to an output buffer, then this parameter points to it.
337 Parameter param;
338
339 // The alignment of the index. If the index is a vector, this is
340 // the alignment of the first lane.
341 ModulusRemainder alignment;
342
343 static Stmt make(const std::string &name, Expr value, Expr index,
344 Parameter param, Expr predicate, ModulusRemainder alignment);
345
346 static const IRNodeType _node_type = IRNodeType::Store;
347};
348
349/** This defines the value of a function at a multi-dimensional
350 * location. You should think of it as a store to a multi-dimensional
351 * array. It gets lowered to a conventional Store node. The name must
352 * correspond to an output buffer or the name of an enclosing Realize
353 * node. */
354 struct Provide : public StmtNode<Provide> {
355 std::string name;
356 std::vector<Expr> values;
357 std::vector<Expr> args;
358 Expr predicate;
359
360 static Stmt make(const std::string &name, const std::vector<Expr> &values, const std::vector<Expr> &args, const Expr &predicate);
361
362 static const IRNodeType _node_type = IRNodeType::Provide;
363};
364
365/** Allocate a scratch area called with the given name, type, and
366 * size. The buffer lives for at most the duration of the body
367 * statement, within which it may or may not be freed explicitly with
368 * a Free node with a matching name. Allocation only occurs if the
369 * condition evaluates to true. Within the body of the allocation,
370 * defines a symbol with the given name and the type Handle(). */
371 struct Allocate : public StmtNode<Allocate> {
372 std::string name;
373 Type type;
374 MemoryType memory_type;
375 std::vector<Expr> extents;
376
377 // A boolean condition that determines if the allocation needs to be made at all.
378 Expr condition;
379
380 // These override the code generator dependent malloc and free
381 // equivalents if provided. If the new_expr succeeds, that is it
382 // returns non-nullptr, the function named be free_function is
383 // guaranteed to be called. The free function signature must match
384 // that of the code generator dependent free (typically
385 // halide_free). If free_function is left empty, code generator
386 // default will be called.
387 Expr new_expr;
388 std::string free_function;
389
390 // Extra padding elements to allow for overreads. Elements in the padding
391 // have undetermined values, but are guaranteed safe to load.
392 int padding;
393
394 Stmt body;
395
396 static Stmt make(const std::string &name, Type type, MemoryType memory_type,
397 const std::vector<Expr> &extents,
398 Expr condition, Stmt body,
399 Expr new_expr = Expr(), const std::string &free_function = std::string(), int padding = 0);
400
401 /** A routine to check if the extents are all constants, and if so verify
402 * the total size is less than 2^31 - 1. If the result is constant, but
403 * overflows, this routine asserts. This returns 0 if the extents are
404 * not all constants; otherwise, it returns the total constant allocation
405 * size. Does not include any padding bytes. */
406 static int32_t constant_allocation_size(const std::vector<Expr> &extents, const std::string &name);
407 int32_t constant_allocation_size() const;
408
409 static const IRNodeType _node_type = IRNodeType::Allocate;
410};
411
412/** Free the resources associated with the given buffer. */
413 struct Free : public StmtNode<Free> {
414 std::string name;
415
416 static Stmt make(const std::string &name);
417
418 static const IRNodeType _node_type = IRNodeType::Free;
419};
420
421/** Allocate a multi-dimensional buffer of the given type and
422 * size. Create some scratch memory that will back the function 'name'
423 * over the range specified in 'bounds'. The bounds are a vector of
424 * (min, extent) pairs for each dimension. Allocation only occurs if
425 * the condition evaluates to true.
426 */
427 struct Realize : public StmtNode<Realize> {
428 std::string name;
429 std::vector<Type> types;
430 MemoryType memory_type;
431 Region bounds;
432 Expr condition;
433 Stmt body;
434
435 static Stmt make(const std::string &name, const std::vector<Type> &types, MemoryType memory_type, const Region &bounds, Expr condition, Stmt body);
436
437 static const IRNodeType _node_type = IRNodeType::Realize;
438};
439
440/** A sequence of statements to be executed in-order. 'first' is never
441 a Block, so this can be treated as a linked list. */
442 struct Block : public StmtNode<Block> {
443 Stmt first, rest;
444
445 static Stmt make(Stmt first, Stmt rest);
446
447 /** Construct zero or more Blocks to invoke a list of statements in order.
448 * This method may not return a Block statement if stmts.size() <= 1. */
449 static Stmt make(const std::vector<Stmt> &stmts);
450
451 static const IRNodeType _node_type = IRNodeType::Block;
452};
453
454/** A pair of statements executed concurrently. Both statements are
455 * joined before the Stmt ends. This is the parallel equivalent to
456 * Block. */
457 struct Fork : public StmtNode<Fork> {
458 Stmt first, rest;
459
460 static Stmt make(Stmt first, Stmt rest);
461
462 static const IRNodeType _node_type = IRNodeType::Fork;
463};
464
465/** An if-then-else block. 'else' may be undefined. */
466 struct IfThenElse : public StmtNode<IfThenElse> {
467 Expr condition;
468 Stmt then_case, else_case;
469
470 static Stmt make(Expr condition, Stmt then_case, Stmt else_case = Stmt());
471
472 static const IRNodeType _node_type = IRNodeType::IfThenElse;
473};
474
475/** Evaluate and discard an expression, presumably because it has some side-effect. */
476 struct Evaluate : public StmtNode<Evaluate> {
477 Expr value;
478
479 static Stmt make(Expr v);
480
481 static const IRNodeType _node_type = IRNodeType::Evaluate;
482};
483
484/** A function call. This can represent a call to some extern function
485 * (like sin), but it's also our multi-dimensional version of a Load,
486 * so it can be a load from an input image, or a call to another
487 * halide function. These two types of call nodes don't survive all
488 * the way down to code generation - the lowering process converts
489 * them to Load nodes. */
490 struct Call : public ExprNode<Call> {
491 std::string name;
492 std::vector<Expr> args;
493 typedef enum { Image, ///< A load from an input image
494 Extern, ///< A call to an external C-ABI function, possibly with side-effects
495 ExternCPlusPlus, ///< A call to an external C-ABI function, possibly with side-effects
496 PureExtern, ///< A call to a guaranteed-side-effect-free external function
497 Halide, ///< A call to a Func
498 Intrinsic, ///< A possibly-side-effecty compiler intrinsic, which has special handling during codegen
499 PureIntrinsic ///< A side-effect-free version of the above.
500 } CallType;
501 CallType call_type;
502
503 // Halide uses calls internally to represent certain operations
504 // (instead of IR nodes). These are matched by name. Note that
505 // these are deliberately char* (rather than std::string) so that
506 // they can be referenced at static-initialization time without
507 // risking ambiguous initalization order; we use a typedef to simplify
508 // declaration.
509 typedef const char *const ConstString;
510
511 // enums for various well-known intrinsics. (It is not *required* that all
512 // intrinsics have an enum entry here, but as a matter of style, it is recommended.)
513 // Note that these are only used in the API; inside the node, they are translated
514 // into a name. (To recover the name, call get_intrinsic_name().)
515 //
516 // Please keep this list sorted alphabetically; the specific enum values
517 // are *not* guaranteed to be stable across time.
518 enum IntrinsicOp {
519 abs,
520 absd,
521 add_image_checks_marker,
522 alloca,
523 bitwise_and,
524 bitwise_not,
525 bitwise_or,
526 bitwise_xor,
527 bool_to_mask,
528
529 // Bundle multiple exprs together temporarily for analysis (e.g. CSE)
530 bundle,
531 call_cached_indirect_function,
532 cast_mask,
533
534 // Concatenate bits of the args, with least significant bits as the
535 // first arg (i.e. little-endian)
536 concat_bits,
537 count_leading_zeros,
538 count_trailing_zeros,
539 debug_to_file,
540 declare_box_touched,
541 div_round_to_zero,
542 dynamic_shuffle,
543
544 // Extract some contiguous slice of bits from the argument starting at
545 // the nth bit, counting from the least significant bit, with the number
546 // of bits determined by the return type.
547 extract_bits,
548 extract_mask_element,
549 get_user_context,
550 gpu_thread_barrier,
551 halving_add,
552 halving_sub,
553 hvx_gather,
554 hvx_scatter,
555 hvx_scatter_acc,
556 hvx_scatter_release,
557 if_then_else,
558 if_then_else_mask,
559 image_load,
560 image_store,
561 lerp,
562 likely,
563 likely_if_innermost,
564 load_typed_struct_member,
565 make_struct,
566 memoize_expr,
567 mod_round_to_zero,
568 mul_shift_right,
569 mux,
570 popcount,
571 prefetch,
572 profiling_enable_instance_marker,
573 promise_clamped,
574 random,
575 register_destructor,
576 require,
577 require_mask,
578 return_second,
579 rewrite_buffer,
580
581 // Round a floating point value to nearest integer, with ties going to even
582 round,
583
584 rounding_halving_add,
585 rounding_mul_shift_right,
586 rounding_shift_left,
587 rounding_shift_right,
588 saturating_add,
589 saturating_sub,
590 saturating_cast,
591 scatter_gather,
592 select_mask,
593 shift_left,
594 shift_right,
595 signed_integer_overflow,
596 size_of_halide_buffer_t,
597
598 // Marks the point in lowering where the outermost skip stages checks
599 // should be introduced.
600 skip_stages_marker,
601
602 // Takes a realization name and a loop variable. Declares that values of
603 // the realization that were stored on earlier loop iterations of the
604 // given loop are potentially loaded in this loop iteration somewhere
605 // after this point. Must occur inside a Realize node and For node of
606 // the given names but outside any corresponding ProducerConsumer
607 // nodes. Communicates to storage folding that sliding window took
608 // place.
609 sliding_window_marker,
610
611 // Compute (arg[0] + arg[1]) / 2, assuming arg[0] < arg[1].
612 sorted_avg,
613
614 // strict floating point ops. These are floating point ops that we would
615 // like to optimize around (or let llvm optimize around) by treating
616 // them as reals and ignoring the existence of nan and inf. Using these
617 // intrinsics instead prevents any such optimizations.
618 strict_add,
619 strict_div,
620 strict_eq,
621 strict_le,
622 strict_lt,
623 strict_max,
624 strict_min,
625 strict_mul,
626 strict_sub,
627
628 // Convert a list of Exprs to a string
629 stringify,
630
631 // Query properties of the compiled-for target (resolved at compile-time)
632 target_arch_is,
633 target_bits,
634 target_has_feature,
635 target_natural_vector_size,
636 target_os_is,
637
638 undef,
639 unreachable,
640 unsafe_promise_clamped,
641
642 // One-sided variants of widening_add, widening_mul, and widening_sub.
643 // arg[0] + widen(arg[1])
644 widen_right_add,
645 // arg[0] * widen(arg[1])
646 widen_right_mul,
647 // arg[0] - widen(arg[1])
648 widen_right_sub,
649
650 widening_add,
651 widening_mul,
652 widening_shift_left,
653 widening_shift_right,
654 widening_sub,
655
656 get_runtime_vscale,
657
658 IntrinsicOpCount // Sentinel: keep last.
659 };
660
661 static const char *get_intrinsic_name(IntrinsicOp op);
662
663 // We also declare some symbolic names for some of the runtime
664 // functions that we want to construct Call nodes to here to avoid
665 // magic string constants and the potential risk of typos.
666 HALIDE_EXPORT static ConstString
667 buffer_get_dimensions,
668 buffer_get_min,
669 buffer_get_extent,
670 buffer_get_stride,
671 buffer_get_max,
672 buffer_get_host,
673 buffer_get_device,
674 buffer_get_device_interface,
675 buffer_get_shape,
676 buffer_get_host_dirty,
677 buffer_get_device_dirty,
678 buffer_get_type,
679 buffer_set_host_dirty,
680 buffer_set_device_dirty,
681 buffer_is_bounds_query,
682 buffer_init,
683 buffer_init_from_buffer,
684 buffer_crop,
685 buffer_set_bounds,
686 trace;
687
688 // If it's a call to another halide function, this call node holds
689 // a possibly-weak reference to that function.
690 FunctionPtr func;
691
692 // If that function has multiple values, which value does this
693 // call node refer to?
694 int value_index;
695
696 // If it's a call to an image, this call nodes hold a
697 // pointer to that image's buffer
698 Buffer<> image;
699
700 // If it's a call to an image parameter, this call node holds a
701 // pointer to that
702 Parameter param;
703
704 static Expr make(Type type, IntrinsicOp op, const std::vector<Expr> &args, CallType call_type,
705 FunctionPtr func = FunctionPtr(), int value_index = 0,
706 const Buffer<> &image = Buffer<>(), Parameter param = Parameter());
707
708 static Expr make(Type type, const std::string &name, const std::vector<Expr> &args, CallType call_type,
709 FunctionPtr func = FunctionPtr(), int value_index = 0,
710 Buffer<> image = Buffer<>(), Parameter param = Parameter());
711
712 /** Convenience constructor for calls to other halide functions */
713 static Expr make(const Function &func, const std::vector<Expr> &args, int idx = 0);
714
715 /** Convenience constructor for loads from concrete images */
716 static Expr make(const Buffer<> &image, const std::vector<Expr> &args) {
717 return make(image.type(), image.name(), args, Image, FunctionPtr(), 0, image, Parameter());
718 }
719
720 /** Convenience constructor for loads from images parameters */
721 static Expr make(const Parameter &param, const std::vector<Expr> &args) {
722 return make(param.type(), param.name(), args, Image, FunctionPtr(), 0, Buffer<>(), param);
723 }
724
725 /** Check if a call node is pure within a pipeline, meaning that
726 * the same args always give the same result, and the calls can be
727 * reordered, duplicated, unified, etc without changing the
728 * meaning of anything. Not transitive - doesn't guarantee the
729 * args themselves are pure. An example of a pure Call node is
730 * sqrt. If in doubt, don't mark a Call node as pure. */
731 bool is_pure() const {
732 return (call_type == PureExtern ||
733 call_type == Image ||
734 call_type == PureIntrinsic);
735 }
736
737 bool is_intrinsic() const {
738 return (call_type == Intrinsic ||
739 call_type == PureIntrinsic);
740 }
741
742 bool is_intrinsic(IntrinsicOp op) const {
743 return is_intrinsic() && this->name == get_intrinsic_name(op);
744 }
745
746 bool is_intrinsic(std::initializer_list<IntrinsicOp> intrinsics) const {
747 for (IntrinsicOp i : intrinsics) {
748 if (is_intrinsic(i)) {
749 return true;
750 }
751 }
752 return false;
753 }
754
755 bool is_tag() const {
756 return is_intrinsic({Call::likely, Call::likely_if_innermost});
757 }
758
759 /** Returns a pointer to a call node if the expression is a call to
760 * one of the requested intrinsics. */
761 static const Call *as_intrinsic(const Expr &e, std::initializer_list<IntrinsicOp> intrinsics) {
762 if (const Call *c = e.as<Call>()) {
763 for (IntrinsicOp i : intrinsics) {
764 if (c->is_intrinsic(i)) {
765 return c;
766 }
767 }
768 }
769 return nullptr;
770 }
771
772 static const Call *as_tag(const Expr &e) {
773 return as_intrinsic(e, {Call::likely, Call::likely_if_innermost});
774 }
775
776 bool is_extern() const {
777 return (call_type == Extern ||
778 call_type == ExternCPlusPlus ||
779 call_type == PureExtern);
780 }
781
782 bool is_strict_float_intrinsic() const {
783 return is_intrinsic(
784 {Call::strict_add,
785 Call::strict_div,
786 Call::strict_max,
787 Call::strict_min,
788 Call::strict_mul,
789 Call::strict_sub,
790 Call::strict_lt,
791 Call::strict_le,
792 Call::strict_eq});
793 }
794
795 static const IRNodeType _node_type = IRNodeType::Call;
796};
797
798/** A named variable. Might be a loop variable, function argument,
799 * parameter, reduction variable, or something defined by a Let or
800 * LetStmt node. */
801 struct Variable : public ExprNode<Variable> {
802 std::string name;
803
804 /** References to scalar parameters, or to the dimensions of buffer
805 * parameters hang onto those expressions. */
806 Parameter param;
807
808 /** References to properties of literal image parameters. */
809 Buffer<> image;
810
811 /** Reduction variables hang onto their domains */
812 ReductionDomain reduction_domain;
813
814 static Expr make(Type type, const std::string &name) {
815 return make(type, name, Buffer<>(), Parameter(), ReductionDomain());
816 }
817
818 static Expr make(Type type, const std::string &name, Parameter param) {
819 return make(type, name, Buffer<>(), std::move(param), ReductionDomain());
820 }
821
822 static Expr make(Type type, const std::string &name, const Buffer<> &image) {
823 return make(type, name, image, Parameter(), ReductionDomain());
824 }
825
826 static Expr make(Type type, const std::string &name, ReductionDomain reduction_domain) {
827 return make(type, name, Buffer<>(), Parameter(), std::move(reduction_domain));
828 }
829
830 static Expr make(Type type, const std::string &name, Buffer<> image,
831 Parameter param, ReductionDomain reduction_domain);
832
833 static const IRNodeType _node_type = IRNodeType::Variable;
834};
835
836/** A for loop. Execute the 'body' statement for all values of the
837 * variable 'name' from 'min' to 'min + extent'. There are four
838 * types of For nodes. A 'Serial' for loop is a conventional
839 * one. In a 'Parallel' for loop, each iteration of the loop
840 * happens in parallel or in some unspecified order. In a
841 * 'Vectorized' for loop, each iteration maps to one SIMD lane,
842 * and the whole loop is executed in one shot. For this case,
843 * 'extent' must be some small integer constant (probably 4, 8, or
844 * 16). An 'Unrolled' for loop compiles to a completely unrolled
845 * version of the loop. Each iteration becomes its own
846 * statement. Again in this case, 'extent' should be a small
847 * integer constant. */
848 struct For : public StmtNode<For> {
849 std::string name;
850 Expr min, extent;
851 ForType for_type;
852 DeviceAPI device_api;
853 Stmt body;
854 Partition partition_policy;
855
856 static Stmt make(const std::string &name,
857 Expr min, Expr extent,
858 ForType for_type, Partition partition_policy,
859 DeviceAPI device_api,
860 Stmt body);
861
862 bool is_unordered_parallel() const {
863 return Halide::Internal::is_unordered_parallel(for_type);
864 }
865 bool is_parallel() const {
866 return Halide::Internal::is_parallel(for_type);
867 }
868
869 static const IRNodeType _node_type = IRNodeType::For;
870};
871
872 struct Acquire : public StmtNode<Acquire> {
873 Expr semaphore;
874 Expr count;
875 Stmt body;
876
877 static Stmt make(Expr semaphore, Expr count, Stmt body);
878
879 static const IRNodeType _node_type = IRNodeType::Acquire;
880};
881
882/** Construct a new vector by taking elements from another sequence of
883 * vectors. */
884 struct Shuffle : public ExprNode<Shuffle> {
885 std::vector<Expr> vectors;
886
887 /** Indices indicating which vector element to place into the
888 * result. The elements are numbered by their position in the
889 * concatenation of the vector arguments. */
890 std::vector<int> indices;
891
892 static Expr make(const std::vector<Expr> &vectors,
893 const std::vector<int> &indices);
894
895 /** Convenience constructor for making a shuffle representing an
896 * interleaving of vectors of the same length. */
897 static Expr make_interleave(const std::vector<Expr> &vectors);
898
899 /** Convenience constructor for making a shuffle representing a
900 * concatenation of the vectors. */
901 static Expr make_concat(const std::vector<Expr> &vectors);
902
903 /** Convenience constructor for making a shuffle representing a
904 * broadcast of a vector. */
905 static Expr make_broadcast(Expr vector, int factor);
906
907 /** Convenience constructor for making a shuffle representing a
908 * contiguous subset of a vector. */
909 static Expr make_slice(Expr vector, int begin, int stride, int size);
910
911 /** Convenience constructor for making a shuffle representing
912 * extracting a single element. */
913 static Expr make_extract_element(Expr vector, int i);
914
915 /** Check if this shuffle is an interleaving of the vector
916 * arguments. */
917 bool is_interleave() const;
918
919 /** Check if this shuffle can be represented as a repeating pattern that
920 * repeats the same shuffle of the single input vector some number of times.
921 * For example: 0, 3, 1, 1, 0, 3, 1, 1, ....., 0, 3, 1, 1
922 */
923 bool is_broadcast() const;
924 int broadcast_factor() const;
925
926 /** Check if this shuffle is a concatenation of the vector
927 * arguments. */
928 bool is_concat() const;
929
930 /** Check if this shuffle is a contiguous strict subset of the
931 * vector arguments, and if so, the offset and stride of the
932 * slice. */
933 ///@{
934 bool is_slice() const;
935 int slice_begin() const {
936 return indices[0];
937 }
938 int slice_stride() const {
939 return indices.size() >= 2 ? indices[1] - indices[0] : 1;
940 }
941 ///@}
942
943 /** Check if this shuffle is extracting a scalar from the vector
944 * arguments. */
945 bool is_extract_element() const;
946
947 /** Returns the sequence of vector and lane indices that represent each
948 * entry to be used for the shuffled vector */
949 std::vector<std::pair<int, int>> vector_and_lane_indices() const;
950
951 static const IRNodeType _node_type = IRNodeType::Shuffle;
952};
953
954/** Represent a multi-dimensional region of a Func or an ImageParam that
955 * needs to be prefetched. */
956 struct Prefetch : public StmtNode<Prefetch> {
957 std::string name;
958 std::vector<Type> types;
959 Region bounds;
960 PrefetchDirective prefetch;
961 Expr condition;
962
963 Stmt body;
964
965 static Stmt make(const std::string &name, const std::vector<Type> &types,
966 const Region &bounds,
967 const PrefetchDirective &prefetch,
968 Expr condition, Stmt body);
969
970 static const IRNodeType _node_type = IRNodeType::Prefetch;
971};
972
973/**
974 * Represents a location where storage will be hoisted to for a Func / Realize
975 * node with a given name.
976 *
977 */
978 struct HoistedStorage : public StmtNode<HoistedStorage> {
979 std::string name;
980 Stmt body;
981
982 static Stmt make(const std::string &name,
983 Stmt body);
984
985 static const IRNodeType _node_type = IRNodeType::HoistedStorage;
986};
987
988/** Lock all the Store nodes in the body statement.
989 * Typically the lock is implemented by an atomic operation
990 * (e.g. atomic add or atomic compare-and-swap).
991 * However, if necessary, the node can access a mutex buffer through
992 * mutex_name and mutex_args, by lowering this node into
993 * calls to acquire and release the lock. */
994 struct Atomic : public StmtNode<Atomic> {
995 std::string producer_name;
996 std::string mutex_name; // empty string if not using mutex
997 Stmt body;
998
999 static Stmt make(const std::string &producer_name,
1000 const std::string &mutex_name,
1001 Stmt body);
1002
1003 static const IRNodeType _node_type = IRNodeType::Atomic;
1004};
1005
1006/** Horizontally reduce a vector to a scalar or narrower vector using
1007 * the given commutative and associative binary operator. The reduction
1008 * factor is dictated by the number of lanes in the input and output
1009 * types. Groups of adjacent lanes are combined. The number of lanes
1010 * in the input type must be a divisor of the number of lanes of the
1011 * output type. */
1012 struct VectorReduce : public ExprNode<VectorReduce> {
1013 // 99.9% of the time people will use this for horizontal addition,
1014 // but these are all of our commutative and associative primitive
1015 // operators.
1016 typedef enum {
1017 Add,
1018 SaturatingAdd,
1019 Mul,
1020 Min,
1021 Max,
1022 And,
1023 Or,
1024 } Operator;
1025
1026 Expr value;
1027 Operator op;
1028
1029 static Expr make(Operator op, Expr vec, int lanes);
1030
1031 static const IRNodeType _node_type = IRNodeType::VectorReduce;
1032};
1033
1034} // namespace Internal
1035} // namespace Halide
1036
1037#endif
Buffer.h
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
FunctionPtr.h
LoopPartitioningDirective.h
Defines the Partition enum.
ModulusRemainder.h
Routines for statically determining what expressions are divisible by.
Parameter.h
Defines the internal representation of parameters to halide piplines.
PrefetchDirective.h
Defines the PrefetchDirective struct.
Reduction.h
Defines internal classes related to Reduction Domains.
Type.h
Defines halide types.
HALIDE_EXPORT
#define HALIDE_EXPORT
Definition: Util.h:39
Halide::Buffer<>
Halide::Buffer::type
Type type() const
Definition: Buffer.h:534
Halide::Buffer::name
const std::string & name() const
Definition: Buffer.h:366
Halide::Internal::Function
A reference-counted handle to Halide's internal representation of a function.
Definition: Function.h:39
Halide::Internal::ReductionDomain
A reference-counted handle on a reduction domain, which is just a vector of ReductionVariable.
Definition: Reduction.h:38
Halide::Parameter
A reference-counted handle to a parameter to a halide pipeline.
Definition: Parameter.h:40
Halide::Parameter::name
const std::string & name() const
Get the name of this parameter.
Halide::Parameter::type
Type type() const
Get the type of this parameter.
Halide::Internal::ArgInfoKind::Function
@ Function
Halide::Internal::begin
auto begin(reverse_adaptor< T > i)
Definition: Util.h:478
Halide::Internal::ForType
ForType
An enum describing a type of loop traversal.
Definition: Expr.h:406
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::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::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::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::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::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::DeviceAPI
DeviceAPI
An enum describing a type of device API.
Definition: DeviceAPI.h:15
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::Partition
Partition
Different ways to handle loops with a potentially optimizable boundary conditions.
Definition: LoopPartitioningDirective.h:16
int32_t
signed __INT32_TYPE__ int32_t
Definition: runtime_internal.h:24
Halide::Expr
A fragment of Halide syntax.
Definition: Expr.h:258
Halide::Expr::type
HALIDE_ALWAYS_INLINE Type type() const
Get the type of this expression node.
Definition: Expr.h:327
Halide::Internal::Acquire
Definition: IR.h:872
Halide::Internal::Acquire::count
Expr count
Definition: IR.h:874
Halide::Internal::Acquire::_node_type
static const IRNodeType _node_type
Definition: IR.h:879
Halide::Internal::Acquire::body
Stmt body
Definition: IR.h:875
Halide::Internal::Acquire::make
static Stmt make(Expr semaphore, Expr count, Stmt body)
Halide::Internal::Acquire::semaphore
Expr semaphore
Definition: IR.h:873
Halide::Internal::Add
The sum of two expressions.
Definition: IR.h:56
Halide::Internal::Add::b
Expr b
Definition: IR.h:57
Halide::Internal::Add::make
static Expr make(Expr a, Expr b)
Halide::Internal::Add::_node_type
static const IRNodeType _node_type
Definition: IR.h:61
Halide::Internal::Add::a
Expr a
Definition: IR.h:57
Halide::Internal::Allocate
Allocate a scratch area called with the given name, type, and size.
Definition: IR.h:371
Halide::Internal::Allocate::type
Type type
Definition: IR.h:373
Halide::Internal::Allocate::name
std::string name
Definition: IR.h:372
Halide::Internal::Allocate::condition
Expr condition
Definition: IR.h:378
Halide::Internal::Allocate::new_expr
Expr new_expr
Definition: IR.h:387
Halide::Internal::Allocate::extents
std::vector< Expr > extents
Definition: IR.h:375
Halide::Internal::Allocate::constant_allocation_size
static int32_t constant_allocation_size(const std::vector< Expr > &extents, const std::string &name)
A routine to check if the extents are all constants, and if so verify the total size is less than 2^3...
Halide::Internal::Allocate::_node_type
static const IRNodeType _node_type
Definition: IR.h:409
Halide::Internal::Allocate::constant_allocation_size
int32_t constant_allocation_size() const
Halide::Internal::Allocate::memory_type
MemoryType memory_type
Definition: IR.h:374
Halide::Internal::Allocate::body
Stmt body
Definition: IR.h:394
Halide::Internal::Allocate::free_function
std::string free_function
Definition: IR.h:388
Halide::Internal::Allocate::padding
int padding
Definition: IR.h:392
Halide::Internal::Allocate::make
static Stmt make(const std::string &name, Type type, MemoryType memory_type, const std::vector< Expr > &extents, Expr condition, Stmt body, Expr new_expr=Expr(), const std::string &free_function=std::string(), int padding=0)
Halide::Internal::And
Logical and - are both expressions true.
Definition: IR.h:175
Halide::Internal::And::b
Expr b
Definition: IR.h:176
Halide::Internal::And::a
Expr a
Definition: IR.h:176
Halide::Internal::And::_node_type
static const IRNodeType _node_type
Definition: IR.h:180
Halide::Internal::And::make
static Expr make(Expr a, Expr b)
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::AssertStmt::_node_type
static const IRNodeType _node_type
Definition: IR.h:301
Halide::Internal::AssertStmt::message
Expr message
Definition: IR.h:297
Halide::Internal::AssertStmt::condition
Expr condition
Definition: IR.h:296
Halide::Internal::AssertStmt::make
static Stmt make(Expr condition, Expr message)
Halide::Internal::Atomic
Lock all the Store nodes in the body statement.
Definition: IR.h:994
Halide::Internal::Atomic::body
Stmt body
Definition: IR.h:997
Halide::Internal::Atomic::_node_type
static const IRNodeType _node_type
Definition: IR.h:1003
Halide::Internal::Atomic::make
static Stmt make(const std::string &producer_name, const std::string &mutex_name, Stmt body)
Halide::Internal::Atomic::mutex_name
std::string mutex_name
Definition: IR.h:996
Halide::Internal::Atomic::producer_name
std::string producer_name
Definition: IR.h:995
Halide::Internal::BaseExprNode::type
Type type
Definition: Expr.h:148
Halide::Internal::Block
A sequence of statements to be executed in-order.
Definition: IR.h:442
Halide::Internal::Block::rest
Stmt rest
Definition: IR.h:443
Halide::Internal::Block::first
Stmt first
Definition: IR.h:443
Halide::Internal::Block::make
static Stmt make(const std::vector< Stmt > &stmts)
Construct zero or more Blocks to invoke a list of statements in order.
Halide::Internal::Block::make
static Stmt make(Stmt first, Stmt rest)
Halide::Internal::Block::_node_type
static const IRNodeType _node_type
Definition: IR.h:451
Halide::Internal::Broadcast
A vector with 'lanes' elements, in which every element is 'value'.
Definition: IR.h:259
Halide::Internal::Broadcast::make
static Expr make(Expr value, int lanes)
Halide::Internal::Broadcast::value
Expr value
Definition: IR.h:260
Halide::Internal::Broadcast::_node_type
static const IRNodeType _node_type
Definition: IR.h:265
Halide::Internal::Broadcast::lanes
int lanes
Definition: IR.h:261
Halide::Internal::Call
A function call.
Definition: IR.h:490
Halide::Internal::Call::make
static Expr make(Type type, const std::string &name, const std::vector< Expr > &args, CallType call_type, FunctionPtr func=FunctionPtr(), int value_index=0, Buffer<> image=Buffer<>(), Parameter param=Parameter())
Halide::Internal::Call::buffer_get_max
static HALIDE_EXPORT ConstString buffer_get_max
Definition: IR.h:671
Halide::Internal::Call::as_tag
static const Call * as_tag(const Expr &e)
Definition: IR.h:772
Halide::Internal::Call::make
static Expr make(const Function &func, const std::vector< Expr > &args, int idx=0)
Convenience constructor for calls to other halide functions.
Halide::Internal::Call::buffer_get_host_dirty
static HALIDE_EXPORT ConstString buffer_get_host_dirty
Definition: IR.h:676
Halide::Internal::Call::buffer_set_bounds
static HALIDE_EXPORT ConstString buffer_set_bounds
Definition: IR.h:685
Halide::Internal::Call::ConstString
const char *const ConstString
Definition: IR.h:509
Halide::Internal::Call::is_tag
bool is_tag() const
Definition: IR.h:755
Halide::Internal::Call::as_intrinsic
static const Call * as_intrinsic(const Expr &e, std::initializer_list< IntrinsicOp > intrinsics)
Returns a pointer to a call node if the expression is a call to one of the requested intrinsics.
Definition: IR.h:761
Halide::Internal::Call::is_strict_float_intrinsic
bool is_strict_float_intrinsic() const
Definition: IR.h:782
Halide::Internal::Call::IntrinsicOp
IntrinsicOp
Definition: IR.h:518
Halide::Internal::Call::get_user_context
@ get_user_context
Definition: IR.h:549
Halide::Internal::Call::strict_min
@ strict_min
Definition: IR.h:624
Halide::Internal::Call::strict_div
@ strict_div
Definition: IR.h:619
Halide::Internal::Call::call_cached_indirect_function
@ call_cached_indirect_function
Definition: IR.h:531
Halide::Internal::Call::signed_integer_overflow
@ signed_integer_overflow
Definition: IR.h:595
Halide::Internal::Call::stringify
@ stringify
Definition: IR.h:629
Halide::Internal::Call::hvx_scatter
@ hvx_scatter
Definition: IR.h:554
Halide::Internal::Call::gpu_thread_barrier
@ gpu_thread_barrier
Definition: IR.h:550
Halide::Internal::Call::require
@ require
Definition: IR.h:576
Halide::Internal::Call::if_then_else
@ if_then_else
Definition: IR.h:557
Halide::Internal::Call::skip_stages_marker
@ skip_stages_marker
Definition: IR.h:600
Halide::Internal::Call::widen_right_mul
@ widen_right_mul
Definition: IR.h:646
Halide::Internal::Call::declare_box_touched
@ declare_box_touched
Definition: IR.h:540
Halide::Internal::Call::mod_round_to_zero
@ mod_round_to_zero
Definition: IR.h:567
Halide::Internal::Call::register_destructor
@ register_destructor
Definition: IR.h:575
Halide::Internal::Call::widening_mul
@ widening_mul
Definition: IR.h:651
Halide::Internal::Call::count_leading_zeros
@ count_leading_zeros
Definition: IR.h:537
Halide::Internal::Call::unsafe_promise_clamped
@ unsafe_promise_clamped
Definition: IR.h:640
Halide::Internal::Call::saturating_add
@ saturating_add
Definition: IR.h:588
Halide::Internal::Call::rewrite_buffer
@ rewrite_buffer
Definition: IR.h:579
Halide::Internal::Call::abs
@ abs
Definition: IR.h:519
Halide::Internal::Call::prefetch
@ prefetch
Definition: IR.h:571
Halide::Internal::Call::alloca
@ alloca
Definition: IR.h:522
Halide::Internal::Call::concat_bits
@ concat_bits
Definition: IR.h:536
Halide::Internal::Call::round
@ round
Definition: IR.h:582
Halide::Internal::Call::div_round_to_zero
@ div_round_to_zero
Definition: IR.h:541
Halide::Internal::Call::mux
@ mux
Definition: IR.h:569
Halide::Internal::Call::debug_to_file
@ debug_to_file
Definition: IR.h:539
Halide::Internal::Call::make_struct
@ make_struct
Definition: IR.h:565
Halide::Internal::Call::halving_add
@ halving_add
Definition: IR.h:551
Halide::Internal::Call::shift_left
@ shift_left
Definition: IR.h:593
Halide::Internal::Call::promise_clamped
@ promise_clamped
Definition: IR.h:573
Halide::Internal::Call::return_second
@ return_second
Definition: IR.h:578
Halide::Internal::Call::strict_mul
@ strict_mul
Definition: IR.h:625
Halide::Internal::Call::mul_shift_right
@ mul_shift_right
Definition: IR.h:568
Halide::Internal::Call::saturating_sub
@ saturating_sub
Definition: IR.h:589
Halide::Internal::Call::widening_add
@ widening_add
Definition: IR.h:650
Halide::Internal::Call::memoize_expr
@ memoize_expr
Definition: IR.h:566
Halide::Internal::Call::widening_sub
@ widening_sub
Definition: IR.h:654
Halide::Internal::Call::saturating_cast
@ saturating_cast
Definition: IR.h:590
Halide::Internal::Call::unreachable
@ unreachable
Definition: IR.h:639
Halide::Internal::Call::if_then_else_mask
@ if_then_else_mask
Definition: IR.h:558
Halide::Internal::Call::add_image_checks_marker
@ add_image_checks_marker
Definition: IR.h:521
Halide::Internal::Call::bool_to_mask
@ bool_to_mask
Definition: IR.h:527
Halide::Internal::Call::sliding_window_marker
@ sliding_window_marker
Definition: IR.h:609
Halide::Internal::Call::rounding_mul_shift_right
@ rounding_mul_shift_right
Definition: IR.h:585
Halide::Internal::Call::strict_eq
@ strict_eq
Definition: IR.h:620
Halide::Internal::Call::random
@ random
Definition: IR.h:574
Halide::Internal::Call::load_typed_struct_member
@ load_typed_struct_member
Definition: IR.h:564
Halide::Internal::Call::hvx_scatter_acc
@ hvx_scatter_acc
Definition: IR.h:555
Halide::Internal::Call::shift_right
@ shift_right
Definition: IR.h:594
Halide::Internal::Call::select_mask
@ select_mask
Definition: IR.h:592
Halide::Internal::Call::popcount
@ popcount
Definition: IR.h:570
Halide::Internal::Call::target_os_is
@ target_os_is
Definition: IR.h:636
Halide::Internal::Call::extract_bits
@ extract_bits
Definition: IR.h:547
Halide::Internal::Call::halving_sub
@ halving_sub
Definition: IR.h:552
Halide::Internal::Call::bundle
@ bundle
Definition: IR.h:530
Halide::Internal::Call::count_trailing_zeros
@ count_trailing_zeros
Definition: IR.h:538
Halide::Internal::Call::likely
@ likely
Definition: IR.h:562
Halide::Internal::Call::widen_right_add
@ widen_right_add
Definition: IR.h:644
Halide::Internal::Call::strict_add
@ strict_add
Definition: IR.h:618
Halide::Internal::Call::bitwise_and
@ bitwise_and
Definition: IR.h:523
Halide::Internal::Call::image_load
@ image_load
Definition: IR.h:559
Halide::Internal::Call::widening_shift_left
@ widening_shift_left
Definition: IR.h:652
Halide::Internal::Call::require_mask
@ require_mask
Definition: IR.h:577
Halide::Internal::Call::dynamic_shuffle
@ dynamic_shuffle
Definition: IR.h:542
Halide::Internal::Call::scatter_gather
@ scatter_gather
Definition: IR.h:591
Halide::Internal::Call::target_bits
@ target_bits
Definition: IR.h:633
Halide::Internal::Call::image_store
@ image_store
Definition: IR.h:560
Halide::Internal::Call::strict_sub
@ strict_sub
Definition: IR.h:626
Halide::Internal::Call::bitwise_not
@ bitwise_not
Definition: IR.h:524
Halide::Internal::Call::bitwise_or
@ bitwise_or
Definition: IR.h:525
Halide::Internal::Call::lerp
@ lerp
Definition: IR.h:561
Halide::Internal::Call::absd
@ absd
Definition: IR.h:520
Halide::Internal::Call::strict_le
@ strict_le
Definition: IR.h:621
Halide::Internal::Call::widen_right_sub
@ widen_right_sub
Definition: IR.h:648
Halide::Internal::Call::rounding_shift_right
@ rounding_shift_right
Definition: IR.h:587
Halide::Internal::Call::hvx_scatter_release
@ hvx_scatter_release
Definition: IR.h:556
Halide::Internal::Call::target_has_feature
@ target_has_feature
Definition: IR.h:634
Halide::Internal::Call::widening_shift_right
@ widening_shift_right
Definition: IR.h:653
Halide::Internal::Call::IntrinsicOpCount
@ IntrinsicOpCount
Definition: IR.h:658
Halide::Internal::Call::sorted_avg
@ sorted_avg
Definition: IR.h:612
Halide::Internal::Call::strict_max
@ strict_max
Definition: IR.h:623
Halide::Internal::Call::rounding_halving_add
@ rounding_halving_add
Definition: IR.h:584
Halide::Internal::Call::hvx_gather
@ hvx_gather
Definition: IR.h:553
Halide::Internal::Call::extract_mask_element
@ extract_mask_element
Definition: IR.h:548
Halide::Internal::Call::bitwise_xor
@ bitwise_xor
Definition: IR.h:526
Halide::Internal::Call::rounding_shift_left
@ rounding_shift_left
Definition: IR.h:586
Halide::Internal::Call::likely_if_innermost
@ likely_if_innermost
Definition: IR.h:563
Halide::Internal::Call::profiling_enable_instance_marker
@ profiling_enable_instance_marker
Definition: IR.h:572
Halide::Internal::Call::target_arch_is
@ target_arch_is
Definition: IR.h:632
Halide::Internal::Call::target_natural_vector_size
@ target_natural_vector_size
Definition: IR.h:635
Halide::Internal::Call::cast_mask
@ cast_mask
Definition: IR.h:532
Halide::Internal::Call::undef
@ undef
Definition: IR.h:638
Halide::Internal::Call::strict_lt
@ strict_lt
Definition: IR.h:622
Halide::Internal::Call::get_runtime_vscale
@ get_runtime_vscale
Definition: IR.h:656
Halide::Internal::Call::size_of_halide_buffer_t
@ size_of_halide_buffer_t
Definition: IR.h:596
Halide::Internal::Call::is_extern
bool is_extern() const
Definition: IR.h:776
Halide::Internal::Call::CallType
CallType
Definition: IR.h:493
Halide::Internal::Call::Extern
@ Extern
A call to an external C-ABI function, possibly with side-effects.
Definition: IR.h:494
Halide::Internal::Call::ExternCPlusPlus
@ ExternCPlusPlus
A call to an external C-ABI function, possibly with side-effects.
Definition: IR.h:495
Halide::Internal::Call::Image
@ Image
A load from an input image.
Definition: IR.h:493
Halide::Internal::Call::Halide
@ Halide
A call to a Func.
Definition: IR.h:497
Halide::Internal::Call::Intrinsic
@ Intrinsic
A possibly-side-effecty compiler intrinsic, which has special handling during codegen.
Definition: IR.h:498
Halide::Internal::Call::PureExtern
@ PureExtern
A call to a guaranteed-side-effect-free external function.
Definition: IR.h:496
Halide::Internal::Call::PureIntrinsic
@ PureIntrinsic
A side-effect-free version of the above.
Definition: IR.h:499
Halide::Internal::Call::name
std::string name
Definition: IR.h:491
Halide::Internal::Call::buffer_get_min
static HALIDE_EXPORT ConstString buffer_get_min
Definition: IR.h:668
Halide::Internal::Call::is_intrinsic
bool is_intrinsic() const
Definition: IR.h:737
Halide::Internal::Call::buffer_get_device_interface
static HALIDE_EXPORT ConstString buffer_get_device_interface
Definition: IR.h:674
Halide::Internal::Call::buffer_get_dimensions
static HALIDE_EXPORT ConstString buffer_get_dimensions
Definition: IR.h:667
Halide::Internal::Call::buffer_get_device_dirty
static HALIDE_EXPORT ConstString buffer_get_device_dirty
Definition: IR.h:677
Halide::Internal::Call::buffer_crop
static HALIDE_EXPORT ConstString buffer_crop
Definition: IR.h:684
Halide::Internal::Call::func
FunctionPtr func
Definition: IR.h:690
Halide::Internal::Call::call_type
CallType call_type
Definition: IR.h:501
Halide::Internal::Call::buffer_get_host
static HALIDE_EXPORT ConstString buffer_get_host
Definition: IR.h:672
Halide::Internal::Call::make
static Expr make(const Buffer<> &image, const std::vector< Expr > &args)
Convenience constructor for loads from concrete images.
Definition: IR.h:716
Halide::Internal::Call::buffer_get_device
static HALIDE_EXPORT ConstString buffer_get_device
Definition: IR.h:673
Halide::Internal::Call::buffer_init
static HALIDE_EXPORT ConstString buffer_init
Definition: IR.h:682
Halide::Internal::Call::image
Buffer image
Definition: IR.h:698
Halide::Internal::Call::is_pure
bool is_pure() const
Check if a call node is pure within a pipeline, meaning that the same args always give the same resul...
Definition: IR.h:731
Halide::Internal::Call::buffer_get_stride
static HALIDE_EXPORT ConstString buffer_get_stride
Definition: IR.h:670
Halide::Internal::Call::buffer_get_extent
static HALIDE_EXPORT ConstString buffer_get_extent
Definition: IR.h:669
Halide::Internal::Call::is_intrinsic
bool is_intrinsic(std::initializer_list< IntrinsicOp > intrinsics) const
Definition: IR.h:746
Halide::Internal::Call::get_intrinsic_name
static const char * get_intrinsic_name(IntrinsicOp op)
Halide::Internal::Call::is_intrinsic
bool is_intrinsic(IntrinsicOp op) const
Definition: IR.h:742
Halide::Internal::Call::make
static Expr make(const Parameter &param, const std::vector< Expr > &args)
Convenience constructor for loads from images parameters.
Definition: IR.h:721
Halide::Internal::Call::_node_type
static const IRNodeType _node_type
Definition: IR.h:795
Halide::Internal::Call::trace
static HALIDE_EXPORT ConstString trace
Definition: IR.h:686
Halide::Internal::Call::args
std::vector< Expr > args
Definition: IR.h:492
Halide::Internal::Call::buffer_get_shape
static HALIDE_EXPORT ConstString buffer_get_shape
Definition: IR.h:675
Halide::Internal::Call::make
static Expr make(Type type, IntrinsicOp op, const std::vector< Expr > &args, CallType call_type, FunctionPtr func=FunctionPtr(), int value_index=0, const Buffer<> &image=Buffer<>(), Parameter param=Parameter())
Halide::Internal::Call::param
Parameter param
Definition: IR.h:702
Halide::Internal::Call::buffer_is_bounds_query
static HALIDE_EXPORT ConstString buffer_is_bounds_query
Definition: IR.h:681
Halide::Internal::Call::buffer_get_type
static HALIDE_EXPORT ConstString buffer_get_type
Definition: IR.h:678
Halide::Internal::Call::buffer_set_device_dirty
static HALIDE_EXPORT ConstString buffer_set_device_dirty
Definition: IR.h:680
Halide::Internal::Call::buffer_set_host_dirty
static HALIDE_EXPORT ConstString buffer_set_host_dirty
Definition: IR.h:679
Halide::Internal::Call::value_index
int value_index
Definition: IR.h:694
Halide::Internal::Call::buffer_init_from_buffer
static HALIDE_EXPORT ConstString buffer_init_from_buffer
Definition: IR.h:683
Halide::Internal::Cast
The actual IR nodes begin here.
Definition: IR.h:30
Halide::Internal::Cast::_node_type
static const IRNodeType _node_type
Definition: IR.h:35
Halide::Internal::Cast::make
static Expr make(Type t, Expr v)
Halide::Internal::Cast::value
Expr value
Definition: IR.h:31
Halide::Internal::Cast::is_reinterpret
bool is_reinterpret() const
Check if the cast is equivalent to a reinterpret.
Definition: IR.h:38
Halide::Internal::Div
The ratio of two expressions.
Definition: IR.h:83
Halide::Internal::Div::_node_type
static const IRNodeType _node_type
Definition: IR.h:88
Halide::Internal::Div::b
Expr b
Definition: IR.h:84
Halide::Internal::Div::a
Expr a
Definition: IR.h:84
Halide::Internal::Div::make
static Expr make(Expr a, Expr b)
Halide::Internal::EQ
Is the first expression equal to the second.
Definition: IR.h:121
Halide::Internal::EQ::_node_type
static const IRNodeType _node_type
Definition: IR.h:126
Halide::Internal::EQ::a
Expr a
Definition: IR.h:122
Halide::Internal::EQ::b
Expr b
Definition: IR.h:122
Halide::Internal::EQ::make
static Expr make(Expr a, Expr b)
Halide::Internal::Evaluate
Evaluate and discard an expression, presumably because it has some side-effect.
Definition: IR.h:476
Halide::Internal::Evaluate::make
static Stmt make(Expr v)
Halide::Internal::Evaluate::value
Expr value
Definition: IR.h:477
Halide::Internal::Evaluate::_node_type
static const IRNodeType _node_type
Definition: IR.h:481
Halide::Internal::ExprNode
We use the "curiously recurring template pattern" to avoid duplicated code in the IR Nodes.
Definition: Expr.h:158
Halide::Internal::For
A for loop.
Definition: IR.h:848
Halide::Internal::For::partition_policy
Partition partition_policy
Definition: IR.h:854
Halide::Internal::For::min
Expr min
Definition: IR.h:850
Halide::Internal::For::name
std::string name
Definition: IR.h:849
Halide::Internal::For::device_api
DeviceAPI device_api
Definition: IR.h:852
Halide::Internal::For::for_type
ForType for_type
Definition: IR.h:851
Halide::Internal::For::is_parallel
bool is_parallel() const
Definition: IR.h:865
Halide::Internal::For::is_unordered_parallel
bool is_unordered_parallel() const
Definition: IR.h:862
Halide::Internal::For::_node_type
static const IRNodeType _node_type
Definition: IR.h:869
Halide::Internal::For::extent
Expr extent
Definition: IR.h:850
Halide::Internal::For::make
static Stmt make(const std::string &name, Expr min, Expr extent, ForType for_type, Partition partition_policy, DeviceAPI device_api, Stmt body)
Halide::Internal::For::body
Stmt body
Definition: IR.h:853
Halide::Internal::Fork
A pair of statements executed concurrently.
Definition: IR.h:457
Halide::Internal::Fork::make
static Stmt make(Stmt first, Stmt rest)
Halide::Internal::Fork::_node_type
static const IRNodeType _node_type
Definition: IR.h:462
Halide::Internal::Fork::first
Stmt first
Definition: IR.h:458
Halide::Internal::Fork::rest
Stmt rest
Definition: IR.h:458
Halide::Internal::Free
Free the resources associated with the given buffer.
Definition: IR.h:413
Halide::Internal::Free::_node_type
static const IRNodeType _node_type
Definition: IR.h:418
Halide::Internal::Free::make
static Stmt make(const std::string &name)
Halide::Internal::Free::name
std::string name
Definition: IR.h:414
Halide::Internal::FunctionPtr
A possibly-weak pointer to a Halide function.
Definition: FunctionPtr.h:27
Halide::Internal::GE
Is the first expression greater than or equal to the second.
Definition: IR.h:166
Halide::Internal::GE::a
Expr a
Definition: IR.h:167
Halide::Internal::GE::b
Expr b
Definition: IR.h:167
Halide::Internal::GE::_node_type
static const IRNodeType _node_type
Definition: IR.h:171
Halide::Internal::GE::make
static Expr make(Expr a, Expr b)
Halide::Internal::GT
Is the first expression greater than the second.
Definition: IR.h:157
Halide::Internal::GT::b
Expr b
Definition: IR.h:158
Halide::Internal::GT::a
Expr a
Definition: IR.h:158
Halide::Internal::GT::_node_type
static const IRNodeType _node_type
Definition: IR.h:162
Halide::Internal::GT::make
static Expr make(Expr a, Expr b)
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::HoistedStorage::make
static Stmt make(const std::string &name, Stmt body)
Halide::Internal::HoistedStorage::_node_type
static const IRNodeType _node_type
Definition: IR.h:985
Halide::Internal::HoistedStorage::name
std::string name
Definition: IR.h:979
Halide::Internal::HoistedStorage::body
Stmt body
Definition: IR.h:980
Halide::Internal::IRHandle::as
const T * as() const
Downcast this ir node to its actual type (e.g.
Definition: Expr.h:205
Halide::Internal::IfThenElse
An if-then-else block.
Definition: IR.h:466
Halide::Internal::IfThenElse::_node_type
static const IRNodeType _node_type
Definition: IR.h:472
Halide::Internal::IfThenElse::make
static Stmt make(Expr condition, Stmt then_case, Stmt else_case=Stmt())
Halide::Internal::IfThenElse::condition
Expr condition
Definition: IR.h:467
Halide::Internal::IfThenElse::then_case
Stmt then_case
Definition: IR.h:468
Halide::Internal::IfThenElse::else_case
Stmt else_case
Definition: IR.h:468
Halide::Internal::LE
Is the first expression less than or equal to the second.
Definition: IR.h:148
Halide::Internal::LE::b
Expr b
Definition: IR.h:149
Halide::Internal::LE::make
static Expr make(Expr a, Expr b)
Halide::Internal::LE::a
Expr a
Definition: IR.h:149
Halide::Internal::LE::_node_type
static const IRNodeType _node_type
Definition: IR.h:153
Halide::Internal::LT
Is the first expression less than the second.
Definition: IR.h:139
Halide::Internal::LT::a
Expr a
Definition: IR.h:140
Halide::Internal::LT::make
static Expr make(Expr a, Expr b)
Halide::Internal::LT::b
Expr b
Definition: IR.h:140
Halide::Internal::LT::_node_type
static const IRNodeType _node_type
Definition: IR.h:144
Halide::Internal::Let
A let expression, like you might find in a functional language.
Definition: IR.h:271
Halide::Internal::Let::value
Expr value
Definition: IR.h:273
Halide::Internal::Let::name
std::string name
Definition: IR.h:272
Halide::Internal::Let::body
Expr body
Definition: IR.h:273
Halide::Internal::Let::make
static Expr make(const std::string &name, Expr value, Expr body)
Halide::Internal::Let::_node_type
static const IRNodeType _node_type
Definition: IR.h:277
Halide::Internal::LetStmt
The statement form of a let node.
Definition: IR.h:282
Halide::Internal::LetStmt::make
static Stmt make(const std::string &name, Expr value, Stmt body)
Halide::Internal::LetStmt::name
std::string name
Definition: IR.h:283
Halide::Internal::LetStmt::_node_type
static const IRNodeType _node_type
Definition: IR.h:289
Halide::Internal::LetStmt::value
Expr value
Definition: IR.h:284
Halide::Internal::LetStmt::body
Stmt body
Definition: IR.h:285
Halide::Internal::Load
Load a value from a named symbol if predicate is true.
Definition: IR.h:217
Halide::Internal::Load::predicate
Expr predicate
Definition: IR.h:220
Halide::Internal::Load::name
std::string name
Definition: IR.h:218
Halide::Internal::Load::image
Buffer image
Definition: IR.h:224
Halide::Internal::Load::index
Expr index
Definition: IR.h:220
Halide::Internal::Load::make
static Expr make(Type type, const std::string &name, Expr index, Buffer<> image, Parameter param, Expr predicate, ModulusRemainder alignment)
Halide::Internal::Load::param
Parameter param
Definition: IR.h:227
Halide::Internal::Load::_node_type
static const IRNodeType _node_type
Definition: IR.h:239
Halide::Internal::Load::alignment
ModulusRemainder alignment
Definition: IR.h:231
Halide::Internal::Max
The greater of two values.
Definition: IR.h:112
Halide::Internal::Max::b
Expr b
Definition: IR.h:113
Halide::Internal::Max::a
Expr a
Definition: IR.h:113
Halide::Internal::Max::_node_type
static const IRNodeType _node_type
Definition: IR.h:117
Halide::Internal::Max::make
static Expr make(Expr a, Expr b)
Halide::Internal::Min
The lesser of two values.
Definition: IR.h:103
Halide::Internal::Min::b
Expr b
Definition: IR.h:104
Halide::Internal::Min::a
Expr a
Definition: IR.h:104
Halide::Internal::Min::_node_type
static const IRNodeType _node_type
Definition: IR.h:108
Halide::Internal::Min::make
static Expr make(Expr a, Expr b)
Halide::Internal::Mod
The remainder of a / b.
Definition: IR.h:94
Halide::Internal::Mod::_node_type
static const IRNodeType _node_type
Definition: IR.h:99
Halide::Internal::Mod::a
Expr a
Definition: IR.h:95
Halide::Internal::Mod::b
Expr b
Definition: IR.h:95
Halide::Internal::Mod::make
static Expr make(Expr a, Expr b)
Halide::Internal::ModulusRemainder
The result of modulus_remainder analysis.
Definition: ModulusRemainder.h:33
Halide::Internal::Mul
The product of two expressions.
Definition: IR.h:74
Halide::Internal::Mul::a
Expr a
Definition: IR.h:75
Halide::Internal::Mul::b
Expr b
Definition: IR.h:75
Halide::Internal::Mul::_node_type
static const IRNodeType _node_type
Definition: IR.h:79
Halide::Internal::Mul::make
static Expr make(Expr a, Expr b)
Halide::Internal::NE
Is the first expression not equal to the second.
Definition: IR.h:130
Halide::Internal::NE::_node_type
static const IRNodeType _node_type
Definition: IR.h:135
Halide::Internal::NE::b
Expr b
Definition: IR.h:131
Halide::Internal::NE::a
Expr a
Definition: IR.h:131
Halide::Internal::NE::make
static Expr make(Expr a, Expr b)
Halide::Internal::Not
Logical not - true if the expression false.
Definition: IR.h:193
Halide::Internal::Not::make
static Expr make(Expr a)
Halide::Internal::Not::a
Expr a
Definition: IR.h:194
Halide::Internal::Not::_node_type
static const IRNodeType _node_type
Definition: IR.h:198
Halide::Internal::Or
Logical or - is at least one of the expression true.
Definition: IR.h:184
Halide::Internal::Or::make
static Expr make(Expr a, Expr b)
Halide::Internal::Or::b
Expr b
Definition: IR.h:185
Halide::Internal::Or::a
Expr a
Definition: IR.h:185
Halide::Internal::Or::_node_type
static const IRNodeType _node_type
Definition: IR.h:189
Halide::Internal::PrefetchDirective
Definition: PrefetchDirective.h:37
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::Prefetch::make
static Stmt make(const std::string &name, const std::vector< Type > &types, const Region &bounds, const PrefetchDirective &prefetch, Expr condition, Stmt body)
Halide::Internal::Prefetch::condition
Expr condition
Definition: IR.h:961
Halide::Internal::Prefetch::_node_type
static const IRNodeType _node_type
Definition: IR.h:970
Halide::Internal::Prefetch::prefetch
PrefetchDirective prefetch
Definition: IR.h:960
Halide::Internal::Prefetch::types
std::vector< Type > types
Definition: IR.h:958
Halide::Internal::Prefetch::body
Stmt body
Definition: IR.h:963
Halide::Internal::Prefetch::bounds
Region bounds
Definition: IR.h:959
Halide::Internal::Prefetch::name
std::string name
Definition: IR.h:957
Halide::Internal::ProducerConsumer
This node is a helpful annotation to do with permissions.
Definition: IR.h:315
Halide::Internal::ProducerConsumer::_node_type
static const IRNodeType _node_type
Definition: IR.h:325
Halide::Internal::ProducerConsumer::body
Stmt body
Definition: IR.h:318
Halide::Internal::ProducerConsumer::make_consume
static Stmt make_consume(const std::string &name, Stmt body)
Halide::Internal::ProducerConsumer::name
std::string name
Definition: IR.h:316
Halide::Internal::ProducerConsumer::is_producer
bool is_producer
Definition: IR.h:317
Halide::Internal::ProducerConsumer::make_produce
static Stmt make_produce(const std::string &name, Stmt body)
Halide::Internal::ProducerConsumer::make
static Stmt make(const std::string &name, bool is_producer, Stmt body)
Halide::Internal::Provide
This defines the value of a function at a multi-dimensional location.
Definition: IR.h:354
Halide::Internal::Provide::_node_type
static const IRNodeType _node_type
Definition: IR.h:362
Halide::Internal::Provide::name
std::string name
Definition: IR.h:355
Halide::Internal::Provide::predicate
Expr predicate
Definition: IR.h:358
Halide::Internal::Provide::values
std::vector< Expr > values
Definition: IR.h:356
Halide::Internal::Provide::args
std::vector< Expr > args
Definition: IR.h:357
Halide::Internal::Provide::make
static Stmt make(const std::string &name, const std::vector< Expr > &values, const std::vector< Expr > &args, const Expr &predicate)
Halide::Internal::Ramp
A linear ramp vector node.
Definition: IR.h:247
Halide::Internal::Ramp::stride
Expr stride
Definition: IR.h:248
Halide::Internal::Ramp::_node_type
static const IRNodeType _node_type
Definition: IR.h:253
Halide::Internal::Ramp::lanes
int lanes
Definition: IR.h:249
Halide::Internal::Ramp::make
static Expr make(Expr base, Expr stride, int lanes)
Halide::Internal::Ramp::base
Expr base
Definition: IR.h:248
Halide::Internal::Realize
Allocate a multi-dimensional buffer of the given type and size.
Definition: IR.h:427
Halide::Internal::Realize::bounds
Region bounds
Definition: IR.h:431
Halide::Internal::Realize::make
static Stmt make(const std::string &name, const std::vector< Type > &types, MemoryType memory_type, const Region &bounds, Expr condition, Stmt body)
Halide::Internal::Realize::memory_type
MemoryType memory_type
Definition: IR.h:430
Halide::Internal::Realize::condition
Expr condition
Definition: IR.h:432
Halide::Internal::Realize::types
std::vector< Type > types
Definition: IR.h:429
Halide::Internal::Realize::body
Stmt body
Definition: IR.h:433
Halide::Internal::Realize::_node_type
static const IRNodeType _node_type
Definition: IR.h:437
Halide::Internal::Realize::name
std::string name
Definition: IR.h:428
Halide::Internal::Reinterpret
Reinterpret value as another type, without affecting any of the bits (on little-endian systems).
Definition: IR.h:47
Halide::Internal::Reinterpret::value
Expr value
Definition: IR.h:48
Halide::Internal::Reinterpret::_node_type
static const IRNodeType _node_type
Definition: IR.h:52
Halide::Internal::Reinterpret::make
static Expr make(Type t, Expr v)
Halide::Internal::Select
A ternary operator.
Definition: IR.h:204
Halide::Internal::Select::make
static Expr make(Expr condition, Expr true_value, Expr false_value)
Halide::Internal::Select::false_value
Expr false_value
Definition: IR.h:205
Halide::Internal::Select::true_value
Expr true_value
Definition: IR.h:205
Halide::Internal::Select::condition
Expr condition
Definition: IR.h:205
Halide::Internal::Select::_node_type
static const IRNodeType _node_type
Definition: IR.h:209
Halide::Internal::Shuffle
Construct a new vector by taking elements from another sequence of vectors.
Definition: IR.h:884
Halide::Internal::Shuffle::make_slice
static Expr make_slice(Expr vector, int begin, int stride, int size)
Convenience constructor for making a shuffle representing a contiguous subset of a vector.
Halide::Internal::Shuffle::is_interleave
bool is_interleave() const
Check if this shuffle is an interleaving of the vector arguments.
Halide::Internal::Shuffle::make_extract_element
static Expr make_extract_element(Expr vector, int i)
Convenience constructor for making a shuffle representing extracting a single element.
Halide::Internal::Shuffle::vector_and_lane_indices
std::vector< std::pair< int, int > > vector_and_lane_indices() const
Returns the sequence of vector and lane indices that represent each entry to be used for the shuffled...
Halide::Internal::Shuffle::is_extract_element
bool is_extract_element() const
Check if this shuffle is extracting a scalar from the vector arguments.
Halide::Internal::Shuffle::is_broadcast
bool is_broadcast() const
Check if this shuffle can be represented as a repeating pattern that repeats the same shuffle of the ...
Halide::Internal::Shuffle::make_concat
static Expr make_concat(const std::vector< Expr > &vectors)
Convenience constructor for making a shuffle representing a concatenation of the vectors.
Halide::Internal::Shuffle::make
static Expr make(const std::vector< Expr > &vectors, const std::vector< int > &indices)
Halide::Internal::Shuffle::broadcast_factor
int broadcast_factor() const
Halide::Internal::Shuffle::_node_type
static const IRNodeType _node_type
Definition: IR.h:951
Halide::Internal::Shuffle::make_broadcast
static Expr make_broadcast(Expr vector, int factor)
Convenience constructor for making a shuffle representing a broadcast of a vector.
Halide::Internal::Shuffle::vectors
std::vector< Expr > vectors
Definition: IR.h:885
Halide::Internal::Shuffle::is_concat
bool is_concat() const
Check if this shuffle is a concatenation of the vector arguments.
Halide::Internal::Shuffle::is_slice
bool is_slice() const
Check if this shuffle is a contiguous strict subset of the vector arguments, and if so,...
Halide::Internal::Shuffle::indices
std::vector< int > indices
Indices indicating which vector element to place into the result.
Definition: IR.h:890
Halide::Internal::Shuffle::slice_stride
int slice_stride() const
Check if this shuffle is a contiguous strict subset of the vector arguments, and if so,...
Definition: IR.h:938
Halide::Internal::Shuffle::make_interleave
static Expr make_interleave(const std::vector< Expr > &vectors)
Convenience constructor for making a shuffle representing an interleaving of vectors of the same leng...
Halide::Internal::Shuffle::slice_begin
int slice_begin() const
Check if this shuffle is a contiguous strict subset of the vector arguments, and if so,...
Definition: IR.h:935
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition: Expr.h:427
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::Store::index
Expr index
Definition: IR.h:335
Halide::Internal::Store::name
std::string name
Definition: IR.h:334
Halide::Internal::Store::_node_type
static const IRNodeType _node_type
Definition: IR.h:346
Halide::Internal::Store::param
Parameter param
Definition: IR.h:337
Halide::Internal::Store::alignment
ModulusRemainder alignment
Definition: IR.h:341
Halide::Internal::Store::predicate
Expr predicate
Definition: IR.h:335
Halide::Internal::Store::value
Expr value
Definition: IR.h:335
Halide::Internal::Store::make
static Stmt make(const std::string &name, Expr value, Expr index, Parameter param, Expr predicate, ModulusRemainder alignment)
Halide::Internal::Sub
The difference of two expressions.
Definition: IR.h:65
Halide::Internal::Sub::_node_type
static const IRNodeType _node_type
Definition: IR.h:70
Halide::Internal::Sub::a
Expr a
Definition: IR.h:66
Halide::Internal::Sub::make
static Expr make(Expr a, Expr b)
Halide::Internal::Sub::b
Expr b
Definition: IR.h:66
Halide::Internal::Variable
A named variable.
Definition: IR.h:801
Halide::Internal::Variable::make
static Expr make(Type type, const std::string &name, const Buffer<> &image)
Definition: IR.h:822
Halide::Internal::Variable::make
static Expr make(Type type, const std::string &name, Parameter param)
Definition: IR.h:818
Halide::Internal::Variable::make
static Expr make(Type type, const std::string &name, Buffer<> image, Parameter param, ReductionDomain reduction_domain)
Halide::Internal::Variable::image
Buffer image
References to properties of literal image parameters.
Definition: IR.h:809
Halide::Internal::Variable::reduction_domain
ReductionDomain reduction_domain
Reduction variables hang onto their domains.
Definition: IR.h:812
Halide::Internal::Variable::make
static Expr make(Type type, const std::string &name)
Definition: IR.h:814
Halide::Internal::Variable::param
Parameter param
References to scalar parameters, or to the dimensions of buffer parameters hang onto those expression...
Definition: IR.h:806
Halide::Internal::Variable::make
static Expr make(Type type, const std::string &name, ReductionDomain reduction_domain)
Definition: IR.h:826
Halide::Internal::Variable::name
std::string name
Definition: IR.h:802
Halide::Internal::Variable::_node_type
static const IRNodeType _node_type
Definition: IR.h:833
Halide::Internal::VectorReduce
Horizontally reduce a vector to a scalar or narrower vector using the given commutative and associati...
Definition: IR.h:1012
Halide::Internal::VectorReduce::_node_type
static const IRNodeType _node_type
Definition: IR.h:1031
Halide::Internal::VectorReduce::make
static Expr make(Operator op, Expr vec, int lanes)
Halide::Internal::VectorReduce::value
Expr value
Definition: IR.h:1026
Halide::Internal::VectorReduce::op
Operator op
Definition: IR.h:1027
Halide::Internal::VectorReduce::Operator
Operator
Definition: IR.h:1016
Halide::Internal::VectorReduce::Min
@ Min
Definition: IR.h:1020
Halide::Internal::VectorReduce::Add
@ Add
Definition: IR.h:1017
Halide::Internal::VectorReduce::And
@ And
Definition: IR.h:1022
Halide::Internal::VectorReduce::Mul
@ Mul
Definition: IR.h:1019
Halide::Internal::VectorReduce::Or
@ Or
Definition: IR.h:1023
Halide::Internal::VectorReduce::Max
@ Max
Definition: IR.h:1021
Halide::Internal::VectorReduce::SaturatingAdd
@ SaturatingAdd
Definition: IR.h:1018
Halide::Type
Types in the halide type system.
Definition: Type.h:283
Halide::Type::bits
HALIDE_ALWAYS_INLINE int bits() const
Return the bit size of a single element of this type.
Definition: Type.h:349
Halide::Type::is_int_or_uint
HALIDE_ALWAYS_INLINE bool is_int_or_uint() const
Is this type an integer type of any sort?
Definition: Type.h:447