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 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 &,
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
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::simplify
Stmt simplify(const Stmt &, 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::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
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