• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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/s8-vclamp.yaml
8 //   Generator: tools/generate-vunary-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/vunary.h>
17 #include "vunary-microkernel-tester.h"
18 
19 
20 #if XNN_ARCH_ARM || XNN_ARCH_ARM64
TEST(S8_VCLAMP__NEON_X64,batch_eq_64)21   TEST(S8_VCLAMP__NEON_X64, batch_eq_64) {
22     TEST_REQUIRES_ARM_NEON;
23     VUnaryMicrokernelTester()
24       .batch_size(64)
25       .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
26   }
27 
TEST(S8_VCLAMP__NEON_X64,batch_div_64)28   TEST(S8_VCLAMP__NEON_X64, batch_div_64) {
29     TEST_REQUIRES_ARM_NEON;
30     for (size_t batch_size = 128; batch_size < 640; batch_size += 64) {
31       VUnaryMicrokernelTester()
32         .batch_size(batch_size)
33         .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
34     }
35   }
36 
TEST(S8_VCLAMP__NEON_X64,batch_lt_64)37   TEST(S8_VCLAMP__NEON_X64, batch_lt_64) {
38     TEST_REQUIRES_ARM_NEON;
39     for (size_t batch_size = 1; batch_size < 64; batch_size++) {
40       VUnaryMicrokernelTester()
41         .batch_size(batch_size)
42         .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
43     }
44   }
45 
TEST(S8_VCLAMP__NEON_X64,batch_gt_64)46   TEST(S8_VCLAMP__NEON_X64, batch_gt_64) {
47     TEST_REQUIRES_ARM_NEON;
48     for (size_t batch_size = 65; batch_size < 128; batch_size++) {
49       VUnaryMicrokernelTester()
50         .batch_size(batch_size)
51         .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
52     }
53   }
54 
TEST(S8_VCLAMP__NEON_X64,inplace)55   TEST(S8_VCLAMP__NEON_X64, inplace) {
56     TEST_REQUIRES_ARM_NEON;
57     for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
58       VUnaryMicrokernelTester()
59         .batch_size(batch_size)
60         .inplace(true)
61         .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
62     }
63   }
64 
TEST(S8_VCLAMP__NEON_X64,qmin)65   TEST(S8_VCLAMP__NEON_X64, qmin) {
66     TEST_REQUIRES_ARM_NEON;
67     for (uint8_t qmin = 1; qmin < 255; qmin++) {
68       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
69         VUnaryMicrokernelTester()
70           .batch_size(batch_size)
71           .qmin(qmin)
72           .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
73       }
74     }
75   }
76 
TEST(S8_VCLAMP__NEON_X64,qmax)77   TEST(S8_VCLAMP__NEON_X64, qmax) {
78     TEST_REQUIRES_ARM_NEON;
79     for (uint8_t qmax = 1; qmax < 255; qmax++) {
80       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
81         VUnaryMicrokernelTester()
82           .batch_size(batch_size)
83           .qmax(qmax)
84           .Test(xnn_s8_vclamp_ukernel__neon_x64, xnn_init_s8_minmax_neon_params);
85       }
86     }
87   }
88 #endif  // XNN_ARCH_ARM || XNN_ARCH_ARM64
89 
90 
91 #if XNN_ARCH_X86 || XNN_ARCH_X86_64
TEST(S8_VCLAMP__SSE2_X64,batch_eq_64)92   TEST(S8_VCLAMP__SSE2_X64, batch_eq_64) {
93     TEST_REQUIRES_X86_SSE2;
94     VUnaryMicrokernelTester()
95       .batch_size(64)
96       .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
97   }
98 
TEST(S8_VCLAMP__SSE2_X64,batch_div_64)99   TEST(S8_VCLAMP__SSE2_X64, batch_div_64) {
100     TEST_REQUIRES_X86_SSE2;
101     for (size_t batch_size = 128; batch_size < 640; batch_size += 64) {
102       VUnaryMicrokernelTester()
103         .batch_size(batch_size)
104         .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
105     }
106   }
107 
TEST(S8_VCLAMP__SSE2_X64,batch_lt_64)108   TEST(S8_VCLAMP__SSE2_X64, batch_lt_64) {
109     TEST_REQUIRES_X86_SSE2;
110     for (size_t batch_size = 1; batch_size < 64; batch_size++) {
111       VUnaryMicrokernelTester()
112         .batch_size(batch_size)
113         .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
114     }
115   }
116 
TEST(S8_VCLAMP__SSE2_X64,batch_gt_64)117   TEST(S8_VCLAMP__SSE2_X64, batch_gt_64) {
118     TEST_REQUIRES_X86_SSE2;
119     for (size_t batch_size = 65; batch_size < 128; batch_size++) {
120       VUnaryMicrokernelTester()
121         .batch_size(batch_size)
122         .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
123     }
124   }
125 
TEST(S8_VCLAMP__SSE2_X64,inplace)126   TEST(S8_VCLAMP__SSE2_X64, inplace) {
127     TEST_REQUIRES_X86_SSE2;
128     for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
129       VUnaryMicrokernelTester()
130         .batch_size(batch_size)
131         .inplace(true)
132         .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
133     }
134   }
135 
TEST(S8_VCLAMP__SSE2_X64,qmin)136   TEST(S8_VCLAMP__SSE2_X64, qmin) {
137     TEST_REQUIRES_X86_SSE2;
138     for (uint8_t qmin = 1; qmin < 255; qmin++) {
139       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
140         VUnaryMicrokernelTester()
141           .batch_size(batch_size)
142           .qmin(qmin)
143           .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
144       }
145     }
146   }
147 
TEST(S8_VCLAMP__SSE2_X64,qmax)148   TEST(S8_VCLAMP__SSE2_X64, qmax) {
149     TEST_REQUIRES_X86_SSE2;
150     for (uint8_t qmax = 1; qmax < 255; qmax++) {
151       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
152         VUnaryMicrokernelTester()
153           .batch_size(batch_size)
154           .qmax(qmax)
155           .Test(xnn_s8_vclamp_ukernel__sse2_x64, xnn_init_s8_minmax_sse2_params);
156       }
157     }
158   }
159 #endif  // XNN_ARCH_X86 || XNN_ARCH_X86_64
160 
161 
162 #if XNN_ARCH_X86 || XNN_ARCH_X86_64
TEST(S8_VCLAMP__SSE41_X64,batch_eq_64)163   TEST(S8_VCLAMP__SSE41_X64, batch_eq_64) {
164     TEST_REQUIRES_X86_SSE41;
165     VUnaryMicrokernelTester()
166       .batch_size(64)
167       .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
168   }
169 
TEST(S8_VCLAMP__SSE41_X64,batch_div_64)170   TEST(S8_VCLAMP__SSE41_X64, batch_div_64) {
171     TEST_REQUIRES_X86_SSE41;
172     for (size_t batch_size = 128; batch_size < 640; batch_size += 64) {
173       VUnaryMicrokernelTester()
174         .batch_size(batch_size)
175         .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
176     }
177   }
178 
TEST(S8_VCLAMP__SSE41_X64,batch_lt_64)179   TEST(S8_VCLAMP__SSE41_X64, batch_lt_64) {
180     TEST_REQUIRES_X86_SSE41;
181     for (size_t batch_size = 1; batch_size < 64; batch_size++) {
182       VUnaryMicrokernelTester()
183         .batch_size(batch_size)
184         .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
185     }
186   }
187 
TEST(S8_VCLAMP__SSE41_X64,batch_gt_64)188   TEST(S8_VCLAMP__SSE41_X64, batch_gt_64) {
189     TEST_REQUIRES_X86_SSE41;
190     for (size_t batch_size = 65; batch_size < 128; batch_size++) {
191       VUnaryMicrokernelTester()
192         .batch_size(batch_size)
193         .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
194     }
195   }
196 
TEST(S8_VCLAMP__SSE41_X64,inplace)197   TEST(S8_VCLAMP__SSE41_X64, inplace) {
198     TEST_REQUIRES_X86_SSE41;
199     for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
200       VUnaryMicrokernelTester()
201         .batch_size(batch_size)
202         .inplace(true)
203         .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
204     }
205   }
206 
TEST(S8_VCLAMP__SSE41_X64,qmin)207   TEST(S8_VCLAMP__SSE41_X64, qmin) {
208     TEST_REQUIRES_X86_SSE41;
209     for (uint8_t qmin = 1; qmin < 255; qmin++) {
210       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
211         VUnaryMicrokernelTester()
212           .batch_size(batch_size)
213           .qmin(qmin)
214           .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
215       }
216     }
217   }
218 
TEST(S8_VCLAMP__SSE41_X64,qmax)219   TEST(S8_VCLAMP__SSE41_X64, qmax) {
220     TEST_REQUIRES_X86_SSE41;
221     for (uint8_t qmax = 1; qmax < 255; qmax++) {
222       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
223         VUnaryMicrokernelTester()
224           .batch_size(batch_size)
225           .qmax(qmax)
226           .Test(xnn_s8_vclamp_ukernel__sse41_x64, xnn_init_s8_minmax_sse4_params);
227       }
228     }
229   }
230 #endif  // XNN_ARCH_X86 || XNN_ARCH_X86_64
231 
232 
233 #if XNN_ARCH_WASMSIMD || XNN_ARCH_WASMRELAXEDSIMD
TEST(S8_VCLAMP__WASMSIMD_X64,batch_eq_64)234   TEST(S8_VCLAMP__WASMSIMD_X64, batch_eq_64) {
235     VUnaryMicrokernelTester()
236       .batch_size(64)
237       .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
238   }
239 
TEST(S8_VCLAMP__WASMSIMD_X64,batch_div_64)240   TEST(S8_VCLAMP__WASMSIMD_X64, batch_div_64) {
241     for (size_t batch_size = 128; batch_size < 640; batch_size += 64) {
242       VUnaryMicrokernelTester()
243         .batch_size(batch_size)
244         .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
245     }
246   }
247 
TEST(S8_VCLAMP__WASMSIMD_X64,batch_lt_64)248   TEST(S8_VCLAMP__WASMSIMD_X64, batch_lt_64) {
249     for (size_t batch_size = 1; batch_size < 64; batch_size++) {
250       VUnaryMicrokernelTester()
251         .batch_size(batch_size)
252         .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
253     }
254   }
255 
TEST(S8_VCLAMP__WASMSIMD_X64,batch_gt_64)256   TEST(S8_VCLAMP__WASMSIMD_X64, batch_gt_64) {
257     for (size_t batch_size = 65; batch_size < 128; batch_size++) {
258       VUnaryMicrokernelTester()
259         .batch_size(batch_size)
260         .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
261     }
262   }
263 
TEST(S8_VCLAMP__WASMSIMD_X64,inplace)264   TEST(S8_VCLAMP__WASMSIMD_X64, inplace) {
265     for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
266       VUnaryMicrokernelTester()
267         .batch_size(batch_size)
268         .inplace(true)
269         .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
270     }
271   }
272 
TEST(S8_VCLAMP__WASMSIMD_X64,qmin)273   TEST(S8_VCLAMP__WASMSIMD_X64, qmin) {
274     for (uint8_t qmin = 1; qmin < 255; qmin++) {
275       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
276         VUnaryMicrokernelTester()
277           .batch_size(batch_size)
278           .qmin(qmin)
279           .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
280       }
281     }
282   }
283 
TEST(S8_VCLAMP__WASMSIMD_X64,qmax)284   TEST(S8_VCLAMP__WASMSIMD_X64, qmax) {
285     for (uint8_t qmax = 1; qmax < 255; qmax++) {
286       for (size_t batch_size = 1; batch_size <= 320; batch_size += 63) {
287         VUnaryMicrokernelTester()
288           .batch_size(batch_size)
289           .qmax(qmax)
290           .Test(xnn_s8_vclamp_ukernel__wasmsimd_x64, xnn_init_s8_minmax_wasmsimd_params);
291       }
292     }
293   }
294 #endif  // XNN_ARCH_WASMSIMD || XNN_ARCH_WASMRELAXEDSIMD
295 
296 
TEST(S8_VCLAMP__SCALAR_X4,batch_eq_4)297 TEST(S8_VCLAMP__SCALAR_X4, batch_eq_4) {
298   VUnaryMicrokernelTester()
299     .batch_size(4)
300     .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
301 }
302 
TEST(S8_VCLAMP__SCALAR_X4,batch_div_4)303 TEST(S8_VCLAMP__SCALAR_X4, batch_div_4) {
304   for (size_t batch_size = 8; batch_size < 40; batch_size += 4) {
305     VUnaryMicrokernelTester()
306       .batch_size(batch_size)
307       .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
308   }
309 }
310 
TEST(S8_VCLAMP__SCALAR_X4,batch_lt_4)311 TEST(S8_VCLAMP__SCALAR_X4, batch_lt_4) {
312   for (size_t batch_size = 1; batch_size < 4; batch_size++) {
313     VUnaryMicrokernelTester()
314       .batch_size(batch_size)
315       .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
316   }
317 }
318 
TEST(S8_VCLAMP__SCALAR_X4,batch_gt_4)319 TEST(S8_VCLAMP__SCALAR_X4, batch_gt_4) {
320   for (size_t batch_size = 5; batch_size < 8; batch_size++) {
321     VUnaryMicrokernelTester()
322       .batch_size(batch_size)
323       .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
324   }
325 }
326 
TEST(S8_VCLAMP__SCALAR_X4,inplace)327 TEST(S8_VCLAMP__SCALAR_X4, inplace) {
328   for (size_t batch_size = 1; batch_size <= 20; batch_size += 3) {
329     VUnaryMicrokernelTester()
330       .batch_size(batch_size)
331       .inplace(true)
332       .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
333   }
334 }
335 
TEST(S8_VCLAMP__SCALAR_X4,qmin)336 TEST(S8_VCLAMP__SCALAR_X4, qmin) {
337   for (uint8_t qmin = 1; qmin < 255; qmin++) {
338     for (size_t batch_size = 1; batch_size <= 20; batch_size += 3) {
339       VUnaryMicrokernelTester()
340         .batch_size(batch_size)
341         .qmin(qmin)
342         .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
343     }
344   }
345 }
346 
TEST(S8_VCLAMP__SCALAR_X4,qmax)347 TEST(S8_VCLAMP__SCALAR_X4, qmax) {
348   for (uint8_t qmax = 1; qmax < 255; qmax++) {
349     for (size_t batch_size = 1; batch_size <= 20; batch_size += 3) {
350       VUnaryMicrokernelTester()
351         .batch_size(batch_size)
352         .qmax(qmax)
353         .Test(xnn_s8_vclamp_ukernel__scalar_x4, xnn_init_s8_minmax_scalar_params);
354     }
355   }
356 }
357