slyubomirsky commented on code in PR #16783:
URL: https://github.com/apache/tvm/pull/16783#discussion_r1538290737


##########
src/relax/transform/canonicalize_bindings.cc:
##########
@@ -91,18 +91,20 @@ class CanonicalizePlanner : public ExprVisitor {
         bound_to = opt.value();
       }
 
-      if (bound_var.as<DataflowVarNode>() || !bound_to.as<DataflowVarNode>()) {
+      if (bound_var.as<DataflowVarNode>() || !bound_to.as<DataflowVarNode>() ||
+          !visitor.used_outside_home_dataflow_.count(bound_var)) {
         // Case 1: Var = Var
         // Case 2: DataflowVar = Var
         // Case 3: DataflowVar = DataflowVar
+        // Case 4a: Var = DataflowVar, but used outside this DataflowBlock
         //
         // For these three cases, the trivial binding can be

Review Comment:
   ```suggestion
           // For these four cases, the trivial binding can be
   ```
   :wink:



##########
src/relax/transform/canonicalize_bindings.cc:
##########
@@ -91,18 +91,20 @@ class CanonicalizePlanner : public ExprVisitor {
         bound_to = opt.value();
       }
 
-      if (bound_var.as<DataflowVarNode>() || !bound_to.as<DataflowVarNode>()) {
+      if (bound_var.as<DataflowVarNode>() || !bound_to.as<DataflowVarNode>() ||
+          !visitor.used_outside_home_dataflow_.count(bound_var)) {
         // Case 1: Var = Var
         // Case 2: DataflowVar = Var
         // Case 3: DataflowVar = DataflowVar
+        // Case 4a: Var = DataflowVar, but used outside this DataflowBlock

Review Comment:
   ```suggestion
           // Case 4a: Var = DataflowVar, but not used outside this 
DataflowBlock
   ```
   It appears the text was copied from case 4b. I also think it would be 
clearer to write out that it is the var that is not used outside the DF block



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