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 2020/07/13 08:19:25 UTC

[GitHub] [incubator-tvm] merrymercy opened a new pull request #6043: [ARITH] Improve vector simplification for float operands

merrymercy opened a new pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043


   


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

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



[GitHub] [incubator-tvm] merrymercy commented on a change in pull request #6043: [ARITH] Improve vector simplification for float operands

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043#discussion_r454571390



##########
File path: src/arith/pattern_match.h
##########
@@ -145,6 +145,14 @@ class PEqualChecker<IntImm> {
   bool operator()(const IntImm& lhs, const IntImm& rhs) const { return lhs->value == rhs->value; }
 };
 
+template <>
+class PEqualChecker<FloatImm> {
+ public:
+  bool operator()(const FloatImm& lhs, const FloatImm& rhs) const {
+    return BaseValueEqual()(lhs->value, rhs->value);

Review comment:
       ```suggestion
       return BaseValueEqual()(rhs->value, lhs->value);
   ```




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

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



[GitHub] [incubator-tvm] merrymercy commented on a change in pull request #6043: [ARITH] Improve vector simplification for float operands

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043#discussion_r455495625



##########
File path: src/arith/pattern_match.h
##########
@@ -145,6 +146,14 @@ class PEqualChecker<IntImm> {
   bool operator()(const IntImm& lhs, const IntImm& rhs) const { return lhs->value == rhs->value; }
 };
 
+template <>
+class PEqualChecker<FloatImm> {
+ public:
+  bool operator()(const FloatImm& lhs, const FloatImm& rhs) const {
+    return std::fabs(rhs->value - lhs->value) < 1e-20;

Review comment:
       ```suggestion
       return std::fabs(lhs->value - rhs->value) < 1e-20;
   ```




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

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



[GitHub] [incubator-tvm] tqchen merged pull request #6043: [ARITH] Improve vector simplification for float operands

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043


   


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

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



[GitHub] [incubator-tvm] tqchen commented on a change in pull request #6043: [ARITH] Improve vector simplification for float operands

Posted by GitBox <gi...@apache.org>.
tqchen commented on a change in pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043#discussion_r455436210



##########
File path: src/arith/rewrite_simplify.cc
##########
@@ -133,6 +135,7 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const AddNode* op) {
     TVM_TRY_REWRITE(ramp(b1, s1, lanes) + broadcast(x, lanes), ramp(b1 + x, s1, lanes));
     TVM_TRY_REWRITE(broadcast(x, lanes) + ramp(b1, s1, lanes), ramp(x + b1, s1, lanes));
     TVM_TRY_REWRITE(broadcast(x, lanes) + broadcast(y, lanes), broadcast(x + y, lanes));
+    TVM_TRY_REWRITE_IF(x + broadcast(c4, lanes), x, std::fabs(c4.Eval()->value) < 1e-20);

Review comment:
       can we simply use equal instead if we just want to check 0?




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

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



[GitHub] [incubator-tvm] merrymercy commented on a change in pull request #6043: [ARITH] Improve vector simplification for float operands

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043#discussion_r455248047



##########
File path: src/arith/pattern_match.h
##########
@@ -145,6 +145,14 @@ class PEqualChecker<IntImm> {
   bool operator()(const IntImm& lhs, const IntImm& rhs) const { return lhs->value == rhs->value; }
 };
 
+template <>
+class PEqualChecker<FloatImm> {
+ public:
+  bool operator()(const FloatImm& lhs, const FloatImm& rhs) const {
+    return BaseValueEqual()(lhs->value, rhs->value);

Review comment:
       ```suggestion
       return BaseValueEqual()(rhs->value, lhs->value);
   ```




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

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



[GitHub] [incubator-tvm] merrymercy commented on a change in pull request #6043: [ARITH] Improve vector simplification for float operands

Posted by GitBox <gi...@apache.org>.
merrymercy commented on a change in pull request #6043:
URL: https://github.com/apache/incubator-tvm/pull/6043#discussion_r455227889



##########
File path: src/arith/pattern_match.h
##########
@@ -145,6 +145,14 @@ class PEqualChecker<IntImm> {
   bool operator()(const IntImm& lhs, const IntImm& rhs) const { return lhs->value == rhs->value; }
 };
 
+template <>
+class PEqualChecker<FloatImm> {
+ public:
+  bool operator()(const FloatImm& lhs, const FloatImm& rhs) const {
+    return BaseValueEqual()(rhs->value, lhs->value);

Review comment:
       ```suggestion
       return BaseValueEqual()(lhs->value, rhs->value);
   ```




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

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