You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/04 13:20:27 UTC

[GitHub] [tvm] leiwen83 opened a new pull request, #13294: Enhancement for simplify_expr

leiwen83 opened a new pull request, #13294:
URL: https://github.com/apache/tvm/pull/13294

   * Add SwitchAdd0 to switch constant+var to var+constant to make fusion easy
   
   * Add SwitchAdd1 to switch var+var+constant to var+constant+var to make fusion easy
   
   * Add SimplifyDivide to prepare it for fold_scale_axis pass
   
   Signed-off-by: Lei Wen <we...@qiyi.com>


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


[GitHub] [tvm] ehsanmok commented on a diff in pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
ehsanmok commented on code in PR #13294:
URL: https://github.com/apache/tvm/pull/13294#discussion_r1014327634


##########
src/relay/transforms/simplify_expr.cc:
##########
@@ -878,6 +932,33 @@ class SimplifyAdd : public DFPatternRewrite {
   DFPattern y_;
 };
 
+/*! \brief Simplifying x/c to x*(1/c) */
+class SimplifyDivide : public DFPatternRewrite {
+ public:
+  SimplifyDivide() {
+    x_ = IsWildcard();
+    c_ = IsConstant();
+    pattern_ = IsOp("divide")({x_, c_});
+  }
+
+  Expr Callback(const Expr& pre, const Expr& post,
+                const Map<DFPattern, Array<Expr>>& node_map) const override {
+    Type pre_type = pre->checked_type_;
+    auto dtype = pre_type.as<TensorTypeNode>()->dtype;
+    auto x = node_map[x_][0];
+    auto c = node_map[c_][0];
+
+    Expr one;
+    one = MakeConstantScalar(dtype, 1);

Review Comment:
   Minor: var declare and initialize at the same time.



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


[GitHub] [tvm] leiwen83 commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
leiwen83 commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1303533018

   @junrushao please help to review~


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


[GitHub] [tvm] tvm-bot commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1303531918

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * No users to auto-tag found, no teams are specified in PR title <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


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


[GitHub] [tvm] junrushao commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1312821422

   Unfortunately I may not have enough bandwidth lately, but am happy to help if more details are provided on your end :-)  Specifically, are you able to reproduce locally the issues you encountered in CI?


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


[GitHub] [tvm] leiwen83 commented on a diff in pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
leiwen83 commented on code in PR #13294:
URL: https://github.com/apache/tvm/pull/13294#discussion_r1014595606


##########
src/relay/transforms/simplify_expr.cc:
##########
@@ -878,6 +932,33 @@ class SimplifyAdd : public DFPatternRewrite {
   DFPattern y_;
 };
 
+/*! \brief Simplifying x/c to x*(1/c) */
+class SimplifyDivide : public DFPatternRewrite {
+ public:
+  SimplifyDivide() {
+    x_ = IsWildcard();
+    c_ = IsConstant();
+    pattern_ = IsOp("divide")({x_, c_});
+  }
+
+  Expr Callback(const Expr& pre, const Expr& post,
+                const Map<DFPattern, Array<Expr>>& node_map) const override {
+    Type pre_type = pre->checked_type_;
+    auto dtype = pre_type.as<TensorTypeNode>()->dtype;
+    auto x = node_map[x_][0];
+    auto c = node_map[c_][0];
+
+    Expr one;
+    one = MakeConstantScalar(dtype, 1);

Review Comment:
   fixed



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


[GitHub] [tvm] leiwen83 commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
leiwen83 commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1325062205

   BTW, some failure in the CI is wield..
   Like https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/PR-13294/28/pipeline/
   All tests in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/PR-13294/28/tests has passed, but CI still failed, and I cannot get any clue which case it fail at...


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


[GitHub] [tvm] leiwen83 closed pull request #13294: Enhancement for simplify_expr

Posted by "leiwen83 (via GitHub)" <gi...@apache.org>.
leiwen83 closed pull request #13294: Enhancement for simplify_expr
URL: https://github.com/apache/tvm/pull/13294


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


[GitHub] [tvm] leiwen83 commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
leiwen83 commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1325032232

   > Unfortunately I may not have enough bandwidth lately, but am happy to help if more details are provided on your end :-) Specifically, are you able to reproduce locally the issues you encountered in CI?
   
   Sorry for the late response. I haven't reproduce the previous issue in the CI.@junrushao 
   Now the patch is shortten to pass the CI, so I wander that how about merge the current status? And I would check the CI issue later when I find time for the original PR  patch.
   
   


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


[GitHub] [tvm] junrushao commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1306345874

   i'm retriggering this pr


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


[GitHub] [tvm] junrushao commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1307737195

   Please fix the unit tests


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


[GitHub] [tvm] leiwen83 commented on pull request #13294: Enhancement for simplify_expr

Posted by GitBox <gi...@apache.org>.
leiwen83 commented on PR #13294:
URL: https://github.com/apache/tvm/pull/13294#issuecomment-1309797078

   > 
   
   There are two passes fail the checkpatch, and I don't know how to fix it ... 
   So I remove them at current time, and now patch pass all unit test. @junrushao 


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