You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/01/24 23:44:21 UTC

[GitHub] [tvm] zxybazh commented on a change in pull request #10049: [Meta Schedule] Add `ApplyHisotryBest` Meta Schedule Context

zxybazh commented on a change in pull request #10049:
URL: https://github.com/apache/tvm/pull/10049#discussion_r791241498



##########
File path: src/meta_schedule/integration.cc
##########
@@ -112,7 +114,21 @@ ApplyHistoryBest::ApplyHistoryBest(Database database) {
 
 Optional<ObjectRef> ApplyHistoryBestNode::Query(runtime::String task_name, IRModule mod,
                                                 Optional<Array<IRModule>> dispatched) {
-  throw;
+  ICHECK(dispatched.defined());
+  ICHECK_EQ(dispatched.value().size(), 1);
+  ICHECK(HasOnlyOneFunction<relay::Function>(mod)) << mod;
+  IRModule prim_mod = dispatched.value()[0];
+  ICHECK(HasOnlyOneFunction<tir::PrimFunc>(prim_mod)) << prim_mod;
+  // Unify func name to make sure it can be found in database
+  prim_mod = UnifyFuncName(prim_mod);
+  if (database->HasWorkload(prim_mod)) {
+    Array<TuningRecord> records = database->GetTopK(database->CommitWorkload(prim_mod), 1);
+    if (records.size() == 1) {

Review comment:
       Good question. Here I don't think we need to do the check because `HasWorkload` implies the workload is in the workload registery but does not imply we have a valid tuning record with workload inside of the database. Therefore, I removed such check here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org