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


##########
src/relax/transform/canonicalize_bindings.cc:
##########
@@ -102,6 +103,108 @@ class BindingCanonicalizer : public ExprMutator {
     }
   }
 
+  // Special case: for dataflow blocks, we will check for dataflow vars that 
solely exist
+  // to be bound to the output. In this case, we will get rid of those 
bindings and
+  // use the dataflow var's definition directly
+  BindingBlock VisitBindingBlock_(const DataflowBlockNode* block) override {
+    auto new_block = 
Downcast<DataflowBlock>(ExprMutator::VisitBindingBlock_(block));
+    std::unordered_map<DataflowVar, Expr, ObjectPtrHash, ObjectPtrEqual> 
binding_map;
+    std::unordered_set<DataflowVar, ObjectPtrHash, ObjectPtrEqual> 
disqualified_set;
+    std::unordered_set<DataflowVar, ObjectPtrHash, ObjectPtrEqual> output_vars;
+
+    for (auto binding : new_block->bindings) {

Review Comment:
   Good point



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