Halide 22.0.0 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 &,
25 bool remove_dead_code = true,
26 const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
27 const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
28 const std::vector<Expr> &assumptions = std::vector<Expr>());
29 Expr simplify(const Expr &,
30 bool remove_dead_code = true,
31 const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
32 const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
33 const std::vector<Expr> &assumptions = std::vector<Expr>());
34// @}
35
36/** Attempt to statically prove an expression is true using the simplifier. */
37 bool can_prove(Expr e, const Scope<Interval> &bounds = Scope<Interval>::empty_scope());
38
39/** Simplify expressions found in a statement, but don't simplify
40 * across different statements. This is safe to perform at an earlier
41 * stage in lowering than full simplification of a stmt. */
42 Stmt simplify_exprs(const Stmt &);
43
44} // namespace Internal
45} // namespace Halide
46
47#endif
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Interval.h
Defines the Interval class.
ModulusRemainder.h
Routines for statically determining what expressions are divisible by.
Scope.h
Defines the Scope class, which is used for keeping track of names in a scope while traversing IR.
Halide::Internal::Scope
A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Le...
Definition: Scope.h:94
Halide::Internal::simplify_exprs
Stmt simplify_exprs(const Stmt &)
Simplify expressions found in a statement, but don't simplify across different statements.
Halide::Internal::can_prove
bool can_prove(Expr e, const Scope< Interval > &bounds=Scope< Interval >::empty_scope())
Attempt to statically prove an expression is true using the simplifier.
Halide::Internal::simplify
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,...
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AbstractGenerator.h:19
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Expr
A fragment of Halide syntax.
Definition: Expr.h:258
Halide::Internal::Stmt
A reference-counted handle to a statement node.
Definition: Expr.h:427