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 2021/01/27 22:43:36 UTC

[GitHub] [tvm] mbrookhart opened a new pull request #7354: Fold If when the Condition is Constant

mbrookhart opened a new pull request #7354:
URL: https://github.com/apache/tvm/pull/7354


   @jroesch @jwfromm 
   


----------------------------------------------------------------
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] [tvm] masahi commented on pull request #7354: [Relay] Fold If when the Condition is Constant

Posted by GitBox <gi...@apache.org>.
masahi commented on pull request #7354:
URL: https://github.com/apache/tvm/pull/7354#issuecomment-768792198


   thanks @mbrookhart @jwfromm 


----------------------------------------------------------------
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] [tvm] masahi commented on a change in pull request #7354: [Relay] Fold If when the Condition is Constant

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #7354:
URL: https://github.com/apache/tvm/pull/7354#discussion_r565769392



##########
File path: src/relay/transforms/fold_constant.cc
##########
@@ -120,6 +120,18 @@ class ConstantFolder : public MixedModeMutator {
     }
   }
 
+  Expr VisitExpr_(const IfNode* op) final {
+    auto new_cond = ExprMutator::VisitExpr(op->cond);
+    if (auto const_cond = new_cond.as<ConstantNode>()) {
+      if (reinterpret_cast<uint8_t*>(const_cond->data->data)[0]) {

Review comment:
       there is no representation of `bool*`, things need to be byte-addressable




----------------------------------------------------------------
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] [tvm] masahi merged pull request #7354: [Relay] Fold If when the Condition is Constant

Posted by GitBox <gi...@apache.org>.
masahi merged pull request #7354:
URL: https://github.com/apache/tvm/pull/7354


   


----------------------------------------------------------------
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] [tvm] jwfromm commented on a change in pull request #7354: [Relay] Fold If when the Condition is Constant

Posted by GitBox <gi...@apache.org>.
jwfromm commented on a change in pull request #7354:
URL: https://github.com/apache/tvm/pull/7354#discussion_r565696211



##########
File path: src/relay/transforms/fold_constant.cc
##########
@@ -120,6 +120,18 @@ class ConstantFolder : public MixedModeMutator {
     }
   }
 
+  Expr VisitExpr_(const IfNode* op) final {
+    auto new_cond = ExprMutator::VisitExpr(op->cond);
+    if (auto const_cond = new_cond.as<ConstantNode>()) {
+      if (reinterpret_cast<uint8_t*>(const_cond->data->data)[0]) {

Review comment:
       why not use a bool datatype for the cast?




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