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/05/24 17:09:32 UTC

[GitHub] [tvm] ashutosh-arm opened a new pull request, #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

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

   Removed input_scale and filter_scale from CMSIS-NN
   wrapper function. These are not needed by CMSIS-NN
   API which gets called from the generated C wrapper
   function for Conv2D.


-- 
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 #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

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

   @Mousius @SebastianBoblestETAS @grant-arm for further 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] ashutosh-arm commented on a diff in pull request #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

Posted by GitBox <gi...@apache.org>.
ashutosh-arm commented on code in PR #11431:
URL: https://github.com/apache/tvm/pull/11431#discussion_r881416016


##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -742,11 +748,26 @@ class RelayToTIRVisitor : public MixedModeMutator {
                                                GetRef<Function>(func));
         }
 
+        // Drop out the redundant arguments and their arg_types from the call to the global
+        // partitioned function.

Review Comment:
   ACK



-- 
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 diff in pull request #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

Posted by GitBox <gi...@apache.org>.
ashutosh-arm commented on code in PR #11431:
URL: https://github.com/apache/tvm/pull/11431#discussion_r881415727


##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -757,7 +778,10 @@ class RelayToTIRVisitor : public MixedModeMutator {
   static constexpr int32_t kScaledDiffIntegerBits = 5;
   static constexpr int32_t kInputBits = 5;
   static constexpr double kBeta = 1.0;
+  /*! \brief Unique id for context buffer needed by CMSIS-NN layers. */
   int32_t context_buffer_id_;
+  /*! \brief Skip arguments in the call to global partitioned function. */
+  std::list<int32_t> skip_call_args_;

Review Comment:
   It was supposed to have only 2 elements. But, I have modified it now.



##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -141,18 +141,24 @@ class RelayToTIRVisitor : public MixedModeMutator {
     // %3 = qnn.requantize(%2, %input_scale_const_4, %cmsisnn_shift_const_5,
     //                     %output_scale_scalar, %output_zero_point_scalar)
     // clip(%3, a_min=%min_scalar, a_max=%max_scalar)
+    int filter_scale_pos = 3;

Review Comment:
   ACK



##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -141,18 +141,24 @@ class RelayToTIRVisitor : public MixedModeMutator {
     // %3 = qnn.requantize(%2, %input_scale_const_4, %cmsisnn_shift_const_5,
     //                     %output_scale_scalar, %output_zero_point_scalar)
     // clip(%3, a_min=%min_scalar, a_max=%max_scalar)
+    int filter_scale_pos = 3;
+    int input_scale_pos = 4;

Review Comment:
   ACK



-- 
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] Mousius merged pull request #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

Posted by GitBox <gi...@apache.org>.
Mousius merged PR #11431:
URL: https://github.com/apache/tvm/pull/11431


-- 
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] Mousius commented on pull request #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

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

   @tvm-bot merge


-- 
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 #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

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

   @Mousius I have added a test that you'd suggested. Could you please take a look?


-- 
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] huajsj commented on a diff in pull request #11431: [CMSIS-NN] Removed redudant arguments to CMSIS-NN wrapper function

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


##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -757,7 +778,10 @@ class RelayToTIRVisitor : public MixedModeMutator {
   static constexpr int32_t kScaledDiffIntegerBits = 5;
   static constexpr int32_t kInputBits = 5;
   static constexpr double kBeta = 1.0;
+  /*! \brief Unique id for context buffer needed by CMSIS-NN layers. */
   int32_t context_buffer_id_;
+  /*! \brief Skip arguments in the call to global partitioned function. */
+  std::list<int32_t> skip_call_args_;

Review Comment:
   list find complexity is O(n), unordered_set should be a better replacement.



##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -742,11 +748,26 @@ class RelayToTIRVisitor : public MixedModeMutator {
                                                GetRef<Function>(func));
         }
 
+        // Drop out the redundant arguments and their arg_types from the call to the global
+        // partitioned function.
         Array<Expr> args;
+        Array<Type> arg_types;
+        auto* func_type = new_global_var->checked_type_.as<FuncTypeNode>();
+        int arg_id = -1;
         for (const auto& arg : call->args) {
+          ++arg_id;
+          if (std::find(skip_call_args_.begin(), skip_call_args_.end(), arg_id) !=
+              skip_call_args_.end()) {
+            continue;
+          }
           args.push_back(VisitExpr(arg));
+          arg_types.push_back(func_type->arg_types[arg_id]);
         }
-
+        if (!skip_call_args_.empty()) {

Review Comment:
   "if (arg_types.size() != func_type->arg_types.size()) " ?



##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -141,18 +141,24 @@ class RelayToTIRVisitor : public MixedModeMutator {
     // %3 = qnn.requantize(%2, %input_scale_const_4, %cmsisnn_shift_const_5,
     //                     %output_scale_scalar, %output_zero_point_scalar)
     // clip(%3, a_min=%min_scalar, a_max=%max_scalar)
+    int filter_scale_pos = 3;

Review Comment:
   const int filter_scale_pos = 3.



##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -141,18 +141,24 @@ class RelayToTIRVisitor : public MixedModeMutator {
     // %3 = qnn.requantize(%2, %input_scale_const_4, %cmsisnn_shift_const_5,
     //                     %output_scale_scalar, %output_zero_point_scalar)
     // clip(%3, a_min=%min_scalar, a_max=%max_scalar)
+    int filter_scale_pos = 3;
+    int input_scale_pos = 4;

Review Comment:
   comments what is 3,4 



##########
src/relay/backend/contrib/cmsisnn/relay_to_tir.cc:
##########
@@ -742,11 +748,26 @@ class RelayToTIRVisitor : public MixedModeMutator {
                                                GetRef<Function>(func));
         }
 
+        // Drop out the redundant arguments and their arg_types from the call to the global
+        // partitioned function.

Review Comment:
   Drop out the redundant arguments, and the arg_types from the global partitioned function call



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