Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
CSE.h
Go to the documentation of this file.
1#ifndef HALIDE_INTERNAL_CSE_H
2#define HALIDE_INTERNAL_CSE_H
3
4/** \file
5 * Defines a pass for introducing let expressions to wrap common sub-expressions. */
6
7#include "Expr.h"
8
9 namespace Halide {
10 namespace Internal {
11
12/** Replace each common sub-expression in the argument with a
13 * variable, and wrap the resulting expr in a let statement giving a
14 * value to that variable.
15 *
16 * This is important to do within Halide (instead of punting to llvm),
17 * because exprs that come in from the front-end are small when
18 * considered as a graph, but combinatorially large when considered as
19 * a tree. For an example of a such a case, see
20 * test/code_explosion.cpp
21 *
22 * The last parameter determines whether all common subexpressions are
23 * lifted, or only those that the simplifier would not subsitute back
24 * in (e.g. addition of a constant).
25 */
26 Expr common_subexpression_elimination(const Expr &, bool lift_all = false);
27
28/** Do common-subexpression-elimination on each expression in a
29 * statement. Does not introduce let statements. */
30 Stmt common_subexpression_elimination(const Stmt &, bool lift_all = false);
31
32 void cse_test();
33
34} // namespace Internal
35} // namespace Halide
36
37#endif
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Halide::Internal::common_subexpression_elimination
Expr common_subexpression_elimination(const Expr &, bool lift_all=false)
Replace each common sub-expression in the argument with a variable, and wrap the resulting expr in a ...
Halide::Internal::cse_test
void cse_test()
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::cast
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
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