slyubomirsky commented on code in PR #16783: URL: https://github.com/apache/tvm/pull/16783#discussion_r1538290478
########## 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 // // For these three cases, the trivial binding can be Review Comment: ```suggestion // For these four cases, the trivial binding can be ``` :wink: -- 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-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org