Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
ApplySplit.h
Go to the documentation of this file.
1#ifndef APPLY_SPLIT_H
2#define APPLY_SPLIT_H
3
4/** \file
5 *
6 * Defines method that returns a list of let stmts, substitutions, and
7 * predicates to be added given a split schedule.
8 */
9
10#include <map>
11#include <string>
12#include <utility>
13#include <vector>
14
15#include "Expr.h"
16#include "Schedule.h"
17
18namespace Halide {
19namespace Internal {
20
22 // If type is "Substitution", then this represents a substitution of
23 // variable "name" to value. ProvideValueSubstitution and
24 // ProvideArgSubstitution are similar, but only apply to instances
25 // found on the LHS or RHS of a call or provide. respectively. If
26 // type is "LetStmt", we should insert a new let stmt defining
27 // "name" with value "value". If type is "Predicate", we should
28 // ignore "name" and the predicate is "value".
29
30 std::string name;
32
33 enum Type { Substitution = 0,
42
43 ApplySplitResult(const std::string &n, Expr val, Type t)
44 : name(n), value(std::move(val)), type(t) {
45 }
47 : name(""), value(std::move(val)), type(t) {
48 }
49
50 bool is_substitution() const {
51 return (type == Substitution);
52 }
54 return (type == SubstitutionInCalls);
55 }
57 return (type == SubstitutionInProvides);
58 }
59 bool is_let() const {
60 return (type == LetStmt);
61 }
62 bool is_predicate() const {
63 return (type == Predicate);
64 }
65 bool is_predicate_calls() const {
66 return (type == PredicateCalls);
67 }
68 bool is_predicate_provides() const {
69 return (type == PredicateProvides);
70 }
71 bool is_blend_provides() const {
72 return (type == BlendProvides);
73 }
74};
75
76/** Given a Split schedule on a definition (init or update), return a list of
77 * of predicates on the definition, substitutions that needs to be applied to
78 * the definition (in ascending order of application), and let stmts which
79 * defined the values of variables referred by the predicates and substitutions
80 * (ordered from innermost to outermost let). */
81std::vector<ApplySplitResult> apply_split(
82 const Split &split, bool is_update, const std::string &prefix,
83 std::map<std::string, Expr> &dim_extent_alignment);
84
85/** Compute the loop bounds of the new dimensions resulting from applying the
86 * split schedules using the loop bounds of the old dimensions. */
87std::vector<std::pair<std::string, Expr>> compute_loop_bounds_after_split(
88 const Split &split, const std::string &prefix);
89
90} // namespace Internal
91} // namespace Halide
92
93#endif
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Defines the internal representation of the schedule for a function.
std::vector< ApplySplitResult > apply_split(const Split &split, bool is_update, const std::string &prefix, std::map< std::string, Expr > &dim_extent_alignment)
Given a Split schedule on a definition (init or update), return a list of of predicates on the defini...
std::vector< std::pair< std::string, Expr > > compute_loop_bounds_after_split(const Split &split, const std::string &prefix)
Compute the loop bounds of the new dimensions resulting from applying the split schedules using the l...
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
ApplySplitResult(Expr val, Type t=Predicate)
Definition ApplySplit.h:46
ApplySplitResult(const std::string &n, Expr val, Type t)
Definition ApplySplit.h:43
The statement form of a let node.
Definition IR.h:282