Halide  19.0.0
Halide compiler and libraries
ClampUnsafeAccesses.h
Go to the documentation of this file.
1 #ifndef HALIDE_CLAMPUNSAFEACCESSES_H
2 #define HALIDE_CLAMPUNSAFEACCESSES_H
3 
4 /** \file
5  * Defines the clamp_unsafe_accesses lowering pass.
6  */
7 
8 #include "Bounds.h"
9 #include "Expr.h"
10 #include "Function.h"
11 
12 namespace Halide::Internal {
13 
14 /** Inject clamps around func calls h(...) when all the following conditions hold:
15  * 1. The call is in an indexing context, such as: f(x) = g(h(x));
16  * 2. The FuncValueBounds of h are smaller than those of its type
17  * 3. The allocation bounds of h might be wider than its compute bounds.
18  */
19 Stmt clamp_unsafe_accesses(const Stmt &s, const std::map<std::string, Function> &env, FuncValueBounds &func_bounds);
20 
21 } // namespace Halide::Internal
22 
23 #endif // HALIDE_CLAMPUNSAFEACCESSES_H
Methods for computing the upper and lower bounds of an expression, and the regions of a function read...
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Defines the internal representation of a halide function and related classes.
Stmt clamp_unsafe_accesses(const Stmt &s, const std::map< std::string, Function > &env, FuncValueBounds &func_bounds)
Inject clamps around func calls h(...) when all the following conditions hold:
std::map< std::pair< std::string, int >, Interval > FuncValueBounds
Definition: Bounds.h:15
A reference-counted handle to a statement node.
Definition: Expr.h:427