Halide 22.0.0 Halide compiler and libraries

ConstantBounds.h
Go to the documentation of this file.
1#ifndef HALIDE_CONSTANT_BOUNDS_H
2#define HALIDE_CONSTANT_BOUNDS_H
3
4#include "ConstantInterval.h"
5#include "Expr.h"
6#include "Scope.h"
7
8/** \file
9 * Methods for computing compile-time constant int64_t upper and lower bounds of
10 * an expression. Cheaper than symbolic bounds inference, and useful for things
11 * like instruction selection.
12 */
13
14 namespace Halide {
15 namespace Internal {
16
17/** Deduce constant integer bounds on an expression. This can be useful to
18 * decide if, for example, the expression can be cast to another type, be
19 * negated, be incremented, etc without risking overflow.
20 *
21 * Also optionally accepts a scope containing the integer bounds of any
22 * variables that may be referenced, and a cache of constant integer bounds on
23 * known Exprs, which this function will update. The cache is helpful to
24 * short-circuit large numbers of redundant queries, but it should not be used
25 * in contexts where the same Expr object may take on different values within a
26 * single Expr (i.e. before uniquify_variable_names).
27 */
28 ConstantInterval constant_integer_bounds(const Expr &e,
29 const Scope<ConstantInterval> &scope = Scope<ConstantInterval>::empty_scope(),
30 std::map<Expr, ConstantInterval, ExprCompare> *cache = nullptr);
31
32} // namespace Internal
33} // namespace Halide
34
35#endif
ConstantInterval.h
Defines the ConstantInterval class, and operators on it.
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
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::constant_integer_bounds
ConstantInterval constant_integer_bounds(const Expr &e, const Scope< ConstantInterval > &scope=Scope< ConstantInterval >::empty_scope(), std::map< Expr, ConstantInterval, ExprCompare > *cache=nullptr)
Deduce constant integer bounds on an expression.
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::ConstantInterval
A class to represent ranges of integers.
Definition: ConstantInterval.h:18