You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "masahi (via GitHub)" <gi...@apache.org> on 2023/03/20 21:57:10 UTC

[GitHub] [tvm] masahi commented on a diff in pull request #14344: [BugFix] Support rewrite_once when the number of callbacks > 1

masahi commented on code in PR #14344:
URL: https://github.com/apache/tvm/pull/14344#discussion_r1142715542


##########
src/relay/ir/dataflow_matcher.cc:
##########
@@ -796,24 +796,38 @@ Expr PatternRewriter::Rewrite(const Array<DFPatternCallback>& callbacks, const E
   bool equal = true;
   static auto* structural_equal = runtime::Registry::Get("node.StructuralEqual");
   ICHECK(structural_equal) << "node.StructuralEqual is not registered.";
+  // Use the callback until the callback's attribute is rewrite_once=true and has been rewritten

Review Comment:
   // Keep track of callbacks that have finished rewriting



##########
src/relay/ir/dataflow_matcher.cc:
##########
@@ -796,24 +796,38 @@ Expr PatternRewriter::Rewrite(const Array<DFPatternCallback>& callbacks, const E
   bool equal = true;
   static auto* structural_equal = runtime::Registry::Get("node.StructuralEqual");
   ICHECK(structural_equal) << "node.StructuralEqual is not registered.";
+  // Use the callback until the callback's attribute is rewrite_once=true and has been rewritten
+  std::unordered_map<DFPatternCallback, bool, ObjectPtrHash, ObjectPtrEqual> callbacks_map;

Review Comment:
   `callbacks_map` -> `done`, swapping false and true



-- 
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-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org