junrushao1994 commented on a change in pull request #10578:
URL: https://github.com/apache/tvm/pull/10578#discussion_r826594089



##########
File path: src/relay/backend/te_compiler_cache.cc
##########
@@ -335,15 +336,14 @@ class ScheduleBuilder : public ExprVisitor {
         }
       }
       if (backend::IsMetaScheduleEnabled()) {
-        prim_func = tir::CreatePrimFunc(Concat(fn_inputs, tensor_outs));
-        Optional<ObjectRef> opt_mod_or_base_func =
-            meta_schedule::MetaScheduleContext::QueryInsideWithScope(
-                prim_fn_var->name_hint, IRModule({{prim_fn_var, relay_func}}), 
target_,
-                Array<IRModule>{IRModule({{prim_fn_var, prim_func}})});
-        if (const auto* result = opt_mod_or_base_func.as<tir::PrimFuncNode>()) 
{
-          prim_func = GetRef<tir::PrimFunc>(result);
-        } else {
-          prim_func = tir::PrimFunc(nullptr);
+        auto relay_mod = IRModule({{prim_fn_var, relay_func}});
+        auto tir_mod =
+            IRModule({{prim_fn_var, tir::CreatePrimFunc(Concat(fn_inputs, 
tensor_outs))}});
+        IRModule scheduled_mod = 
meta_schedule::MetaScheduleContext::QueryInsideWithScope(
+            prim_fn_var->name_hint, relay_mod, target_, 
Array<IRModule>{tir_mod});
+        if (scheduled_mod.defined()) {

Review comment:
       Ahhh that sounds good! Thanks for the explanation!! So given this 
`scheduled_mod` is nullable, shall we return `Optional<IRmodule>` instead to 
make our assumption explicit?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to