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/03/09 16:27:51 UTC

[GitHub] [tvm] ashutosh-arm opened a new pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

ashutosh-arm opened a new pull request #10548:
URL: https://github.com/apache/tvm/pull/10548


   Support clip op in qnn binary op patterns for CMSIS-NN


-- 
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] manupa-arm merged pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
manupa-arm merged pull request #10548:
URL: https://github.com/apache/tvm/pull/10548


   


-- 
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] ashutosh-arm commented on pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
ashutosh-arm commented on pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#issuecomment-1063868004


   cc: @Mousius @manupa-arm @lhutton1 


-- 
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] manupa-arm commented on pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#issuecomment-1064949630


   Thanks @ashutosh-arm!


-- 
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] ashutosh-arm edited a comment on pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
ashutosh-arm edited a comment on pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#issuecomment-1063868004


   cc: @Mousius @manupa-arm @lhutton1 @grant-arm 


-- 
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] manupa-arm commented on a change in pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on a change in pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#discussion_r823565703



##########
File path: src/relay/backend/contrib/cmsisnn/relay_to_tir.cc
##########
@@ -548,7 +560,21 @@ class RelayToTIRVisitor : public MixedModeMutator {
   }
 
   void EmitAdd(const GlobalVar& global_var, const Expr& expr) {
-    auto* add_call = expr.as<CallNode>();
+    const CallNode* clip_call = nullptr;
+    const CallNode* add_call = nullptr;
+    const CallNode* final_call = expr.as<CallNode>();
+    const OpNode* final_op = final_call->op.as<OpNode>();
+    int32_t output_min = std::numeric_limits<int8_t>::min();
+    int32_t output_max = std::numeric_limits<int8_t>::max();
+    if (final_op->name == "clip") {

Review comment:
       Can we refactor the parsing of binop --> clip into a function ?
   
   As for a suggestion :
   Something like : ParseBinaryElementwiseOpClipPattern(const Expr& expr) --> 
   struct BinaryElementwiseClipPattern {
       Call binary_operator;
       Optional<Call> clip_operator;
   }
   
   So we can avoid duplicating the same code at two places.




-- 
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] ashutosh-arm commented on a change in pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
ashutosh-arm commented on a change in pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#discussion_r823966849



##########
File path: src/relay/backend/contrib/cmsisnn/relay_to_tir.cc
##########
@@ -548,7 +560,21 @@ class RelayToTIRVisitor : public MixedModeMutator {
   }
 
   void EmitAdd(const GlobalVar& global_var, const Expr& expr) {
-    auto* add_call = expr.as<CallNode>();
+    const CallNode* clip_call = nullptr;
+    const CallNode* add_call = nullptr;
+    const CallNode* final_call = expr.as<CallNode>();
+    const OpNode* final_op = final_call->op.as<OpNode>();
+    int32_t output_min = std::numeric_limits<int8_t>::min();
+    int32_t output_max = std::numeric_limits<int8_t>::max();
+    if (final_op->name == "clip") {

Review comment:
       Done. Thanks @manupa-arm. That was indeed needed.




-- 
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] manupa-arm commented on a change in pull request #10548: [CMSIS-NN] Include clip in the qnn binary op patterns

Posted by GitBox <gi...@apache.org>.
manupa-arm commented on a change in pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#discussion_r823565703



##########
File path: src/relay/backend/contrib/cmsisnn/relay_to_tir.cc
##########
@@ -548,7 +560,21 @@ class RelayToTIRVisitor : public MixedModeMutator {
   }
 
   void EmitAdd(const GlobalVar& global_var, const Expr& expr) {
-    auto* add_call = expr.as<CallNode>();
+    const CallNode* clip_call = nullptr;
+    const CallNode* add_call = nullptr;
+    const CallNode* final_call = expr.as<CallNode>();
+    const OpNode* final_op = final_call->op.as<OpNode>();
+    int32_t output_min = std::numeric_limits<int8_t>::min();
+    int32_t output_max = std::numeric_limits<int8_t>::max();
+    if (final_op->name == "clip") {

Review comment:
       Can we refactor the parsing of binop --> clip into a function ?
   
   As for a suggestion :
   Something like : ParseBinaryElementwiseOpClipPattern(const Expr& expr) --> 
   struct BinaryElementwiseClipPattern {
       Call binary_operator;
       Optional\<Call\> clip_operator;
   }
   
   So we can avoid duplicating the same code at two places.




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