Skip to content

Commit

Permalink
Hopefully fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
abadams committed Dec 24, 2024
1 parent b5a5ca2 commit e1dd026
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/autoschedulers/mullapudi2016/reorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t> 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
Expand All @@ -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<int> out(1024, 1024, 3);
Buffer<int> out(W, H, 3);
double t = benchmark(3, 10, [&]() {
p.realize(out);
});
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit e1dd026

Please sign in to comment.