From 30722cf0f3cbc6905578ee22f842e56c08ee4425 Mon Sep 17 00:00:00 2001 From: Dillon Date: Wed, 3 Jan 2024 13:23:11 -0800 Subject: [PATCH] More comments --- src/infer_bounds.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/infer_bounds.cc b/src/infer_bounds.cc index 790943b6..930e3ba8 100644 --- a/src/infer_bounds.cc +++ b/src/infer_bounds.cc @@ -39,6 +39,9 @@ void merge_crop(std::optional& bounds, const box_expr& new_bounds) { } } +// This pass tries to identify where call_func operations need to run to satisfy the requirements of their consumers (or +// the output buffers). It updates `allocate` nodes to allocate enough memory for the uses of the allocation, and crops +// producers to the required region. class bounds_inferrer : public node_mutator { public: symbol_map infer; @@ -232,6 +235,9 @@ class bounds_inferrer : public node_mutator { } }; +// Try to find cases where we can do "sliding window" or "line buffering" optimizations. When there +// is a producer that is consumed by a stencil operation in a loop, the producer can incrementally produce +// only the values required by the next iteration, and re-use the rest of the values from the previous iteration. class slider : public node_mutator { public: node_context& ctx; @@ -458,9 +464,8 @@ stmt infer_bounds(const stmt& s, node_context& ctx, const std::vector result = simplify(result); - // Try to find cases where we can do "sliding window" or "line buffering" optimizations. When there - // is a producer that is consumed by a stencil operation in a loop, the producer can incrementally produce - // only the values required by the next iteration, and re-use the rest of the values from the previous iteration. + // After simplifying and inferring the bounds of producers, we can try to run the sliding window + // optimization. result = slider(ctx).mutate(result); return result;