Icemist commented on code in PR #14537:
URL: https://github.com/apache/tvm/pull/14537#discussion_r1161569475


##########
src/relax/backend/task_extraction.cc:
##########
@@ -75,33 +104,44 @@ class TaskExtractor : public ExprVisitor {
 
     const GlobalVar& global_var = Downcast<GlobalVar>(call->args[0]);
     const tir::PrimFunc& func = 
Downcast<tir::PrimFunc>(mod_->Lookup(global_var));
-
-    auto it = func2task_.find(func);
+    IRModule mod = (*normalize_mod_func_)(func);
+    size_t weight = 1;
+    auto it = func2task_.find(mod);
     if (it != func2task_.end()) {
       it->second->weight += 1;
-      return;
+      const tir::PrimFunc& alt_func = 
Downcast<tir::PrimFunc>(it->first->Lookup("main"));
+      // When anchor-block based equality is used, tuning tasks 
"nn_conv2d_add_nn_relu" and
+      // "nn_conv2d_add_add_nn_relu", for example, can be identified as equal. 
Thus, one of them
+      // will be selected tu tune by the code below.

Review Comment:
   fixed



##########
src/relax/backend/task_extraction.cc:
##########
@@ -75,33 +104,44 @@ class TaskExtractor : public ExprVisitor {
 
     const GlobalVar& global_var = Downcast<GlobalVar>(call->args[0]);
     const tir::PrimFunc& func = 
Downcast<tir::PrimFunc>(mod_->Lookup(global_var));
-
-    auto it = func2task_.find(func);
+    IRModule mod = (*normalize_mod_func_)(func);
+    size_t weight = 1;
+    auto it = func2task_.find(mod);
     if (it != func2task_.end()) {
       it->second->weight += 1;
-      return;
+      const tir::PrimFunc& alt_func = 
Downcast<tir::PrimFunc>(it->first->Lookup("main"));
+      // When anchor-block based equality is used, tuning tasks 
"nn_conv2d_add_nn_relu" and
+      // "nn_conv2d_add_add_nn_relu", for example, can be identified as equal. 
Thus, one of them
+      // will be selected tu tune by the code below.
+      //
+      // To make sure that we tune "nn_conv2d_add_nn_relu" and not 
"nn_conv2d_add_add_nn_relu", we
+      // count the PrinFunc number of blocks and leave only the function with 
the smallest number of
+      // blocks. This way, "nn_conv2d_add_nn_relu" will have a smaller number 
of blocks then

Review Comment:
   fixed



-- 
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