Преглед изворни кода

CMSIS-NN: Make bias optional for opt functions of DW conv (#1529)

Unit tests are updated to verify functionality.
Fixes #1505

Change-Id: I71246bd08a7e60356b100860e9cd1e829ac7b794
felix-johnny пре 3 година
родитељ
комит
a90f05ead1
28 измењених фајлова са 382 додато и 146 уклоњено
  1. 21 9
      Source/ConvolutionFunctions/arm_depthwise_conv_3x3_s8.c
  2. 21 6
      Source/ConvolutionFunctions/arm_depthwise_conv_s8_opt.c
  3. 9 5
      Source/NNSupportFunctions/arm_nn_depthwise_conv_nt_t_padded_s8.c
  4. 9 5
      Source/NNSupportFunctions/arm_nn_depthwise_conv_nt_t_s8.c
  5. 20 20
      Tests/UnitTest/PregeneratedData/depthwise_eq_in_out_ch/input.txt
  6. 34 34
      Tests/UnitTest/PregeneratedData/depthwise_eq_in_out_ch/kernel.txt
  7. 21 0
      Tests/UnitTest/PregeneratedData/depthwise_kernel_3x3_null_bias/input.txt
  8. 46 0
      Tests/UnitTest/PregeneratedData/depthwise_kernel_3x3_null_bias/kernel.txt
  9. 2 2
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/biases_data.h
  10. 2 2
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/config_data.h
  11. 7 7
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/input_data.h
  12. 2 2
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/output_mult_data.h
  13. 6 7
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/output_ref_data.h
  14. 1 1
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/output_shift_data.h
  15. 1 1
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/test_data.h
  16. 4 4
      Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/weights_data.h
  17. 5 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/biases_data.h
  18. 24 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/config_data.h
  19. 10 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/input_data.h
  20. 9 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/output_mult_data.h
  21. 7 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/output_ref_data.h
  22. 5 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/output_shift_data.h
  23. 8 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/test_data.h
  24. 8 0
      Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/weights_data.h
  25. 5 2
      Tests/UnitTest/TestCases/test_arm_depthwise_conv_3x3_s8/Unity/unity_test_arm_depthwise_conv_3x3_s8.c
  26. 75 35
      Tests/UnitTest/TestCases/test_arm_depthwise_conv_3x3_s8/test_arm_depthwise_conv_3x3_s8.c
  27. 15 3
      Tests/UnitTest/TestCases/test_arm_depthwise_conv_s8_opt/test_arm_depthwise_conv_s8_opt.c
  28. 5 1
      Tests/UnitTest/generate_test_data.py

+ 21 - 9
Source/ConvolutionFunctions/arm_depthwise_conv_3x3_s8.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2022 Arm Limited or its affiliates.
+ * SPDX-FileCopyrightText: Copyright 2010-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -22,8 +22,8 @@
  * Description:  Optimized s8 depthwise convolution function for channel
  *               multiplier of 1 and 3x3 kernel size.
  *
- * $Date:        19 April 2022
- * $Revision:    V.3.0.0
+ * $Date:        19 July 2022
+ * $Revision:    V.3.1.0
  *
  * Target Processor:  Cortex-M CPUs
  *
@@ -91,7 +91,7 @@ arm_cmsis_nn_status arm_depthwise_conv_3x3_s8(const cmsis_nn_context *ctx,
     {
         return ARM_CMSIS_NN_ARG_ERROR;
     }
-
+    const int32_t *bias_base = bias;
     for (int32_t in_h = -pad_y, out_h = 0, out_idx = 0; out_h < output_y; in_h += stride_y, ++out_h)
     {
         for (int32_t in_w = -pad_x, out_w = 0, ker_h_start = MAX(0, -in_h); out_w < output_x; in_w += stride_x, ++out_w)
@@ -99,12 +99,20 @@ arm_cmsis_nn_status arm_depthwise_conv_3x3_s8(const cmsis_nn_context *ctx,
             int32_t in_ch = 0;
             int32_t ker_w_start = MAX(0, -in_w);
 
+            bias = bias_base;
             for (; in_ch <= (input_ch - 4); in_ch += 4)
             {
-                int32_t out_buff0 = bias[in_ch + 0];
-                int32_t out_buff1 = bias[in_ch + 1];
-                int32_t out_buff2 = bias[in_ch + 2];
-                int32_t out_buff3 = bias[in_ch + 3];
+                int32_t out_buff0 = 0;
+                int32_t out_buff1 = 0;
+                int32_t out_buff2 = 0;
+                int32_t out_buff3 = 0;
+                if (bias)
+                {
+                    out_buff0 = *bias++;
+                    out_buff1 = *bias++;
+                    out_buff2 = *bias++;
+                    out_buff3 = *bias++;
+                }
 
                 const int8_t *input_ptr = input + (in_h + ker_h_start) * (input_ch * input_x) + in_w * input_ch + in_ch;
                 const int8_t *kernel_ptr = kernel + ker_h_start * (input_ch * 3) + in_ch;
@@ -172,7 +180,11 @@ arm_cmsis_nn_status arm_depthwise_conv_3x3_s8(const cmsis_nn_context *ctx,
             // Leftover
             for (; in_ch < input_ch; ++in_ch)
             {
-                int32_t out_buff = bias[in_ch];
+                int32_t out_buff = 0;
+                if (bias)
+                {
+                    out_buff = *bias++;
+                }
 
                 const int8_t *input_ptr = input + (in_h + ker_h_start) * (input_ch * input_x) + in_w * input_ch + in_ch;
                 const int8_t *kernel_ptr = kernel + ker_h_start * (input_ch * 3) + in_ch;

+ 21 - 6
Source/ConvolutionFunctions/arm_depthwise_conv_s8_opt.c

@@ -176,7 +176,11 @@ arm_cmsis_nn_status arm_depthwise_conv_s8_opt(const cmsis_nn_context *ctx,
         {
             const int8_t *col_0 = lhs_buffer + (kernel_size * input_ch * i_buf) + offset;
             const int8_t *row_0 = kernel + offset;
-            int32x4_t out_0 = vldrwq_s32(&bias[offset]);
+            int32x4_t out_0 = vdupq_n_s32(0);
+            if (bias)
+            {
+                out_0 = vldrwq_s32(&bias[offset]);
+            }
 
             for (int i_ker = 0; i_ker < kernel_size; i_ker++)
             {
@@ -276,10 +280,17 @@ arm_cmsis_nn_status arm_depthwise_conv_s8_opt(const cmsis_nn_context *ctx,
 
             while (row_count)
             {
-                q31_t sum = *bias++;
-                q31_t sum_2 = *bias++;
-                q31_t sum_3 = *bias++;
-                q31_t sum_4 = *bias++;
+                q31_t sum = 0;
+                q31_t sum_2 = 0;
+                q31_t sum_3 = 0;
+                q31_t sum_4 = 0;
+                if (bias)
+                {
+                    sum = *bias++;
+                    sum_2 = *bias++;
+                    sum_3 = *bias++;
+                    sum_4 = *bias++;
+                }
 
                 uint16_t col_count = (kernel_x * kernel_y) / 2;
                 q15_t *col_pos = col_buffer_start + row_shift;
@@ -372,7 +383,11 @@ arm_cmsis_nn_status arm_depthwise_conv_s8_opt(const cmsis_nn_context *ctx,
             {
                 q15_t *col_pos = col_buffer_start + row_shift;
                 const q7_t *row_pos = kernel + row_shift;
-                q31_t sum = *bias++;
+                q31_t sum = 0;
+                if (bias)
+                {
+                    sum = *bias++;
+                }
                 const uint16_t col_count = (kernel_x * kernel_y);
                 row_shift += 1;
 

+ 9 - 5
Source/NNSupportFunctions/arm_nn_depthwise_conv_nt_t_padded_s8.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2010-2020, 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -21,8 +21,8 @@
  * Title:        arm_nn_depthwise_conv_nt_t_padded_s8.c
  * Description:  Depthwise convolution with padded matrices.
  *
- * $Date:        09. October 2020
- * $Revision:    V.1.0.2
+ * $Date:        19. July 2022
+ * $Revision:    V.1.1.0
  *
  * Target Processor:  Cortex-M processors with MVE extension
  * -------------------------------------------------------------------- */
@@ -67,11 +67,15 @@ q7_t *arm_nn_depthwise_conv_nt_t_padded_s8(const q7_t *lhs,
     for (int i_loop_cnt = 0, offset = 0; i_loop_cnt < loop_count;
          num_ch_to_process -= 4, out += 4, offset += 4, i_loop_cnt++)
     {
-        int32x4_t out_0 = vldrwq_s32(bias);
+        int32x4_t out_0 = vdupq_n_s32(0);
+        if (bias)
+        {
+            out_0 = vldrwq_s32(bias);
+            bias += 4;
+        }
         int32x4_t out_1 = out_0;
         int32x4_t out_2 = out_0;
         int32x4_t out_3 = out_0;
-        bias += 4;
 
         const int8_t *rhs_0 = rhs + offset;
         const int8_t *lhs_0 = lhs + offset;

+ 9 - 5
Source/NNSupportFunctions/arm_nn_depthwise_conv_nt_t_s8.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2010-2020, 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -21,8 +21,8 @@
  * Title:        arm_nn_depthwise_conv_nt_t_s8.c
  * Description:  Depthwise convolution on matrices with no padding.
  *
- * $Date:        09. October 2020
- * $Revision:    V.1.0.2
+ * $Date:        19. July 2022
+ * $Revision:    V.1.1.0
  *
  * Target Processor:  Cortex-M processors with MVE extension.
  * -------------------------------------------------------------------- */
@@ -66,11 +66,15 @@ q7_t *arm_nn_depthwise_conv_nt_t_s8(const q7_t *lhs,
     for (int i_loop_cnt = 0, offset = 0; i_loop_cnt < loop_count;
          num_ch_to_process -= 4, offset += 4, out += 4, i_loop_cnt++)
     {
-        int32x4_t out_0 = vldrwq_s32(bias);
+        int32x4_t out_0 = vdupq_n_s32(0);
+        if (bias)
+        {
+            out_0 = vldrwq_s32(bias);
+            bias += 4;
+        }
         int32x4_t out_1 = out_0;
         int32x4_t out_2 = out_0;
         int32x4_t out_3 = out_0;
-        bias += 4;
 
         const int8_t *rhs_0 = rhs + offset;
         const int8_t *lhs_0 = lhs + offset;

+ 20 - 20
Tests/UnitTest/PregeneratedData/depthwise_eq_in_out_ch/input.txt

@@ -1,21 +1,21 @@
 # 1,5,4,6
-7.400000000000000000e+01,-1.160000000000000000e+02,-8.300000000000000000e+01,2.000000000000000000e+00,5.900000000000000000e+01,3.900000000000000000e+01
--4.600000000000000000e+01,9.600000000000000000e+01,3.400000000000000000e+01,-7.900000000000000000e+01,8.100000000000000000e+01,-9.900000000000000000e+01
-1.300000000000000000e+01,8.800000000000000000e+01,6.600000000000000000e+01,6.700000000000000000e+01,-6.300000000000000000e+01,-2.000000000000000000e+01
--8.700000000000000000e+01,-1.000000000000000000e+02,-6.000000000000000000e+01,1.150000000000000000e+02,-2.100000000000000000e+01,-1.170000000000000000e+02
--3.100000000000000000e+01,8.500000000000000000e+01,-7.600000000000000000e+01,8.500000000000000000e+01,2.500000000000000000e+01,2.500000000000000000e+01
--1.050000000000000000e+02,1.090000000000000000e+02,6.500000000000000000e+01,-6.000000000000000000e+00,-5.700000000000000000e+01,7.000000000000000000e+00
--2.000000000000000000e+00,8.100000000000000000e+01,1.060000000000000000e+02,-8.700000000000000000e+01,1.080000000000000000e+02,-1.240000000000000000e+02
-5.000000000000000000e+00,1.000000000000000000e+01,1.600000000000000000e+01,1.700000000000000000e+01,-3.100000000000000000e+01,1.060000000000000000e+02
--4.700000000000000000e+01,-2.600000000000000000e+01,-9.300000000000000000e+01,-6.700000000000000000e+01,5.900000000000000000e+01,9.900000000000000000e+01
--8.800000000000000000e+01,-7.200000000000000000e+01,0.000000000000000000e+00,-1.900000000000000000e+01,-1.080000000000000000e+02,9.200000000000000000e+01
--1.270000000000000000e+02,5.500000000000000000e+01,7.200000000000000000e+01,9.000000000000000000e+01,-1.210000000000000000e+02,-9.000000000000000000e+00
-0.000000000000000000e+00,-3.100000000000000000e+01,-1.100000000000000000e+02,-1.080000000000000000e+02,5.100000000000000000e+01,-9.000000000000000000e+00
-9.200000000000000000e+01,1.500000000000000000e+01,7.700000000000000000e+01,8.200000000000000000e+01,-3.800000000000000000e+01,1.000000000000000000e+01
-1.250000000000000000e+02,1.120000000000000000e+02,-9.300000000000000000e+01,-4.700000000000000000e+01,6.200000000000000000e+01,9.800000000000000000e+01
-5.800000000000000000e+01,-1.000000000000000000e+00,1.500000000000000000e+01,-1.230000000000000000e+02,1.120000000000000000e+02,0.000000000000000000e+00
-9.400000000000000000e+01,7.100000000000000000e+01,7.200000000000000000e+01,2.200000000000000000e+01,1.020000000000000000e+02,-3.300000000000000000e+01
--6.200000000000000000e+01,6.700000000000000000e+01,6.400000000000000000e+01,-7.000000000000000000e+01,-8.800000000000000000e+01,7.900000000000000000e+01
--6.500000000000000000e+01,-1.160000000000000000e+02,-1.000000000000000000e+02,2.100000000000000000e+01,-3.800000000000000000e+01,-1.600000000000000000e+01
-1.300000000000000000e+01,2.400000000000000000e+01,1.800000000000000000e+01,1.080000000000000000e+02,-4.400000000000000000e+01,-6.800000000000000000e+01
-8.500000000000000000e+01,-4.400000000000000000e+01,6.200000000000000000e+01,-5.000000000000000000e+00,-9.600000000000000000e+01,7.800000000000000000e+01
+2.700000000000000000e+01,5.500000000000000000e+01,6.600000000000000000e+01,7.200000000000000000e+01,7.500000000000000000e+01,-7.400000000000000000e+01
+-3.700000000000000000e+01,-3.300000000000000000e+01,2.600000000000000000e+01,6.300000000000000000e+01,-8.900000000000000000e+01,-1.020000000000000000e+02
+7.700000000000000000e+01,-5.300000000000000000e+01,-5.800000000000000000e+01,-1.140000000000000000e+02,9.000000000000000000e+01,-6.600000000000000000e+01
+2.500000000000000000e+01,-1.120000000000000000e+02,-1.600000000000000000e+01,-1.200000000000000000e+01,7.100000000000000000e+01,-1.900000000000000000e+01
+4.800000000000000000e+01,-6.700000000000000000e+01,-5.900000000000000000e+01,0.000000000000000000e+00,5.900000000000000000e+01,1.110000000000000000e+02
+-5.000000000000000000e+00,1.080000000000000000e+02,-8.500000000000000000e+01,-5.800000000000000000e+01,-1.300000000000000000e+01,8.000000000000000000e+00
+-7.000000000000000000e+01,8.100000000000000000e+01,-1.140000000000000000e+02,1.230000000000000000e+02,-1.230000000000000000e+02,-5.100000000000000000e+01
+1.700000000000000000e+01,-5.400000000000000000e+01,-5.000000000000000000e+01,5.900000000000000000e+01,-5.000000000000000000e+00,-7.200000000000000000e+01
+-7.600000000000000000e+01,2.500000000000000000e+01,-2.100000000000000000e+01,-9.600000000000000000e+01,-1.200000000000000000e+02,-6.400000000000000000e+01
+2.900000000000000000e+01,-9.700000000000000000e+01,1.700000000000000000e+01,-7.700000000000000000e+01,-8.000000000000000000e+00,-9.700000000000000000e+01
+-7.300000000000000000e+01,6.800000000000000000e+01,-9.600000000000000000e+01,5.400000000000000000e+01,1.140000000000000000e+02,6.800000000000000000e+01
+-8.400000000000000000e+01,8.300000000000000000e+01,4.000000000000000000e+00,7.600000000000000000e+01,7.000000000000000000e+00,-2.900000000000000000e+01
+8.800000000000000000e+01,2.700000000000000000e+01,-9.200000000000000000e+01,-4.000000000000000000e+00,2.100000000000000000e+01,-8.500000000000000000e+01
+6.600000000000000000e+01,-2.200000000000000000e+01,5.900000000000000000e+01,-7.800000000000000000e+01,1.040000000000000000e+02,1.100000000000000000e+02
+1.150000000000000000e+02,-2.800000000000000000e+01,3.300000000000000000e+01,-8.500000000000000000e+01,1.240000000000000000e+02,-5.200000000000000000e+01
+-1.900000000000000000e+01,-8.100000000000000000e+01,-9.600000000000000000e+01,-9.000000000000000000e+01,-1.260000000000000000e+02,8.900000000000000000e+01
+1.220000000000000000e+02,9.600000000000000000e+01,1.240000000000000000e+02,6.400000000000000000e+01,4.000000000000000000e+01,-1.040000000000000000e+02
+-7.300000000000000000e+01,-5.000000000000000000e+00,7.300000000000000000e+01,7.000000000000000000e+01,1.600000000000000000e+01,7.200000000000000000e+01
+1.080000000000000000e+02,1.090000000000000000e+02,-1.100000000000000000e+02,8.700000000000000000e+01,3.500000000000000000e+01,-9.300000000000000000e+01
+1.200000000000000000e+01,3.500000000000000000e+01,9.000000000000000000e+00,-8.900000000000000000e+01,4.100000000000000000e+01,-4.900000000000000000e+01

+ 34 - 34
Tests/UnitTest/PregeneratedData/depthwise_eq_in_out_ch/kernel.txt

@@ -1,37 +1,37 @@
 # 3,2,6,1
-4.700000000000000000e+01
-1.200000000000000000e+01
-4.400000000000000000e+01
+-1.120000000000000000e+02
+2.500000000000000000e+01
+-9.000000000000000000e+00
+-7.200000000000000000e+01
+-1.000000000000000000e+01
+6.200000000000000000e+01
+9.200000000000000000e+01
+1.240000000000000000e+02
+9.400000000000000000e+01
+3.000000000000000000e+00
+-6.700000000000000000e+01
+1.010000000000000000e+02
+-8.100000000000000000e+01
+9.000000000000000000e+00
+0.000000000000000000e+00
+-1.100000000000000000e+02
+1.140000000000000000e+02
+-2.200000000000000000e+01
+-9.000000000000000000e+01
+-1.180000000000000000e+02
 3.800000000000000000e+01
--5.300000000000000000e+01
--4.100000000000000000e+01
--1.100000000000000000e+01
--9.300000000000000000e+01
--1.070000000000000000e+02
--4.400000000000000000e+01
--8.300000000000000000e+01
+-1.200000000000000000e+02
+9.000000000000000000e+01
+6.800000000000000000e+01
+-1.000000000000000000e+02
+-1.220000000000000000e+02
+6.900000000000000000e+01
+1.230000000000000000e+02
+-7.800000000000000000e+01
 -6.200000000000000000e+01
--2.000000000000000000e+00
-1.000000000000000000e+01
--8.700000000000000000e+01
--6.900000000000000000e+01
--1.180000000000000000e+02
--7.500000000000000000e+01
--1.280000000000000000e+02
-1.210000000000000000e+02
-6.400000000000000000e+01
--5.100000000000000000e+01
-9.300000000000000000e+01
-1.030000000000000000e+02
--1.160000000000000000e+02
-1.100000000000000000e+01
--1.250000000000000000e+02
--8.600000000000000000e+01
-2.300000000000000000e+01
-1.000000000000000000e+02
--8.200000000000000000e+01
-8.200000000000000000e+01
-2.700000000000000000e+01
-1.100000000000000000e+02
-2.500000000000000000e+01
--6.900000000000000000e+01
+-2.400000000000000000e+01
+5.000000000000000000e+01
+1.050000000000000000e+02
+-5.000000000000000000e+01
+-5.400000000000000000e+01
+5.900000000000000000e+01

+ 21 - 0
Tests/UnitTest/PregeneratedData/depthwise_kernel_3x3_null_bias/input.txt

@@ -0,0 +1,21 @@
+# 1,5,4,5
+-6.500000000000000000e+01,-2.900000000000000000e+01,5.300000000000000000e+01,3.700000000000000000e+01,1.030000000000000000e+02
+6.100000000000000000e+01,1.100000000000000000e+02,-4.600000000000000000e+01,5.700000000000000000e+01,1.800000000000000000e+01
+-1.100000000000000000e+02,1.600000000000000000e+01,-1.210000000000000000e+02,-1.200000000000000000e+01,-1.100000000000000000e+02
+-2.200000000000000000e+01,3.400000000000000000e+01,-1.150000000000000000e+02,-2.000000000000000000e+01,-4.800000000000000000e+01
+-1.090000000000000000e+02,6.100000000000000000e+01,2.100000000000000000e+01,8.900000000000000000e+01,6.400000000000000000e+01
+1.200000000000000000e+02,1.030000000000000000e+02,-6.900000000000000000e+01,-5.000000000000000000e+00,-1.800000000000000000e+01
+4.300000000000000000e+01,-6.800000000000000000e+01,-1.900000000000000000e+01,-4.900000000000000000e+01,-3.700000000000000000e+01
+-9.000000000000000000e+01,-8.900000000000000000e+01,1.220000000000000000e+02,3.100000000000000000e+01,3.700000000000000000e+01
+-1.210000000000000000e+02,1.600000000000000000e+01,7.000000000000000000e+01,-9.700000000000000000e+01,3.400000000000000000e+01
+1.200000000000000000e+02,-5.000000000000000000e+01,9.400000000000000000e+01,3.900000000000000000e+01,-5.900000000000000000e+01
+8.800000000000000000e+01,4.400000000000000000e+01,-1.020000000000000000e+02,9.500000000000000000e+01,1.030000000000000000e+02
+7.300000000000000000e+01,7.500000000000000000e+01,7.500000000000000000e+01,-1.600000000000000000e+01,6.700000000000000000e+01
+-1.010000000000000000e+02,-1.050000000000000000e+02,7.100000000000000000e+01,4.500000000000000000e+01,-7.500000000000000000e+01
+6.000000000000000000e+01,1.220000000000000000e+02,-1.130000000000000000e+02,5.000000000000000000e+01,-2.000000000000000000e+01
+3.800000000000000000e+01,-7.800000000000000000e+01,8.500000000000000000e+01,6.300000000000000000e+01,-1.020000000000000000e+02
+1.180000000000000000e+02,-5.500000000000000000e+01,-9.100000000000000000e+01,1.100000000000000000e+02,-9.600000000000000000e+01
+-1.200000000000000000e+02,5.400000000000000000e+01,3.100000000000000000e+01,6.000000000000000000e+01,1.800000000000000000e+01
+3.600000000000000000e+01,-7.900000000000000000e+01,3.400000000000000000e+01,-2.800000000000000000e+01,1.400000000000000000e+01
+4.300000000000000000e+01,-8.000000000000000000e+01,-6.900000000000000000e+01,-4.400000000000000000e+01,9.800000000000000000e+01
+1.900000000000000000e+01,-2.000000000000000000e+01,9.100000000000000000e+01,-9.000000000000000000e+01,-6.700000000000000000e+01

+ 46 - 0
Tests/UnitTest/PregeneratedData/depthwise_kernel_3x3_null_bias/kernel.txt

@@ -0,0 +1,46 @@
+# 3,3,5,1
+-1.000000000000000000e+02
+-6.800000000000000000e+01
+-1.270000000000000000e+02
+-1.230000000000000000e+02
+-8.400000000000000000e+01
+-8.800000000000000000e+01
+-5.000000000000000000e+00
+-3.800000000000000000e+01
+8.000000000000000000e+01
+-7.600000000000000000e+01
+-1.090000000000000000e+02
+-8.200000000000000000e+01
+1.180000000000000000e+02
+8.600000000000000000e+01
+2.800000000000000000e+01
+2.500000000000000000e+01
+-7.400000000000000000e+01
+-3.800000000000000000e+01
+0.000000000000000000e+00
+1.080000000000000000e+02
+-3.400000000000000000e+01
+-8.000000000000000000e+01
+-9.100000000000000000e+01
+-1.100000000000000000e+01
+5.600000000000000000e+01
+-2.800000000000000000e+01
+1.500000000000000000e+01
+1.000000000000000000e+01
+-1.100000000000000000e+02
+-2.300000000000000000e+01
+-4.000000000000000000e+00
+-1.000000000000000000e+02
+1.020000000000000000e+02
+4.500000000000000000e+01
+-2.000000000000000000e+00
+-3.100000000000000000e+01
+4.100000000000000000e+01
+4.400000000000000000e+01
+6.000000000000000000e+01
+-1.210000000000000000e+02
+-4.300000000000000000e+01
+2.800000000000000000e+01
+-9.400000000000000000e+01
+-4.900000000000000000e+01
+-8.000000000000000000e+00

+ 2 - 2
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/biases_data.h

@@ -1,5 +1,5 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #include <stdint.h>
 
-const int32_t depthwise_eq_in_out_ch_biases[6] = {11638, 15523, 23835, 6771, 24700, -31756};
+const int32_t depthwise_eq_in_out_ch_biases[6] = {0, 0, 0, 0, 0, 0};

+ 2 - 2
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/config_data.h

@@ -1,4 +1,4 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #define DEPTHWISE_EQ_IN_OUT_CH_OUT_CH 6
 #define DEPTHWISE_EQ_IN_OUT_CH_IN_CH 6
@@ -19,6 +19,6 @@
 #define DEPTHWISE_EQ_IN_OUT_CH_OUTPUT_H 5
 #define DEPTHWISE_EQ_IN_OUT_CH_CH_MULT 1
 #define DEPTHWISE_EQ_IN_OUT_CH_INPUT_OFFSET 128
-#define DEPTHWISE_EQ_IN_OUT_CH_OUTPUT_OFFSET -1
+#define DEPTHWISE_EQ_IN_OUT_CH_OUTPUT_OFFSET 3
 #define DEPTHWISE_EQ_IN_OUT_CH_DILATION_X 1
 #define DEPTHWISE_EQ_IN_OUT_CH_DILATION_Y 1

+ 7 - 7
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/input_data.h

@@ -1,11 +1,11 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #include <stdint.h>
 
 const q7_t depthwise_eq_in_out_ch_input[120] = {
-    74,   -116, -83, 2,    59,   39, -46, 96,   34,   -79,  81,   -99, 13,  88,  66,  67,  -63, -20, -87,  -100,
-    -60,  115,  -21, -117, -31,  85, -76, 85,   25,   25,   -105, 109, 65,  -6,  -57, 7,   -2,  81,  106,  -87,
-    108,  -124, 5,   10,   16,   17, -31, 106,  -47,  -26,  -93,  -67, 59,  99,  -88, -72, 0,   -19, -108, 92,
-    -127, 55,   72,  90,   -121, -9, 0,   -31,  -110, -108, 51,   -9,  92,  15,  77,  82,  -38, 10,  125,  112,
-    -93,  -47,  62,  98,   58,   -1, 15,  -123, 112,  0,    94,   71,  72,  22,  102, -33, -62, 67,  64,   -70,
-    -88,  79,   -65, -116, -100, 21, -38, -16,  13,   24,   18,   108, -44, -68, 85,  -44, 62,  -5,  -96,  78};
+    27,   55,   66,  72,  75,  -74, -37, -33, 26,  63,  -89,  -102, 77,   -53, -58,  -114, 90,  -66, 25,   -112,
+    -16,  -12,  71,  -19, 48,  -67, -59, 0,   59,  111, -5,   108,  -85,  -58, -13,  8,    -70, 81,  -114, 123,
+    -123, -51,  17,  -54, -50, 59,  -5,  -72, -76, 25,  -21,  -96,  -120, -64, 29,   -97,  17,  -77, -8,   -97,
+    -73,  68,   -96, 54,  114, 68,  -84, 83,  4,   76,  7,    -29,  88,   27,  -92,  -4,   21,  -85, 66,   -22,
+    59,   -78,  104, 110, 115, -28, 33,  -85, 124, -52, -19,  -81,  -96,  -90, -126, 89,   122, 96,  124,  64,
+    40,   -104, -73, -5,  73,  70,  16,  72,  108, 109, -110, 87,   35,   -93, 12,   35,   9,   -89, 41,   -49};

+ 2 - 2
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/output_mult_data.h

@@ -1,6 +1,6 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #include <stdint.h>
 
 const int32_t depthwise_eq_in_out_ch_output_mult[6] =
-    {1964839021, 1857386938, 1918788128, 1688533548, 1811335929, 1581081349};
+    {1584392263, 1754148604, 1485367793, 1740002251, 1612684968, 1428782275};

+ 6 - 7
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/output_ref_data.h

@@ -1,11 +1,10 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #include <stdint.h>
 
 const q7_t depthwise_eq_in_out_ch_output_ref[120] = {
-    -23, 112, 50,  -20, 44,  -53, -35, 111, 6,   -25, 20,  -7,  -35, 59,  -27, -15, 58,  -86, -8,  28,
-    -2,  -43, 21,  -7,  7,   53,  25,  -11, -20, -44, -13, 71,  -6,  5,   36,  -53, -19, 76,  -20, -44,
-    -7,  -7,  -4,  30,  20,  5,   17,  -57, -64, 42,  -27, -19, -9,  -66, -60, 59,  13,  -30, 14,  -40,
-    -72, 62,  -19, 1,   51,  -56, -15, 34,  5,   -6,  3,   -63, -55, 78,  -50, -8,  37,  -41, -53, 50,
-    24,  13,  44,  -70, -86, 73,  30,  -4,  5,   -83, -14, 32,  -31, -26, -24, -32, 19,  -6,  24,  -3,
-    10,  -86, 5,   42,  28,  -25, -18, -81, -18, 16,  13,  -42, -29, -37, 38,  31,  27,  4,   11,  -81};
+    -64, -6,  28, -51, 13,  -7, -61, -40, 15, -41, 27,  3,  -62, -35, 25, 13,  61,  11, -41, -12, 12, 20,  24,  -7,
+    -68, -43, 63, -54, 36,  16, -35, -5,  34, -86, -36, 35, -51, -24, 50, -60, -46, 20, -51, -37, 16, -3,  5,   2,
+    -83, 27,  54, -7,  -33, 69, -81, 5,   55, -42, 7,   33, -43, -27, 47, -86, 22,  37, -47, 0,   5,  -48, 26,  -17,
+    -83, -37, 98, -10, 17,  56, -86, 21,  41, 3,   22,  21, -86, 12,  50, 7,   -4,  65, -42, -20, 16, -20, -20, -3,
+    -49, 10,  44, -85, 27,  68, -38, -16, 26, -81, 22,  36, -77, -11, 14, -48, 54,  54, -36, 7,   3,  -8,  34,  22};

+ 1 - 1
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/output_shift_data.h

@@ -1,4 +1,4 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #include <stdint.h>
 

+ 1 - 1
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/test_data.h

@@ -1,4 +1,4 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #include "biases_data.h"
 #include "config_data.h"
 #include "input_data.h"

+ 4 - 4
Tests/UnitTest/TestCases/TestData/depthwise_eq_in_out_ch/weights_data.h

@@ -1,7 +1,7 @@
-// Generated by generate_test_data.py using TFL version 2.6.0 as reference.
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
 #pragma once
 #include <stdint.h>
 
-const q7_t depthwise_eq_in_out_ch_weights[36] = {47,   13, 45,   44,  -57,  -51, -11,  -98, -109, -51, -89, -76,
-                                                 -2,   10, -88,  -80, -127, -92, -127, 127, 65,   -59, 100, 127,
-                                                 -115, 12, -127, -99, 25,   123, -81,  86,  27,   127, 27,  -85};
+const q7_t depthwise_eq_in_out_ch_weights[36] = {-127, 26,   -11, -74,  -11, 78,  104,  127,  114, 3,    -75, 127,
+                                                 -92,  9,    0,   -114, 127, -28, -102, -121, 46,  -124, 100, 86,
+                                                 -113, -125, 83,  127,  -87, -78, -27,  51,   127, -52,  -60, 74};

+ 5 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/biases_data.h

@@ -0,0 +1,5 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const int32_t depthwise_kernel_3x3_null_bias_biases[5] = {0, 0, 0, 0, 0};

+ 24 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/config_data.h

@@ -0,0 +1,24 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_CH 5
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_IN_CH 5
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_W 4
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_H 5
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_DST_SIZE 30
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_SIZE 100
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_ACTIVATION_MIN -104
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_ACTIVATION_MAX 127
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_BATCHES 1
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_FILTER_X 3
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_FILTER_Y 3
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_STRIDE_X 2
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_STRIDE_Y 2
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_PAD_X 0
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_PAD_Y 1
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUTPUT_W 2
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUTPUT_H 3
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_CH_MULT 1
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_OFFSET 128
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUTPUT_OFFSET 80
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_DILATION_X 1
+#define DEPTHWISE_KERNEL_3X3_NULL_BIAS_DILATION_Y 1

+ 10 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/input_data.h

@@ -0,0 +1,10 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t depthwise_kernel_3x3_null_bias_input[100] = {
+    -65,  -29,  53, 37,  103, 61,  110, -46,  57,  18,  -110, 16,  -121, -12, -110, -22, 34,  -115, -20, -48,
+    -109, 61,   21, 89,  64,  120, 103, -69,  -5,  -18, 43,   -68, -19,  -49, -37,  -90, -89, 122,  31,  37,
+    -121, 16,   70, -97, 34,  120, -50, 94,   39,  -59, 88,   44,  -102, 95,  103,  73,  75,  75,   -16, 67,
+    -101, -105, 71, 45,  -75, 60,  122, -113, 50,  -20, 38,   -78, 85,   63,  -102, 118, -55, -91,  110, -96,
+    -120, 54,   31, 60,  18,  36,  -79, 34,   -28, 14,  43,   -80, -69,  -44, 98,   19,  -20, 91,   -90, -67};

+ 9 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/output_mult_data.h

@@ -0,0 +1,9 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const int32_t depthwise_kernel_3x3_null_bias_output_mult[5] = {1864971143,
+                                                               1710982645,
+                                                               1086474004,
+                                                               2104508734,
+                                                               2070289096};

+ 7 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/output_ref_data.h

@@ -0,0 +1,7 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t depthwise_kernel_3x3_null_bias_output_ref[30] = {39,  17, 67, 77, 116, 70, 25, 121, 104, 53,
+                                                            -58, 33, 11, 26, 42,  20, 10, 42,  127, 103,
+                                                            -14, 34, 39, 78, 93,  3,  48, -20, 71,  126};

+ 5 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/output_shift_data.h

@@ -0,0 +1,5 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const int32_t depthwise_kernel_3x3_null_bias_output_shift[5] = {-9, -9, -8, -9, -9};

+ 8 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/test_data.h

@@ -0,0 +1,8 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#include "biases_data.h"
+#include "config_data.h"
+#include "input_data.h"
+#include "output_mult_data.h"
+#include "output_ref_data.h"
+#include "output_shift_data.h"
+#include "weights_data.h"

+ 8 - 0
Tests/UnitTest/TestCases/TestData/depthwise_kernel_3x3_null_bias/weights_data.h

@@ -0,0 +1,8 @@
+// Generated by generate_test_data.py using TFL version 2.9.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t depthwise_kernel_3x3_null_bias_weights[45] = {
+    -117, -86,  -127, -127, -88, -103, -6,   -38, 83,  -80,  -127, -104, 118, 89,   29,
+    29,   -94,  -38,  0,    113, -40,  -102, -91, -11, 59,   -33,  19,   10,  -114, -24,
+    -5,   -127, 102,  46,   -2,  -36,  52,   44,  62,  -127, -50,  36,   -94, -51,  -8};

+ 5 - 2
Tests/UnitTest/TestCases/test_arm_depthwise_conv_3x3_s8/Unity/unity_test_arm_depthwise_conv_3x3_s8.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2010-2020, 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -48,4 +48,7 @@ void test_depthwise_kernel_3x3_arm_depthwise_conv_3x3_s8(void) { depthwise_kerne
 
 void test_depthwise_kernel_3x3_arm_depthwise_conv_3x3_1_s8(void) { depthwise_kernel_3x3_arm_depthwise_conv_3x3_1_s8(); }
 
-void test_depthwise_kernel_3x3_arm_depthwise_conv_3x3_2_s8(void) { depthwise_kernel_3x3_arm_depthwise_conv_3x3_2_s8(); }
+void test_depthwise_kernel_3x3_arm_depthwise_conv_3x3_null_bias_s8(void)
+{
+    depthwise_kernel_3x3_null_bias_arm_depthwise_conv_3x3_null_bias_s8();
+}

+ 75 - 35
Tests/UnitTest/TestCases/test_arm_depthwise_conv_3x3_s8/test_arm_depthwise_conv_3x3_s8.c

@@ -21,9 +21,22 @@
 #include <unity.h>
 
 #include "../TestData/depthwise_kernel_3x3/test_data.h"
+#include "../TestData/depthwise_kernel_3x3_null_bias/test_data.h"
 #include "../Utils/validate.h"
 
-static const uint16_t dilation = 1;
+const int32_t *get_bias_address(const int32_t *bias, int32_t size)
+{
+    const int32_t *return_bias = NULL;
+    for (int i = 0; i < size; i++)
+    {
+        if (bias[i] != 0)
+        {
+            return_bias = bias;
+            break;
+        }
+    }
+    return return_bias;
+}
 
 void depthwise_kernel_3x3_arm_depthwise_conv_3x3_s8(void)
 {
@@ -108,6 +121,7 @@ void depthwise_kernel_3x3_arm_depthwise_conv_3x3_s8(void)
     TEST_ASSERT_TRUE(validate(output, depthwise_kernel_3x3_output_ref, DEPTHWISE_KERNEL_3X3_DST_SIZE));
 }
 
+// Negative check to see non 3x3 dimensions return an error
 void depthwise_kernel_3x3_arm_depthwise_conv_3x3_1_s8(void)
 {
     const arm_cmsis_nn_status expected = ARM_CMSIS_NN_ARG_ERROR;
@@ -129,7 +143,7 @@ void depthwise_kernel_3x3_arm_depthwise_conv_3x3_1_s8(void)
     input_dims.w = DEPTHWISE_KERNEL_3X3_INPUT_W;
     input_dims.h = DEPTHWISE_KERNEL_3X3_INPUT_H;
     input_dims.c = DEPTHWISE_KERNEL_3X3_IN_CH;
-    filter_dims.w = DEPTHWISE_KERNEL_3X3_FILTER_X;
+    filter_dims.w = DEPTHWISE_KERNEL_3X3_FILTER_X + 1;
     filter_dims.h = DEPTHWISE_KERNEL_3X3_FILTER_Y;
     output_dims.w = DEPTHWISE_KERNEL_3X3_OUTPUT_W;
     output_dims.h = DEPTHWISE_KERNEL_3X3_OUTPUT_H;
@@ -191,10 +205,10 @@ void depthwise_kernel_3x3_arm_depthwise_conv_3x3_1_s8(void)
     TEST_ASSERT_EQUAL(expected_wrapper, result);
 }
 
-void depthwise_kernel_3x3_arm_depthwise_conv_3x3_2_s8(void)
+void depthwise_kernel_3x3_null_bias_arm_depthwise_conv_3x3_null_bias_s8(void)
 {
-    const arm_cmsis_nn_status expected = ARM_CMSIS_NN_ARG_ERROR;
-    q7_t output[DEPTHWISE_KERNEL_3X3_DST_SIZE] = {0};
+    const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS;
+    q7_t output[DEPTHWISE_KERNEL_3X3_NULL_BIAS_DST_SIZE] = {0};
 
     cmsis_nn_context ctx;
     cmsis_nn_dw_conv_params dw_conv_params;
@@ -204,35 +218,36 @@ void depthwise_kernel_3x3_arm_depthwise_conv_3x3_2_s8(void)
     cmsis_nn_dims bias_dims = {};
     cmsis_nn_dims output_dims;
 
-    const q31_t *bias_data = depthwise_kernel_3x3_biases;
-    const q7_t *kernel_data = depthwise_kernel_3x3_weights;
-    const q7_t *input_data = depthwise_kernel_3x3_input;
-
-    input_dims.n = DEPTHWISE_KERNEL_3X3_INPUT_BATCHES;
-    input_dims.w = DEPTHWISE_KERNEL_3X3_INPUT_W;
-    input_dims.h = DEPTHWISE_KERNEL_3X3_INPUT_H;
-    input_dims.c = DEPTHWISE_KERNEL_3X3_IN_CH;
-    filter_dims.w = DEPTHWISE_KERNEL_3X3_FILTER_X + 1;
-    filter_dims.h = DEPTHWISE_KERNEL_3X3_FILTER_Y;
-    output_dims.w = DEPTHWISE_KERNEL_3X3_OUTPUT_W;
-    output_dims.h = DEPTHWISE_KERNEL_3X3_OUTPUT_H;
-    output_dims.c = DEPTHWISE_KERNEL_3X3_OUT_CH;
-
-    dw_conv_params.padding.w = DEPTHWISE_KERNEL_3X3_PAD_X;
-    dw_conv_params.padding.h = DEPTHWISE_KERNEL_3X3_PAD_Y;
-    dw_conv_params.stride.w = DEPTHWISE_KERNEL_3X3_STRIDE_X;
-    dw_conv_params.stride.h = DEPTHWISE_KERNEL_3X3_STRIDE_Y;
-    dw_conv_params.dilation.w = DEPTHWISE_KERNEL_3X3_DILATION_X;
-    dw_conv_params.dilation.h = DEPTHWISE_KERNEL_3X3_DILATION_Y;
-
-    dw_conv_params.ch_mult = DEPTHWISE_KERNEL_3X3_CH_MULT;
-
-    dw_conv_params.input_offset = DEPTHWISE_KERNEL_3X3_INPUT_OFFSET;
-    dw_conv_params.output_offset = DEPTHWISE_KERNEL_3X3_OUTPUT_OFFSET;
-    dw_conv_params.activation.min = DEPTHWISE_KERNEL_3X3_OUT_ACTIVATION_MIN;
-    dw_conv_params.activation.max = DEPTHWISE_KERNEL_3X3_OUT_ACTIVATION_MAX;
-    quant_params.multiplier = (int32_t *)depthwise_kernel_3x3_output_mult;
-    quant_params.shift = (int32_t *)depthwise_kernel_3x3_output_shift;
+    const q31_t *bias_data = depthwise_kernel_3x3_null_bias_biases;
+    // get_bias_address(depthwise_kernel_3x3_null_bias_biases, DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_CH);
+    const q7_t *kernel_data = depthwise_kernel_3x3_null_bias_weights;
+    const q7_t *input_data = depthwise_kernel_3x3_null_bias_input;
+
+    input_dims.n = DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_BATCHES;
+    input_dims.w = DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_W;
+    input_dims.h = DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_H;
+    input_dims.c = DEPTHWISE_KERNEL_3X3_NULL_BIAS_IN_CH;
+    filter_dims.w = DEPTHWISE_KERNEL_3X3_NULL_BIAS_FILTER_X;
+    filter_dims.h = DEPTHWISE_KERNEL_3X3_NULL_BIAS_FILTER_Y;
+    output_dims.w = DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUTPUT_W;
+    output_dims.h = DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUTPUT_H;
+    output_dims.c = DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_CH;
+
+    dw_conv_params.padding.w = DEPTHWISE_KERNEL_3X3_NULL_BIAS_PAD_X;
+    dw_conv_params.padding.h = DEPTHWISE_KERNEL_3X3_NULL_BIAS_PAD_Y;
+    dw_conv_params.stride.w = DEPTHWISE_KERNEL_3X3_NULL_BIAS_STRIDE_X;
+    dw_conv_params.stride.h = DEPTHWISE_KERNEL_3X3_NULL_BIAS_STRIDE_Y;
+    dw_conv_params.dilation.w = DEPTHWISE_KERNEL_3X3_NULL_BIAS_DILATION_X;
+    dw_conv_params.dilation.h = DEPTHWISE_KERNEL_3X3_NULL_BIAS_DILATION_Y;
+
+    dw_conv_params.ch_mult = DEPTHWISE_KERNEL_3X3_NULL_BIAS_CH_MULT;
+
+    dw_conv_params.input_offset = DEPTHWISE_KERNEL_3X3_NULL_BIAS_INPUT_OFFSET;
+    dw_conv_params.output_offset = DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUTPUT_OFFSET;
+    dw_conv_params.activation.min = DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_ACTIVATION_MIN;
+    dw_conv_params.activation.max = DEPTHWISE_KERNEL_3X3_NULL_BIAS_OUT_ACTIVATION_MAX;
+    quant_params.multiplier = (int32_t *)depthwise_kernel_3x3_null_bias_output_mult;
+    quant_params.shift = (int32_t *)depthwise_kernel_3x3_null_bias_output_shift;
 
     ctx.buf = NULL;
     ctx.size = 0;
@@ -251,4 +266,29 @@ void depthwise_kernel_3x3_arm_depthwise_conv_3x3_2_s8(void)
 
     free(ctx.buf);
     TEST_ASSERT_EQUAL(expected, result);
-}
+    TEST_ASSERT_TRUE(
+        validate(output, depthwise_kernel_3x3_null_bias_output_ref, DEPTHWISE_KERNEL_3X3_NULL_BIAS_DST_SIZE));
+
+    const arm_cmsis_nn_status expected_wrapper = ARM_CMSIS_NN_SUCCESS;
+    const int32_t buf_size =
+        arm_depthwise_conv_wrapper_s8_get_buffer_size(&dw_conv_params, &input_dims, &filter_dims, &output_dims);
+    ctx.buf = malloc(buf_size);
+    ctx.size = 0;
+
+    result = arm_depthwise_conv_wrapper_s8(&ctx,
+                                           &dw_conv_params,
+                                           &quant_params,
+                                           &input_dims,
+                                           input_data,
+                                           &filter_dims,
+                                           kernel_data,
+                                           &bias_dims,
+                                           bias_data,
+                                           &output_dims,
+                                           output);
+
+    free(ctx.buf);
+    TEST_ASSERT_EQUAL(expected_wrapper, result);
+    TEST_ASSERT_TRUE(
+        validate(output, depthwise_kernel_3x3_null_bias_output_ref, DEPTHWISE_KERNEL_3X3_NULL_BIAS_DST_SIZE));
+}

+ 15 - 3
Tests/UnitTest/TestCases/test_arm_depthwise_conv_s8_opt/test_arm_depthwise_conv_s8_opt.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2022 Arm Limited or its affiliates.
+ * SPDX-FileCopyrightText: Copyright 2010-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -26,7 +26,19 @@
 #include "../TestData/stride2pad1/test_data.h"
 #include "../Utils/validate.h"
 
-static const uint16_t dilation = 1;
+const int32_t *get_bias_address(const int32_t *bias, int32_t size)
+{
+    const int32_t *return_bias = NULL;
+    for (int i = 0; i < size; i++)
+    {
+        if (bias[i] != 0)
+        {
+            return_bias = bias;
+            break;
+        }
+    }
+    return return_bias;
+}
 
 void basic_arm_depthwise_conv_s8_opt(void)
 {
@@ -167,7 +179,7 @@ void depthwise_eq_in_out_ch_arm_depthwise_conv_s8_opt(void)
     cmsis_nn_dims bias_dims;
     cmsis_nn_dims output_dims;
 
-    const q31_t *bias_data = depthwise_eq_in_out_ch_biases;
+    const q31_t *bias_data = get_bias_address(depthwise_eq_in_out_ch_biases, DEPTHWISE_EQ_IN_OUT_CH_IN_CH);
     const q7_t *kernel_data = depthwise_eq_in_out_ch_weights;
     const q7_t *input_data = depthwise_eq_in_out_ch_input;
 

+ 5 - 1
Tests/UnitTest/generate_test_data.py

@@ -1254,8 +1254,12 @@ def load_all_testdatasets():
     TESTDATA_SETS[dataset] = ConvSettings(dataset, type_of_test, args, in_ch=5, out_ch=5, x_in=4, y_in=5, w_x=3,
                                           w_y=3, stride_x=2, stride_y=2, pad=True,
                                           out_activation_min=-104, out_activation_max=127)
+    dataset = 'depthwise_kernel_3x3_null_bias'
+    TESTDATA_SETS[dataset] = ConvSettings(dataset, type_of_test, args, in_ch=5, out_ch=5, x_in=4, y_in=5, w_x=3,
+                                          w_y=3, stride_x=2, stride_y=2, pad=True, generate_bias=False,
+                                          out_activation_min=-104, out_activation_max=127)
     dataset = 'depthwise_eq_in_out_ch'
-    TESTDATA_SETS[dataset] = ConvSettings(dataset, type_of_test, args, in_ch=6, out_ch=6, x_in=4, y_in=5, w_x=2,
+    TESTDATA_SETS[dataset] = ConvSettings(dataset, type_of_test, args, in_ch=6, out_ch=6, x_in=4, y_in=5, w_x=2, generate_bias=False,
                                           w_y=3, stride_x=1, stride_y=1, pad=True,
                                           out_activation_min=-86, out_activation_max=127)
     dataset = 'depthwise_out_activation'