comaniac commented on a change in pull request #8843: URL: https://github.com/apache/tvm/pull/8843#discussion_r695929809
########## File path: tests/python/relay/test_dataflow_pattern.py ########## @@ -1793,3 +1825,4 @@ def test_partition_constant_embedding(): test_IfPattern() test_match_if() test_no_match_if() + test_rewrite_once() Review comment: As we are making unit tests more manageable, could you help change to the following? ``` if __name__ == "__main__": pytest.main([__file__]) ``` ########## File path: include/tvm/relay/dataflow_matcher.h ########## @@ -63,7 +66,8 @@ class DFPatternCallbackNode : public Object { */ class DFPatternCallback : public ObjectRef { public: - TVM_DLL DFPatternCallback(DFPattern pattern, PackedFunc callback, bool require_type); + TVM_DLL DFPatternCallback(DFPattern pattern, PackedFunc callback, bool require_type, + bool rewrite_once); Review comment: Given that rewrite once is relatively not a common case, it might be better to make it optional: `bool rewrite_once=false`, so that you don't need to change existing uses in the passes. ########## File path: src/relay/transforms/simplify_expr.h ########## @@ -54,14 +54,16 @@ class DFPatternRewrite { Map<DFPattern, Array<Expr>> node_map = args[2]; *rv = this->Callback(pre, post, node_map); }; - return DFPatternCallback(pattern_, PackedFunc(func), require_type_); + return DFPatternCallback(pattern_, PackedFunc(func), require_type_, rewrite_once_); } protected: /*! \brief The pattern for matching and rewriting. */ DFPattern pattern_; /*! \brief Whether or not the rewrite requires types to be inferred. */ bool require_type_ = true; + /*! \brief If True, rewrite only once. */ + bool rewrite_once_ = false; Review comment: Seems no way to change this value? And in which case we may need rewrite once in SimplifyExpr? -- 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