From 9b902a7c8865a3c239dda01c6b90dce33d478cca Mon Sep 17 00:00:00 2001 From: Andrew Adams Date: Mon, 1 Aug 2022 15:25:16 -0700 Subject: [PATCH 1/2] Fix autoscheduling trivial lut wrappers Fixes #6899 --- .../adams2019/DefaultCostModel.cpp | 4 ++-- src/autoschedulers/adams2019/FunctionDAG.cpp | 2 +- src/autoschedulers/adams2019/test.cpp | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/autoschedulers/adams2019/DefaultCostModel.cpp b/src/autoschedulers/adams2019/DefaultCostModel.cpp index 01307d765131..7339261920bc 100644 --- a/src/autoschedulers/adams2019/DefaultCostModel.cpp +++ b/src/autoschedulers/adams2019/DefaultCostModel.cpp @@ -135,8 +135,8 @@ void DefaultCostModel::enqueue(const Internal::Autoscheduler::FunctionDAG &dag, void DefaultCostModel::enqueue(int ns, Runtime::Buffer *schedule_feats, double *cost_ptr) { num_stages = ns; - // We know the most stages that will ever be enqueued from the schedule features - internal_assert(pipeline_feat_queue.data() && "Call set_schedule_features before calling enqueue\n"); + // We know the most stages that will ever be enqueued from the pipeline features + internal_assert(pipeline_feat_queue.data() && "Call set_pipeline_features before calling enqueue\n"); const int max_num_stages = pipeline_feat_queue.dim(2).extent(); internal_assert(num_stages <= max_num_stages) << "schedule features has more stages (" << num_stages diff --git a/src/autoschedulers/adams2019/FunctionDAG.cpp b/src/autoschedulers/adams2019/FunctionDAG.cpp index b151439b4236..97682ca683be 100644 --- a/src/autoschedulers/adams2019/FunctionDAG.cpp +++ b/src/autoschedulers/adams2019/FunctionDAG.cpp @@ -959,7 +959,7 @@ FunctionDAG::FunctionDAG(const vector &outputs, const Target &target) } node.is_wrapper = node.func.is_wrapper(); - node.is_input = !node.func.has_update_definition() && node.is_wrapper && !any_incoming_edges; + node.is_input = !node.is_output && !node.func.has_update_definition() && node.is_wrapper && !any_incoming_edges; node.dimensions = node.func.dimensions(); } } diff --git a/src/autoschedulers/adams2019/test.cpp b/src/autoschedulers/adams2019/test.cpp index 41c1ac8f3a34..8ee560260fa1 100644 --- a/src/autoschedulers/adams2019/test.cpp +++ b/src/autoschedulers/adams2019/test.cpp @@ -913,6 +913,30 @@ int main(int argc, char **argv) { } } + // A trivial pipeline that just loads from a LUT + if (true) { + Pipeline p1; + Pipeline p2; + for (int test_condition = 0; test_condition < 2; test_condition++) { + Buffer lut(256); + Func f; + f(x) = lut(x); + + f.set_estimate(x, 0, 256); + + if (test_condition) { + p2 = Pipeline(f); + } else { + p1 = Pipeline(f); + } + } + + if (!test_caching(p1, p2, target)) { + std::cerr << "Caching check failed on stencil chain" << std::endl; + return 1; + } + } + #ifdef HALIDE_ALLOW_LEGACY_AUTOSCHEDULER_API // Reset environment variables. set_env_variable("HL_DISABLE_MEMOIZED_FEATURES", cache_features, /* overwrite */ 1); From c3c38dc99921d334deac3d7d9159853abcaa96c1 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 1 Aug 2022 21:06:54 -0700 Subject: [PATCH 2/2] trigger buildbots