guberti commented on code in PR #13815:
URL: https://github.com/apache/tvm/pull/13815#discussion_r1088239878


##########
python/tvm/topi/arm_cpu/mprofile/dsp/micro_kernel/multi_channel_convolve.py:
##########
@@ -179,20 +179,26 @@ def _dual_int16_channel_convolve_impl(_tensor_h, 
tensor_w, channels, kernel_h, k
         extern "C"
         #endif
         int32_t {_get_func_name("int16", tensor_w, channels, kernel_h, 
kernel_w, suffix)}(
-            uint32_t *out,
-            uint32_t *tensor,
-            uint32_t *kernel) {{
+            int32_t *out,
+            int16_t *tensor,
+            int16_t *kernel) {{
 
-          uint32_t sum_c0 = 0;
-          uint32_t sum_c1 = 0;
+          int32_t sum_c0 = 0;
+          int32_t sum_c1 = 0;
+
+          int32_t kernel_i32[{kernel_h} * {kernel_w}];
+          memcpy(kernel_i32, kernel, {kernel_h} * {kernel_w} * 4);
+
+          int32_t tensor_length = {((kernel_w - 1) * (channels // 2) + 
(kernel_h - 1) * tensor_w * (channels // 2)) + 1};

Review Comment:
   Yep, I agree this formula is correct.



##########
python/tvm/topi/arm_cpu/mprofile/dsp/micro_kernel/multi_channel_convolve.py:
##########
@@ -179,20 +179,26 @@ def _dual_int16_channel_convolve_impl(_tensor_h, 
tensor_w, channels, kernel_h, k
         extern "C"
         #endif
         int32_t {_get_func_name("int16", tensor_w, channels, kernel_h, 
kernel_w, suffix)}(
-            uint32_t *out,
-            uint32_t *tensor,
-            uint32_t *kernel) {{
+            int32_t *out,
+            int16_t *tensor,
+            int16_t *kernel) {{
 
-          uint32_t sum_c0 = 0;
-          uint32_t sum_c1 = 0;
+          int32_t sum_c0 = 0;
+          int32_t sum_c1 = 0;
+
+          int32_t kernel_i32[{kernel_h} * {kernel_w}];
+          memcpy(kernel_i32, kernel, {kernel_h} * {kernel_w} * 
sizeof(int32_t));

Review Comment:
   I imagine these lines are removed by the compiler (and that the `memcpy` 
doesn't actually), but I would still like to confirm there is no performance 
regression. I'd also love a comment making it clearer why the `memcpy` doesn't 
slow us down like you'd expect.



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