Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a fuzzer for sliding window schedules #8144

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/SlidingWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,14 @@ class SlidingWindowOnFunctionAndLoop : public IRMutator {
new_loop_min_eq = simplify(new_loop_min_eq);
Interval solve_result = solve_for_inner_interval(new_loop_min_eq, new_loop_min_name);
internal_assert(!new_loop_min.defined());
if (solve_result.has_upper_bound() &&

#ifdef HALIDE_USE_LOOP_REWINDING_EVEN_THOUGH_IT_IS_BROKEN_SEE_ISSUE_8140
constexpr bool use_loop_rewinding = true;
#else
constexpr bool use_loop_rewinding = false;
#endif
if (use_loop_rewinding &&
solve_result.has_upper_bound() &&
!equal(solve_result.max, loop_min) &&
!expr_uses_vars(solve_result.max, enclosing_loops)) {
new_loop_min = simplify(solve_result.max);
Expand All @@ -454,6 +461,7 @@ class SlidingWindowOnFunctionAndLoop : public IRMutator {
new_max = min(new_max, max_required_at_loop_min);
}
} else {

// We couldn't find a suitable new loop min, we can't assume
// every iteration has a previous iteration. The first iteration
// will warm up the loop.
Expand Down Expand Up @@ -844,6 +852,9 @@ class SlidingWindow : public IRMutator {
loop_extent = Variable::make(Int(32), new_name + ".loop_extent");
body = substitute({
{name, Variable::make(Int(32), new_name)},
// Note for whoever tries to fix issue 8140:
// Commenting out the next two lines fixes
// most but not all failures.
{name + ".loop_min", loop_min},
{name + ".loop_extent", loop_extent},
},
Expand Down
1 change: 1 addition & 0 deletions test/correctness/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ tests(GROUPS correctness
fused_where_inner_extent_is_zero.cpp
fuzz_float_stores.cpp
fuzz_schedule.cpp
fuzz_sliding_window.cpp
gameoflife.cpp
gather.cpp
gpu_allocation_cache.cpp
Expand Down
Loading
Loading