Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
Memoization.h
Go to the documentation of this file.
1#ifndef HALIDE_INTERNAL_CACHING_H
2#define HALIDE_INTERNAL_CACHING_H
3
4/** \file
5 *
6 * Defines the interface to the pass that injects support for
7 * compute_cached roots.
8 */
9
10#include <map>
11#include <string>
12
13#include "Expr.h"
14
15namespace Halide {
16namespace Internal {
17
18class Function;
19
20/** Transform pipeline calls for Funcs scheduled with memoize to do a
21 * lookup call to the runtime cache implementation, and if there is a
22 * miss, compute the results and call the runtime to store it back to
23 * the cache.
24 * Should leave non-memoized Funcs unchanged.
25 */
26Stmt inject_memoization(const Stmt &s, const std::map<std::string, Function> &env,
27 const std::string &name,
28 const std::vector<Function> &outputs);
29
30/** This should be called after Storage Flattening has added Allocation
31 * IR nodes. It connects the memoization cache lookups to the Allocations
32 * so they point to the buffers from the memoization cache and those buffers
33 * are released when no longer used.
34 * Should not affect allocations for non-memoized Funcs.
35 */
36Stmt rewrite_memoized_allocations(const Stmt &s, const std::map<std::string, Function> &env);
37
38} // namespace Internal
39} // namespace Halide
40
41#endif
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Stmt inject_memoization(const Stmt &s, const std::map< std::string, Function > &env, const std::string &name, const std::vector< Function > &outputs)
Transform pipeline calls for Funcs scheduled with memoize to do a lookup call to the runtime cache im...
Stmt rewrite_memoized_allocations(const Stmt &s, const std::map< std::string, Function > &env)
This should be called after Storage Flattening has added Allocation IR nodes.
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 reference-counted handle to a statement node.
Definition Expr.h:427