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