Halide  17.0.2
Halide compiler and libraries
Simplify.h
Go to the documentation of this file.
1 #ifndef HALIDE_SIMPLIFY_H
2 #define HALIDE_SIMPLIFY_H
3 
4 /** \file
5  * Methods for simplifying halide statements and expressions
6  */
7 
8 #include "Expr.h"
9 #include "Interval.h"
10 #include "ModulusRemainder.h"
11 #include "Scope.h"
12 
13 namespace Halide {
14 namespace Internal {
15 
16 /** Perform a wide range of simplifications to expressions and statements,
17  * including constant folding, substituting in trivial values, arithmetic
18  * rearranging, etc. Simplifies across let statements, so must not be called on
19  * stmts with dangling or repeated variable names. Can optionally be passed
20  * known bounds of any variables, known alignment properties, and any other
21  * Exprs that should be assumed to be true.
22  */
23 // @{
24 Stmt simplify(const Stmt &, bool remove_dead_code = true,
25  const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
26  const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
27  const std::vector<Expr> &assumptions = std::vector<Expr>());
28 Expr simplify(const Expr &, bool remove_dead_code = true,
29  const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
30  const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
31  const std::vector<Expr> &assumptions = std::vector<Expr>());
32 // @}
33 
34 /** Attempt to statically prove an expression is true using the simplifier. */
35 bool can_prove(Expr e, const Scope<Interval> &bounds = Scope<Interval>::empty_scope());
36 
37 /** Simplify expressions found in a statement, but don't simplify
38  * across different statements. This is safe to perform at an earlier
39  * stage in lowering than full simplification of a stmt. */
40 Stmt simplify_exprs(const Stmt &);
41 
42 } // namespace Internal
43 } // namespace Halide
44 
45 #endif
Routines for statically determining what expressions are divisible by.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline, and contains methods to using Halide&#39;s bounds tools to query properties of it.
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt) ...
bool can_prove(Expr e, const Scope< Interval > &bounds=Scope< Interval >::empty_scope())
Attempt to statically prove an expression is true using the simplifier.
Stmt simplify(const Stmt &, bool remove_dead_code=true, const Scope< Interval > &bounds=Scope< Interval >::empty_scope(), const Scope< ModulusRemainder > &alignment=Scope< ModulusRemainder >::empty_scope(), const std::vector< Expr > &assumptions=std::vector< Expr >())
Perform a wide range of simplifications to expressions and statements, including constant folding...
Not visible externally, similar to &#39;static&#39; linkage in C.
Defines the Scope class, which is used for keeping track of names in a scope while traversing IR...
static const Scope< T > & empty_scope()
A const ref to an empty scope.
Definition: Scope.h:120
Stmt simplify_exprs(const Stmt &)
Simplify expressions found in a statement, but don&#39;t simplify across different statements.
Defines the Interval class.