Skip to content

Commit c2d5ea3

Browse files
authored
Hopefully fix flaky mullapudi reorder test (#8542)
* Hopefully fix flaky test * clang-format
1 parent efb77e5 commit c2d5ea3

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

test/autoschedulers/mullapudi2016/reorder.cpp

+13-10
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ using namespace Halide::Tools;
77
double run_test_1(bool auto_schedule) {
88
Var x("x"), y("y"), dx("dx"), dy("dy"), c("c");
99

10+
int W = 1024;
11+
int H = 1920;
12+
int search_area = 7;
13+
14+
Buffer<uint32_t> im(2048);
15+
im.fill(17);
16+
1017
Func f("f");
11-
f(x, y, dx, dy) = x + y + dx + dy;
18+
f(x, y, dx, dy) = im(x) + im(y + 1) + im(dx + search_area / 2) + im(dy + search_area / 2);
1219

13-
int search_area = 7;
1420
RDom dom(-search_area / 2, search_area, -search_area / 2, search_area, "dom");
1521

1622
// If 'f' is inlined into 'r', the only storage layout that the auto scheduler
@@ -23,23 +29,20 @@ double run_test_1(bool auto_schedule) {
2329

2430
if (auto_schedule) {
2531
// Provide estimates on the pipeline output
26-
r.set_estimates({{0, 1024}, {0, 1024}, {0, 3}});
32+
r.set_estimates({{0, W}, {0, H}, {0, 3}});
2733
// Auto-schedule the pipeline
2834
p.apply_autoscheduler(target, {"Mullapudi2016"});
2935
} else {
30-
/*
36+
Var par;
3137
r.update(0).fuse(c, y, par).parallel(par).reorder(x, dom.x, dom.y).vectorize(x, 4);
32-
r.fuse(c, y, par).parallel(par).vectorize(x, 4); */
33-
34-
// The sequential schedule in this case seems to perform best which is
35-
// odd have to investigate this further.
38+
r.fuse(c, y, par).parallel(par).vectorize(x, 4);
3639
}
3740

3841
// Inspect the schedule (only for debugging))
3942
// r.print_loop_nest();
4043

4144
// Run the schedule
42-
Buffer<int> out(1024, 1024, 3);
45+
Buffer<int> out(W, H, 3);
4346
double t = benchmark(3, 10, [&]() {
4447
p.realize(out);
4548
});
@@ -154,7 +157,7 @@ int main(int argc, char **argv) {
154157
double manual_time = run_test_1(false);
155158
double auto_time = run_test_1(true);
156159

157-
const double slowdown_factor = 15.0; // TODO: whoa
160+
const double slowdown_factor = 2.0;
158161
if (!get_jit_target_from_environment().has_gpu_feature() && auto_time > manual_time * slowdown_factor) {
159162
std::cerr << "Autoscheduler time (1) is slower than expected:\n"
160163
<< "======================\n"

0 commit comments

Comments
 (0)