diff --git a/apps/harris/Makefile b/apps/harris/Makefile index d99a72591d38..9d3f29a899d1 100644 --- a/apps/harris/Makefile +++ b/apps/harris/Makefile @@ -10,11 +10,11 @@ $(GENERATOR_BIN)/harris.generator: harris_generator.cpp $(GENERATOR_DEPS) $(BIN)/%/harris.a: $(GENERATOR_BIN)/harris.generator @mkdir -p $(@D) - $< -g harris -f harris -o $(BIN)/$* target=$*-no_runtime + $< -g harris -f harris -e $(GENERATOR_OUTPUTS) -o $(BIN)/$* target=$*-no_runtime $(BIN)/%/harris_auto_schedule.a: $(GENERATOR_BIN)/harris.generator @mkdir -p $(@D) - $< -g harris -f harris_auto_schedule -o $(BIN)/$* target=$*-no_runtime autoscheduler=Mullapudi2016 + $< -g harris -f harris_auto_schedule -e $(GENERATOR_OUTPUTS) -o $(BIN)/$* target=$*-no_runtime autoscheduler=Mullapudi2016 $(BIN)/%/runtime.a: $(GENERATOR_BIN)/harris.generator @mkdir -p $(@D) diff --git a/src/SlidingWindow.cpp b/src/SlidingWindow.cpp index f9122f572496..2c8cfc28cd95 100644 --- a/src/SlidingWindow.cpp +++ b/src/SlidingWindow.cpp @@ -901,7 +901,7 @@ class SlidingWindow : public IRMutator { }; // It is convenient to be able to assume that loops have a .loop_min.orig -// let in addition to .loop_min. Most of these will get simplified away. +// let giving the original loop min. Most of these will get simplified away. class AddLoopMinOrig : public IRMutator { using IRMutator::visit; @@ -916,7 +916,7 @@ class AddLoopMinOrig : public IRMutator { } else { result = For::make(op->name, min, max, op->for_type, op->partition_policy, op->device_api, body); } - return LetStmt::make(op->name + ".loop_min.orig", Variable::make(Int(32), op->name + ".loop_min"), result); + return LetStmt::make(op->name + ".loop_min.orig", op->min, result); } }; diff --git a/test/correctness/sliding_window.cpp b/test/correctness/sliding_window.cpp index ab9c2a30597c..36088804efc1 100644 --- a/test/correctness/sliding_window.cpp +++ b/test/correctness/sliding_window.cpp @@ -393,6 +393,28 @@ int main(int argc, char **argv) { } } + { + // Sliding a producer along the outer loop of a pair of outputs fused + // together with compute_with. Previously triggered an internal compiler + // error referencing a missing .loop_min symbol on the fused loop. + count = 0; + Func f, g1, g2; + f(x, y) = call_counter(x, y); + g1(x, y) = f(x, y - 1) + f(x, y + 1); + g2(x, y) = f(x, y - 1) - f(x, y + 1); + + f.store_root().compute_at(g1, y); + g2.compute_with(g1, x); + + Pipeline({g1, g2}).realize({10, 10}); + + // f spans y in [-1, 10], so 12 rows of 10 = 120 calls when slid. + if (count != 120) { + printf("f was called %d times instead of %d times\n", count, 120); + return 1; + } + } + printf("Success!\n"); return 0; }