Halide  20.0.0
Halide compiler and libraries
Monotonic.h
Go to the documentation of this file.
1 #ifndef HALIDE_MONOTONIC_H
2 #define HALIDE_MONOTONIC_H
3 
4 /** \file
5  *
6  * Methods for computing whether expressions are monotonic
7  */
8 #include <iostream>
9 #include <string>
10 
11 #include "ConstantInterval.h"
12 #include "Scope.h"
13 
14 namespace Halide {
15 namespace Internal {
16 
17 /** Find the bounds of the derivative of an expression. The scope gives the
18  * bounds on the derivatives of any variables found. */
19 ConstantInterval derivative_bounds(const Expr &e, const std::string &var,
21 
22 /**
23  * Detect whether an expression is monotonic increasing in a variable,
24  * decreasing, or unknown.
25  */
26 enum class Monotonic { Constant,
27  Increasing,
28  Decreasing,
29  Unknown };
30 Monotonic is_monotonic(const Expr &e, const std::string &var,
32 Monotonic is_monotonic(const Expr &e, const std::string &var, const Scope<Monotonic> &scope);
33 
34 /** Emit the monotonic class in human-readable form for debugging. */
35 std::ostream &operator<<(std::ostream &stream, const Monotonic &m);
36 
38 
39 } // namespace Internal
40 } // namespace Halide
41 
42 #endif
Defines the ConstantInterval class, and operators on it.
Defines the Scope class, which is used for keeping track of names in a scope while traversing IR.
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
ConstantInterval derivative_bounds(const Expr &e, const std::string &var, const Scope< ConstantInterval > &scope=Scope< ConstantInterval >::empty_scope())
Find the bounds of the derivative of an expression.
Monotonic is_monotonic(const Expr &e, const std::string &var, const Scope< ConstantInterval > &scope=Scope< ConstantInterval >::empty_scope())
Monotonic
Detect whether an expression is monotonic increasing in a variable, decreasing, or unknown.
Definition: Monotonic.h:26
ConstantInterval operator<<(const ConstantInterval &a, const ConstantInterval &b)
void is_monotonic_test()
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
A fragment of Halide syntax.
Definition: Expr.h:258
A class to represent ranges of integers.