22namespace Autoscheduler {
30struct Adams2019Params;
35struct OptionalRational {
45 if (!
exists || !other.exists) {
57 numerator += other.numerator * (l / other.denominator);
72 bool e =
exists && other.exists;
106 return !((*this) <= x);
113 return !((*this) < x);
128 vector<vector<OptionalRational>> coeffs;
133 : coeffs(matrix), c(c) {
137 return coeffs.size();
141 if (coeffs.empty() || coeffs[0].empty()) {
146 return coeffs[0].size();
150 if (coeffs.empty()) {
155 const auto &p = coeffs[producer_storage_dim];
161 return p[consumer_loop_dim];
174 if (other.coeffs.size() != coeffs.size()) {
177 for (
size_t i = 0; i < coeffs.size(); i++) {
178 if (other.coeffs[i].size() != coeffs[i].size()) {
181 for (
size_t j = 0; j < coeffs[i].size(); j++) {
182 if (!(other.coeffs[i][j] == coeffs[i][j])) {
194 vector<vector<OptionalRational>> matrix;
198 matrix[i].resize(other.consumer_loop_dims());
199 for (
size_t j = 0; j < other.consumer_loop_dims(); j++) {
202 matrix[i][j] += (*this)(i, k) * other(k, j);
210 void dump(std::ostream &os,
const char *prefix)
const;
229 bool constant_extent_;
239 return max_ - min_ + 1;
242 return constant_extent_;
246 min_ = std::min(min_, other.
min());
247 max_ = std::max(max_, other.
max());
261 : min_(a), max_(b), constant_extent_(c) {
266 return Span(INT64_MAX, INT64_MIN,
true);
275struct BoundContents {
326 mutable std::vector<BoundContents *> pool;
329 mutable std::vector<void *> blocks;
331 mutable size_t num_live = 0;
333 void allocate_some_more()
const;
373 struct SymbolicInterval {
485 :
stage(std::move(s)) {
542 vector<pair<BoundInfo, BoundInfo>>
bounds;
570 void dump(std::ostream &os)
const;
#define internal_assert(c)
void release(const BoundContents *b) const
void operator=(Layout &&)=delete
Layout(const Layout &)=delete
std::vector< int > loop_offset
BoundContents * make() const
void operator=(const Layout &)=delete
OptionalRational operator()(int producer_storage_dim, int consumer_loop_dim) const
LoadJacobian operator*(const LoadJacobian &other) const
size_t consumer_loop_dims() const
bool merge(const LoadJacobian &other)
LoadJacobian(vector< vector< OptionalRational > > &&matrix, int64_t c=1)
size_t producer_storage_dims() const
void dump(std::ostream &os, const char *prefix) const
bool constant_extent() const
void set_extent(int64_t e)
Span(int64_t a, int64_t b, bool c)
void translate(int64_t x)
Span(const Span &other)=default
void union_with(const Span &other)
A reference-counted handle to Halide's internal representation of a function.
A class representing a reference count to be used with IntrusivePtr.
A single definition of a Func.
A Halide variable, to be used when defining functions.
int64_t gcd(int64_t, int64_t)
The greatest common divisor of two integers.
int64_t lcm(int64_t, int64_t)
The least common multiple of two integers.
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
signed __INT64_TYPE__ int64_t
void * memcpy(void *s1, const void *s2, size_t n)
A fragment of Halide syntax.
Span & region_computed(int i)
Span & region_required(int i)
Span & loops(int i, int j)
BoundContents * make_copy() const
const Span & region_required(int i) const
const Span & region_computed(int i) const
const Span & loops(int i, int j) const
BoundInfo(const Expr &e, const Node::Stage &consumer, bool dependent)
FunctionDAG::Node * producer
vector< LoadJacobian > load_jacobians
void expand_footprint(const Span *consumer_loop, Span *producer_required) const
void add_load_jacobian(LoadJacobian j1)
FunctionDAG::Node::Stage * consumer
vector< pair< BoundInfo, BoundInfo > > bounds
bool equals_region_computed
bool equals_union_of_required_with_constants
PipelineFeatures features
bool loop_nest_all_common_cases
bool downstream_of(const Node &n) const
vector< bool > dependencies
vector< Edge * > incoming_edges
vector< Edge * > outgoing_edges
BoundContents * make_bound() const
vector< SymbolicInterval > region_required
void loop_nest_for_region(int stage_idx, const Span *computed, Span *loop) const
bool is_boundary_condition
vector< RegionComputedInfo > region_computed
bool region_computed_all_common_cases
vector< Span > estimated_region_required
std::unique_ptr< BoundContents::Layout > bounds_memory_layout
void required_to_computed(const Span *required, Span *computed) const
void dump(std::ostream &os) const
FunctionDAG(FunctionDAG &&other)=delete
FunctionDAG(const FunctionDAG &other)=delete
FunctionDAG & operator=(FunctionDAG &&other)=delete
FunctionDAG & operator=(const FunctionDAG &other)=delete
FunctionDAG(const vector< Function > &outputs, const Target &target)
void operator+=(const OptionalRational &other)
bool operator>=(int x) const
OptionalRational(bool e, int64_t n, int64_t d)
bool operator==(const OptionalRational &other) const
bool operator>(int x) const
OptionalRational()=default
OptionalRational operator*(const OptionalRational &other) const
bool operator==(int x) const
bool operator<(int x) const
bool operator<=(int x) const
A class to represent ranges of Exprs.
Intrusive shared pointers have a reference count (a RefCount object) stored in the class itself.
A struct representing a target machine and os to generate code for.