xref: /aosp_15_r20/external/XNNPACK/test/f16-ibilinear-chw.cc (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Copyright 2020 Google LLC
2 //
3 // This source code is licensed under the BSD-style license found in the
4 // LICENSE file in the root directory of this source tree.
5 //
6 // Auto-generated file. Do not edit!
7 //   Specification: test/f16-ibilinear-chw.yaml
8 //   Generator: tools/generate-ibilinear-chw-test.py
9 
10 
11 #include <gtest/gtest.h>
12 
13 #include <xnnpack/common.h>
14 #include <xnnpack/isa-checks.h>
15 
16 #include <xnnpack/ibilinear.h>
17 #include "ibilinear-microkernel-tester.h"
18 
19 
20 #if XNN_ENABLE_ARM_FP16 && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,pixels_eq_4)21   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, pixels_eq_4) {
22     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
23     IBilinearMicrokernelTester()
24       .pixels(4)
25       .channels(1)
26       .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
27   }
28 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,pixels_div_4)29   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, pixels_div_4) {
30     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
31     for (size_t pixels = 8; pixels < 40; pixels += 4) {
32       IBilinearMicrokernelTester()
33         .pixels(pixels)
34         .channels(1)
35         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
36     }
37   }
38 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,pixels_lt_4)39   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, pixels_lt_4) {
40     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
41     for (size_t pixels = 1; pixels < 4; pixels++) {
42       IBilinearMicrokernelTester()
43         .pixels(pixels)
44         .channels(1)
45         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
46     }
47   }
48 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,pixels_gt_4)49   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, pixels_gt_4) {
50     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
51     for (size_t pixels = 5; pixels < 8; pixels++) {
52       IBilinearMicrokernelTester()
53         .pixels(pixels)
54         .channels(1)
55         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
56     }
57   }
58 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,channels_eq_1)59   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, channels_eq_1) {
60     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
61     for (size_t pixels = 1; pixels <= 20; pixels += 3) {
62       IBilinearMicrokernelTester()
63         .pixels(pixels)
64         .channels(1)
65         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
66     }
67   }
68 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,channels_gt_1)69   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, channels_gt_1) {
70     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
71     for (size_t channels = 2; channels < 3; channels++) {
72       for (size_t pixels = 1; pixels <= 20; pixels += 3) {
73         IBilinearMicrokernelTester()
74           .pixels(pixels)
75           .channels(channels)
76           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
77       }
78     }
79   }
80 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,input_offset)81   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, input_offset) {
82     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
83     for (size_t pixels = 1; pixels < 20; pixels += 3) {
84       for (size_t channels = 1; channels <= 5; channels += 1) {
85         IBilinearMicrokernelTester()
86           .pixels(pixels)
87           .channels(channels)
88           .input_offset(7)
89           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
90       }
91     }
92   }
93 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4,input_stride)94   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P4, input_stride) {
95     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
96     for (size_t pixels = 1; pixels < 20; pixels += 3) {
97       for (size_t channels = 1; channels <= 5; channels += 1) {
98         IBilinearMicrokernelTester()
99           .pixels(pixels)
100           .channels(channels)
101           .input_stride(83)
102           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p4);
103       }
104     }
105   }
106 #endif  // XNN_ENABLE_ARM_FP16 && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
107 
108 
109 #if XNN_ENABLE_ARM_FP16 && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,pixels_eq_8)110   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, pixels_eq_8) {
111     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
112     IBilinearMicrokernelTester()
113       .pixels(8)
114       .channels(1)
115       .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
116   }
117 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,pixels_div_8)118   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, pixels_div_8) {
119     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
120     for (size_t pixels = 16; pixels < 80; pixels += 8) {
121       IBilinearMicrokernelTester()
122         .pixels(pixels)
123         .channels(1)
124         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
125     }
126   }
127 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,pixels_lt_8)128   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, pixels_lt_8) {
129     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
130     for (size_t pixels = 1; pixels < 8; pixels++) {
131       IBilinearMicrokernelTester()
132         .pixels(pixels)
133         .channels(1)
134         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
135     }
136   }
137 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,pixels_gt_8)138   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, pixels_gt_8) {
139     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
140     for (size_t pixels = 9; pixels < 16; pixels++) {
141       IBilinearMicrokernelTester()
142         .pixels(pixels)
143         .channels(1)
144         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
145     }
146   }
147 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,channels_eq_1)148   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, channels_eq_1) {
149     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
150     for (size_t pixels = 1; pixels <= 40; pixels += 7) {
151       IBilinearMicrokernelTester()
152         .pixels(pixels)
153         .channels(1)
154         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
155     }
156   }
157 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,channels_gt_1)158   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, channels_gt_1) {
159     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
160     for (size_t channels = 2; channels < 3; channels++) {
161       for (size_t pixels = 1; pixels <= 40; pixels += 7) {
162         IBilinearMicrokernelTester()
163           .pixels(pixels)
164           .channels(channels)
165           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
166       }
167     }
168   }
169 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,input_offset)170   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, input_offset) {
171     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
172     for (size_t pixels = 1; pixels < 40; pixels += 7) {
173       for (size_t channels = 1; channels <= 5; channels += 1) {
174         IBilinearMicrokernelTester()
175           .pixels(pixels)
176           .channels(channels)
177           .input_offset(7)
178           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
179       }
180     }
181   }
182 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8,input_stride)183   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P8, input_stride) {
184     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
185     for (size_t pixels = 1; pixels < 40; pixels += 7) {
186       for (size_t channels = 1; channels <= 5; channels += 1) {
187         IBilinearMicrokernelTester()
188           .pixels(pixels)
189           .channels(channels)
190           .input_stride(163)
191           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p8);
192       }
193     }
194   }
195 #endif  // XNN_ENABLE_ARM_FP16 && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
196 
197 
198 #if XNN_ENABLE_ARM_FP16 && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,pixels_eq_16)199   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, pixels_eq_16) {
200     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
201     IBilinearMicrokernelTester()
202       .pixels(16)
203       .channels(1)
204       .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
205   }
206 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,pixels_div_16)207   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, pixels_div_16) {
208     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
209     for (size_t pixels = 32; pixels < 160; pixels += 16) {
210       IBilinearMicrokernelTester()
211         .pixels(pixels)
212         .channels(1)
213         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
214     }
215   }
216 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,pixels_lt_16)217   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, pixels_lt_16) {
218     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
219     for (size_t pixels = 1; pixels < 16; pixels++) {
220       IBilinearMicrokernelTester()
221         .pixels(pixels)
222         .channels(1)
223         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
224     }
225   }
226 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,pixels_gt_16)227   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, pixels_gt_16) {
228     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
229     for (size_t pixels = 17; pixels < 32; pixels++) {
230       IBilinearMicrokernelTester()
231         .pixels(pixels)
232         .channels(1)
233         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
234     }
235   }
236 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,channels_eq_1)237   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, channels_eq_1) {
238     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
239     for (size_t pixels = 1; pixels <= 80; pixels += 15) {
240       IBilinearMicrokernelTester()
241         .pixels(pixels)
242         .channels(1)
243         .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
244     }
245   }
246 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,channels_gt_1)247   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, channels_gt_1) {
248     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
249     for (size_t channels = 2; channels < 3; channels++) {
250       for (size_t pixels = 1; pixels <= 80; pixels += 15) {
251         IBilinearMicrokernelTester()
252           .pixels(pixels)
253           .channels(channels)
254           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
255       }
256     }
257   }
258 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,input_offset)259   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, input_offset) {
260     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
261     for (size_t pixels = 1; pixels < 80; pixels += 15) {
262       for (size_t channels = 1; channels <= 5; channels += 1) {
263         IBilinearMicrokernelTester()
264           .pixels(pixels)
265           .channels(channels)
266           .input_offset(7)
267           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
268       }
269     }
270   }
271 
TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16,input_stride)272   TEST(F16_IBILINEAR_CHW__NEONFP16ARITH_P16, input_stride) {
273     TEST_REQUIRES_ARM_NEON_FP16_ARITH;
274     for (size_t pixels = 1; pixels < 80; pixels += 15) {
275       for (size_t channels = 1; channels <= 5; channels += 1) {
276         IBilinearMicrokernelTester()
277           .pixels(pixels)
278           .channels(channels)
279           .input_stride(331)
280           .TestCHW(xnn_f16_ibilinear_chw_ukernel__neonfp16arith_p16);
281       }
282     }
283   }
284 #endif  // XNN_ENABLE_ARM_FP16 && (XNN_ARCH_ARM || XNN_ARCH_ARM64)
285