Halide
Prefetch.h
Go to the documentation of this file.
1 #ifndef HALIDE_PREFETCH_H
2 #define HALIDE_PREFETCH_H
3 
4 /** \file
5  * Defines the lowering pass that injects prefetch calls when prefetching
6  * appears in the schedule.
7  */
8 
9 #include <map>
10 #include <string>
11 #include <vector>
12 
13 namespace Halide {
14 
15 struct Target;
16 
17 namespace Internal {
18 
19 class Function;
20 struct PrefetchDirective;
21 struct Stmt;
22 
23 /** Inject placeholder prefetches to 's'. This placholder prefetch
24  * does not have explicit region to be prefetched yet. It will be computed
25  * during call to \ref inject_prefetch. */
26 Stmt inject_placeholder_prefetch(const Stmt &s, const std::map<std::string, Function> &env,
27  const std::string &prefix,
28  const std::vector<PrefetchDirective> &prefetches);
29 /** Compute the actual region to be prefetched and place it to the
30  * placholder prefetch. Wrap the prefetch call with condition when
31  * applicable. */
32 Stmt inject_prefetch(const Stmt &s, const std::map<std::string, Function> &env);
33 
34 /** Reduce a multi-dimensional prefetch into a prefetch of lower dimension
35  * (max dimension of the prefetch is specified by target architecture).
36  * This keeps the 'max_dim' innermost dimensions and adds loops for the rest
37  * of the dimensions. If maximum prefetched-byte-size is specified (depending
38  * on the architecture), this also adds an outer loops that tile the prefetches. */
39 Stmt reduce_prefetch_dimension(Stmt stmt, const Target &t);
40 
41 } // namespace Internal
42 } // namespace Halide
43 
44 #endif
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AddAtomicMutex.h:21
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.
Halide::Internal::IOKind::Function
@ Function
Halide::Internal::reduce_prefetch_dimension
Stmt reduce_prefetch_dimension(Stmt stmt, const Target &t)
Reduce a multi-dimensional prefetch into a prefetch of lower dimension (max dimension of the prefetch...
Halide::Internal::inject_prefetch
Stmt inject_prefetch(const Stmt &s, const std::map< std::string, Function > &env)
Compute the actual region to be prefetched and place it to the placholder prefetch.
Halide::Internal::inject_placeholder_prefetch
Stmt inject_placeholder_prefetch(const Stmt &s, const std::map< std::string, Function > &env, const std::string &prefix, const std::vector< PrefetchDirective > &prefetches)
Inject placeholder prefetches to 's'.