Loading...
Searching...
No Matches
ApplySplit.h
Go to the documentation of this file.
#ifndef APPLY_SPLIT_H
#define APPLY_SPLIT_H
/** \file
*
* Defines method that returns a list of let stmts, substitutions, and
* predicates to be added given a split schedule.
*/
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "Expr.h"
#include "Schedule.h"
namespace Halide {
namespace Internal {
struct ApplySplitResult {
// If type is "Substitution", then this represents a substitution of
// variable "name" to value. ProvideValueSubstitution and
// ProvideArgSubstitution are similar, but only apply to instances
// found on the LHS or RHS of a call or provide. respectively. If
// type is "LetStmt", we should insert a new let stmt defining
// "name" with value "value". If type is "Predicate", we should
// ignore "name" and the predicate is "value".
std::string name;
Expr value;
enum Type { Substitution = 0,
SubstitutionInCalls,
SubstitutionInProvides,
LetStmt,
PredicateCalls,
PredicateProvides,
Predicate,
BlendProvides };
Type type;
ApplySplitResult(const std::string &n, Expr val, Type t)
: name(n), value(std::move(val)), type(t) {
}
ApplySplitResult(Expr val, Type t = Predicate)
: name(""), value(std::move(val)), type(t) {
}
};
/** Given a Split schedule on a definition (init or update), return a list of
* of predicates on the definition, substitutions that needs to be applied to
* the definition (in ascending order of application), and let stmts which
* defined the values of variables referred by the predicates and substitutions
* (ordered from innermost to outermost let). */
std::vector<ApplySplitResult> apply_split(
const Split &split, const std::string &prefix,
std::map<std::string, Expr> &dim_extent_alignment);
/** Compute the loop bounds of the new dimensions resulting from applying the
* split schedules using the loop bounds of the old dimensions. */
std::vector<std::pair<std::string, Expr>> compute_loop_bounds_after_split(
const Split &split, const std::string &prefix);
} // namespace Internal
} // namespace Halide
#endif
Expr.h
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt).
Schedule.h
Defines the internal representation of the schedule for a function.
Halide::Internal
Definition AbstractGenerator.h:24
Halide::Internal::apply_split
std::vector< ApplySplitResult > apply_split(const Split &split, 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...
Halide::Internal::compute_loop_bounds_after_split
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...
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19
Halide::Expr
A fragment of Halide syntax.
Definition Expr.h:258
Halide::Internal::ApplySplitResult::ApplySplitResult
ApplySplitResult(Expr val, Type t=Predicate)
Definition ApplySplit.h:46
Halide::Internal::ApplySplitResult::Type
Type
Definition ApplySplit.h:33
Halide::Internal::ApplySplitResult::Substitution
@ Substitution
Definition ApplySplit.h:33
Halide::Internal::ApplySplitResult::PredicateProvides
@ PredicateProvides
Definition ApplySplit.h:38
Halide::Internal::ApplySplitResult::LetStmt
@ LetStmt
Definition ApplySplit.h:36
Halide::Internal::ApplySplitResult::Predicate
@ Predicate
Definition ApplySplit.h:39
Halide::Internal::ApplySplitResult::PredicateCalls
@ PredicateCalls
Definition ApplySplit.h:37
Halide::Internal::ApplySplitResult::BlendProvides
@ BlendProvides
Definition ApplySplit.h:40
Halide::Internal::ApplySplitResult::SubstitutionInCalls
@ SubstitutionInCalls
Definition ApplySplit.h:34
Halide::Internal::ApplySplitResult::SubstitutionInProvides
@ SubstitutionInProvides
Definition ApplySplit.h:35
Halide::Internal::ApplySplitResult::name
std::string name
Definition ApplySplit.h:30
Halide::Internal::ApplySplitResult::type
Type type
Definition ApplySplit.h:41
Halide::Internal::ApplySplitResult::ApplySplitResult
ApplySplitResult(const std::string &n, Expr val, Type t)
Definition ApplySplit.h:43
Halide::Internal::ApplySplitResult::value
Expr value
Definition ApplySplit.h:31
Halide::Internal::Split
Definition Schedule.h:325