areusch commented on code in PR #13097:
URL: https://github.com/apache/tvm/pull/13097#discussion_r997210248


##########
src/relay/backend/contrib/cmsisnn/buffer_size.cc:
##########
@@ -16,141 +16,198 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+/*!
+ * \file src/relay/backend/contrib/cmsisnn/buffer_size.cc
+ * \brief This file contains CMSIS-NN buffer size functions similar to present
+ *  here:
+ * 
https://github.com/ARM-software/CMSIS_5/tree/51263182d16c92649a48144ba56c0945f9fce60e/CMSIS/NN
+ */
 
 #include "buffer_size.h"
 
-#include <tvm/ir/attrs.h>
-#include <tvm/ir/transform.h>
-
-#include "compiler_attrs.h"
+#include <stdint.h>
 
 namespace tvm {
 namespace relay {
 namespace contrib {
 namespace cmsisnn {
 
-int Conv2dBufferSize(bool is_int16, Target target, int32_t padding_w, int32_t 
padding_h,
-                     int32_t input_n, int32_t input_h, int32_t input_c, 
int32_t output_h,
-                     int32_t output_w, int32_t stride_w, int32_t stride_h, 
int32_t dilation_w,
-                     int32_t dilation_h, int32_t filter_w, int32_t filter_h) {
-  int size = -1;
-  if (is_int16) {
-    size = Conv2dBufferSizeInt16(target, padding_w, padding_h, input_n, 
input_h, input_c, output_h,
-                                 output_w, stride_w, stride_h, dilation_w, 
dilation_h, filter_w,
-                                 filter_h);
+#define USE_FAST_DW_CONV_FUNCTION(dw_conv_params, filter_dims, input_dims) \
+  dw_conv_params->ch_mult == 1 && dw_conv_params->dilation.w == 1 &&       \
+      dw_conv_params->dilation.h == 1 && filter_dims->w * filter_dims->h * 
input_dims->c < 512
+
+#define CH_IN_BLOCK_MVE (124)
+
+int32_t AvgpoolS16GetBufferSize(bool has_mve, bool has_dsp, const int 
output_x, const int ch_src) {

Review Comment:
   could you add docs for these so we know how to update these when CMSIS-NN 
updates?



##########
src/relay/backend/contrib/cmsisnn/types.h:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file src/relay/backend/contrib/cmsisnn/types.h
+ * \brief Includes structs and data types needed by CMSIS-NN APIs.

Review Comment:
   we could also just add CMSIS-NN to 3rdparty or copy this header into 
3rdparty too. it seems to be ASF-licensed. thoughts?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to