Skip to content

Commit

Permalink
return reversed list
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Mar 11, 2022
1 parent 74636be commit e49d500
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/tvm/meta_schedule/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,5 @@ def extract_task_from_relay(
disabled_pass=disabled_pass,
):
tasks = extract_task_func(mod, target, relay_params)
return tasks
# Tasks are extracted via post order visit, return the reversed list.
return list(reversed(tasks))
4 changes: 4 additions & 0 deletions src/meta_schedule/integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ IRModule ApplyHistoryBestNode::Query(runtime::String task_name, IRModule mod, Ta
ICHECK(HasOnlyOneFunction<relay::Function>(mod)) << mod;
IRModule prim_mod = dispatched.value()[0];
ICHECK(HasOnlyOneFunction<tir::PrimFunc>(prim_mod)) << prim_mod;
// TODO(masahi): parse_mod below replaces the orginal function key with "main".
// This is necessary because some scheduling primitives requires the PrimFunc key be "main".
// If we can remove this restriction, there would no need for GetOnlyOneFunction* calls below
// and we can directly return sch->mod().
auto gv = GetOnlyOneFunctionKey<tir::PrimFunc>(prim_mod).value();
// Unify func name to make sure it can be found in database
const auto* parse_mod_func = runtime::Registry::Get("tvm.meta_schedule.tune.parse_mod");
Expand Down

0 comments on commit e49d500

Please sign in to comment.