1 #ifndef HALIDE_IR_MUTATOR_H 2 #define HALIDE_IR_MUTATOR_H 43 std::vector<Expr>
mutate(
const std::vector<Expr> &exprs) {
117 std::vector<Expr>
mutate(
const std::vector<Expr> &exprs) {
123 template<
typename Mutator,
typename... Args>
125 Region new_bounds(bounds.size());
126 bool bounds_changed =
false;
128 for (
size_t i = 0; i < bounds.size(); i++) {
129 Expr old_min = bounds[i].min;
130 Expr old_extent = bounds[i].extent;
131 Expr new_min = mutator->mutate(old_min, std::forward<Args>(args)...);
132 Expr new_extent = mutator->mutate(old_extent, std::forward<Args>(args)...);
133 if (!new_min.
same_as(old_min)) {
134 bounds_changed =
true;
136 if (!new_extent.
same_as(old_extent)) {
137 bounds_changed =
true;
139 new_bounds[i] =
Range(new_min, new_extent);
141 return {new_bounds, bounds_changed};
std::vector< Range > Region
A multi-dimensional box.
std::vector< Expr > mutate(const std::vector< Expr > &exprs)
std::pair< std::vector< Expr >, bool > mutate_with_changes(const std::vector< Expr > &)
Unsigned integer constants.
The actual IR nodes begin here.
std::pair< Region, bool > mutate_region(Mutator *mutator, const Region &bounds, Args &&...args)
A helper function for mutator-like things to mutate regions.
A fragment of Halide syntax.
Is the first expression greater than the second.
A reference-counted handle to a statement node.
A single-dimensional span.
Load a value from a named symbol if predicate is true.
The difference of two expressions.
We use the "curiously recurring template pattern" to avoid duplicated code in the IR Nodes...
virtual ~IRMutator()=default
A vector with 'lanes' elements, in which every element is 'value'.
Logical and - are both expressions true.
A mutator that caches and reapplies previously-done mutations, so that it can handle graphs of IR tha...
Logical not - true if the expression false.
Horizontally reduce a vector to a scalar or narrower vector using the given commutative and associati...
Is the first expression less than the second.
The product of two expressions.
Lock all the Store nodes in the body statement.
Floating point constants.
The sum of two expressions.
A linear ramp vector node.
Allocate a multi-dimensional buffer of the given type and size.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline, and contains methods to using Halide's bounds tools to query properties of it.
Store a 'value' to the buffer called 'name' at a given 'index' if 'predicate' is true.
Allocate a scratch area called with the given name, type, and size.
std::map< Expr, Expr, ExprCompare > expr_replacements
Is the first expression greater than or equal to the second.
This defines the value of a function at a multi-dimensional location.
Represent a multi-dimensional region of a Func or an ImageParam that needs to be prefetched.
The ratio of two expressions.
Is the first expression less than or equal to the second.
Is the first expression not equal to the second.
If the 'condition' is false, then evaluate and return the message, which should be a call to an error...
Not visible externally, similar to 'static' linkage in C.
std::map< Stmt, Stmt, Stmt::Compare > stmt_replacements
Is the first expression equal to the second.
Represents a location where storage will be hoisted to for a Func / Realize node with a given name...
The greater of two values.
A pair of statements executed concurrently.
virtual Expr visit(const IntImm *)
A let expression, like you might find in a functional language.
Free the resources associated with the given buffer.
Subtypes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt) ...
HALIDE_ALWAYS_INLINE bool same_as(const IntrusivePtr &other) const
virtual Expr mutate(const Expr &expr)
This is the main interface for using a mutator.
A sequence of statements to be executed in-order.
The lesser of two values.
Reinterpret value as another type, without affecting any of the bits (on little-endian systems)...
The statement form of a let node.
A base class for passes over the IR which modify it (e.g.
Logical or - is at least one of the expression true.
std::vector< Expr > mutate(const std::vector< Expr > &exprs)
This node is a helpful annotation to do with permissions.
Evaluate and discard an expression, presumably because it has some side-effect.
Stmt mutate(const Stmt &s) override
Construct a new vector by taking elements from another sequence of vectors.