From e1dd02625a45a7549b4c39a7e479152e79340ec9 Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Tue, 24 Dec 2024 13:46:16 -0800 Subject: [PATCH 1/2] Hopefully fix flaky test --- test/autoschedulers/mullapudi2016/reorder.cpp | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/test/autoschedulers/mullapudi2016/reorder.cpp b/test/autoschedulers/mullapudi2016/reorder.cpp index 37476a0ff0dc..b383312e12a4 100644 --- a/test/autoschedulers/mullapudi2016/reorder.cpp +++ b/test/autoschedulers/mullapudi2016/reorder.cpp @@ -7,10 +7,17 @@ using namespace Halide::Tools; double run_test_1(bool auto_schedule) { Var x("x"), y("y"), dx("dx"), dy("dy"), c("c"); + int W = 1024; + int H = 1920; + int search_area = 7; + + Buffer im(2048); + im.fill(17); + + Func f("f"); - f(x, y, dx, dy) = x + y + dx + dy; + f(x, y, dx, dy) = im(x) + im(y + 1) + im(dx + search_area / 2) + im(dy + search_area / 2); - int search_area = 7; RDom dom(-search_area / 2, search_area, -search_area / 2, search_area, "dom"); // If 'f' is inlined into 'r', the only storage layout that the auto scheduler @@ -23,23 +30,20 @@ double run_test_1(bool auto_schedule) { if (auto_schedule) { // Provide estimates on the pipeline output - r.set_estimates({{0, 1024}, {0, 1024}, {0, 3}}); + r.set_estimates({{0, W}, {0, H}, {0, 3}}); // Auto-schedule the pipeline p.apply_autoscheduler(target, {"Mullapudi2016"}); } else { - /* + Var par; r.update(0).fuse(c, y, par).parallel(par).reorder(x, dom.x, dom.y).vectorize(x, 4); - r.fuse(c, y, par).parallel(par).vectorize(x, 4); */ - - // The sequential schedule in this case seems to perform best which is - // odd have to investigate this further. + r.fuse(c, y, par).parallel(par).vectorize(x, 4); } // Inspect the schedule (only for debugging)) // r.print_loop_nest(); // Run the schedule - Buffer out(1024, 1024, 3); + Buffer out(W, H, 3); double t = benchmark(3, 10, [&]() { p.realize(out); }); @@ -154,7 +158,7 @@ int main(int argc, char **argv) { double manual_time = run_test_1(false); double auto_time = run_test_1(true); - const double slowdown_factor = 15.0; // TODO: whoa + const double slowdown_factor = 2.0; if (!get_jit_target_from_environment().has_gpu_feature() && auto_time > manual_time * slowdown_factor) { std::cerr << "Autoscheduler time (1) is slower than expected:\n" << "======================\n" From eac3a293466385d069f678917e6ac3f9b34aa783 Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Tue, 24 Dec 2024 14:01:34 -0800 Subject: [PATCH 2/2] clang-format --- test/autoschedulers/mullapudi2016/reorder.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/autoschedulers/mullapudi2016/reorder.cpp b/test/autoschedulers/mullapudi2016/reorder.cpp index b383312e12a4..942da121b8b1 100644 --- a/test/autoschedulers/mullapudi2016/reorder.cpp +++ b/test/autoschedulers/mullapudi2016/reorder.cpp @@ -14,7 +14,6 @@ double run_test_1(bool auto_schedule) { Buffer im(2048); im.fill(17); - Func f("f"); f(x, y, dx, dy) = im(x) + im(y + 1) + im(dx + search_area / 2) + im(dy + search_area / 2);