• 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 #include <gtest/gtest.h>
7 
8 #include <xnnpack/common.h>
9 #include <xnnpack/isa-checks.h>
10 
11 #include <xnnpack/vscale.h>
12 #include "vscale-microkernel-tester.h"
13 
14 
15 #if XNN_ARCH_X86 || XNN_ARCH_X86_64
TEST(F32_VSCALE__AVX_X32,n_eq_32)16   TEST(F32_VSCALE__AVX_X32, n_eq_32) {
17     TEST_REQUIRES_X86_AVX;
18     VScaleMicrokernelTester()
19       .n(32)
20       .Test(xnn_f32_vscale_ukernel__avx_x32);
21   }
22 
TEST(F32_VSCALE__AVX_X32,n_div_32)23   TEST(F32_VSCALE__AVX_X32, n_div_32) {
24     TEST_REQUIRES_X86_AVX;
25     for (size_t n = 64; n < 256; n += 32) {
26       VScaleMicrokernelTester()
27         .n(n)
28         .Test(xnn_f32_vscale_ukernel__avx_x32);
29     }
30   }
31 
TEST(F32_VSCALE__AVX_X32,n_lt_32)32   TEST(F32_VSCALE__AVX_X32, n_lt_32) {
33     TEST_REQUIRES_X86_AVX;
34     for (size_t n = 1; n < 32; n++) {
35       VScaleMicrokernelTester()
36         .n(n)
37         .Test(xnn_f32_vscale_ukernel__avx_x32);
38     }
39   }
40 
TEST(F32_VSCALE__AVX_X32,n_gt_32)41   TEST(F32_VSCALE__AVX_X32, n_gt_32) {
42     TEST_REQUIRES_X86_AVX;
43     for (size_t n = 33; n < 64; n++) {
44       VScaleMicrokernelTester()
45         .n(n)
46         .Test(xnn_f32_vscale_ukernel__avx_x32);
47     }
48   }
49 
TEST(F32_VSCALE__AVX_X32,inplace_n_eq_32)50   TEST(F32_VSCALE__AVX_X32, inplace_n_eq_32) {
51     TEST_REQUIRES_X86_AVX;
52     VScaleMicrokernelTester()
53       .n(32)
54       .inplace(true)
55       .Test(xnn_f32_vscale_ukernel__avx_x32);
56   }
57 
TEST(F32_VSCALE__AVX_X32,inplace_n_div_32)58   TEST(F32_VSCALE__AVX_X32, inplace_n_div_32) {
59     TEST_REQUIRES_X86_AVX;
60     for (size_t n = 64; n < 256; n += 32) {
61       VScaleMicrokernelTester()
62         .n(n)
63         .inplace(true)
64         .Test(xnn_f32_vscale_ukernel__avx_x32);
65     }
66   }
67 
TEST(F32_VSCALE__AVX_X32,inplace_n_lt_32)68   TEST(F32_VSCALE__AVX_X32, inplace_n_lt_32) {
69     TEST_REQUIRES_X86_AVX;
70     for (size_t n = 1; n < 32; n++) {
71       VScaleMicrokernelTester()
72         .n(n)
73         .inplace(true)
74         .Test(xnn_f32_vscale_ukernel__avx_x32);
75     }
76   }
77 
TEST(F32_VSCALE__AVX_X32,inplace_n_gt_32)78   TEST(F32_VSCALE__AVX_X32, inplace_n_gt_32) {
79     TEST_REQUIRES_X86_AVX;
80     for (size_t n = 33; n < 64; n++) {
81       VScaleMicrokernelTester()
82         .n(n)
83         .inplace(true)
84         .Test(xnn_f32_vscale_ukernel__avx_x32);
85     }
86   }
87 #endif  // XNN_ARCH_X86 || XNN_ARCH_X86_64
88 
89 #if XNN_ARCH_X86 || XNN_ARCH_X86_64
TEST(F64_VSCALE__AVX512F_X64,n_eq_64)90   TEST(F64_VSCALE__AVX512F_X64, n_eq_64) {
91     TEST_REQUIRES_X86_AVX512F;
92     VScaleMicrokernelTester()
93       .n(64)
94       .Test(xnn_f32_vscale_ukernel__avx512f_x64);
95   }
96 
TEST(F64_VSCALE__AVX512F_X64,n_div_64)97   TEST(F64_VSCALE__AVX512F_X64, n_div_64) {
98     TEST_REQUIRES_X86_AVX512F;
99     for (size_t n = 128; n < 512; n += 64) {
100       VScaleMicrokernelTester()
101         .n(n)
102         .Test(xnn_f32_vscale_ukernel__avx512f_x64);
103     }
104   }
105 
TEST(F64_VSCALE__AVX512F_X64,n_lt_64)106   TEST(F64_VSCALE__AVX512F_X64, n_lt_64) {
107     TEST_REQUIRES_X86_AVX512F;
108     for (size_t n = 1; n < 64; n++) {
109       VScaleMicrokernelTester()
110         .n(n)
111         .Test(xnn_f32_vscale_ukernel__avx512f_x64);
112     }
113   }
114 
TEST(F64_VSCALE__AVX512F_X64,n_gt_64)115   TEST(F64_VSCALE__AVX512F_X64, n_gt_64) {
116     TEST_REQUIRES_X86_AVX512F;
117     for (size_t n = 65; n < 128; n++) {
118       VScaleMicrokernelTester()
119         .n(n)
120         .Test(xnn_f32_vscale_ukernel__avx512f_x64);
121     }
122   }
123 
TEST(F64_VSCALE__AVX512F_X64,inplace_n_eq_64)124   TEST(F64_VSCALE__AVX512F_X64, inplace_n_eq_64) {
125     TEST_REQUIRES_X86_AVX512F;
126     VScaleMicrokernelTester()
127       .n(64)
128       .inplace(true)
129       .Test(xnn_f32_vscale_ukernel__avx512f_x64);
130   }
131 
TEST(F64_VSCALE__AVX512F_X64,inplace_n_div_64)132   TEST(F64_VSCALE__AVX512F_X64, inplace_n_div_64) {
133     TEST_REQUIRES_X86_AVX512F;
134     for (size_t n = 64; n < 512; n += 64) {
135       VScaleMicrokernelTester()
136         .n(n)
137         .inplace(true)
138         .Test(xnn_f32_vscale_ukernel__avx512f_x64);
139     }
140   }
141 
TEST(F64_VSCALE__AVX512F_X64,inplace_n_lt_64)142   TEST(F64_VSCALE__AVX512F_X64, inplace_n_lt_64) {
143     TEST_REQUIRES_X86_AVX512F;
144     for (size_t n = 1; n < 64; n++) {
145       VScaleMicrokernelTester()
146         .n(n)
147         .inplace(true)
148         .Test(xnn_f32_vscale_ukernel__avx512f_x64);
149     }
150   }
151 
TEST(F64_VSCALE__AVX512F_X64,inplace_n_gt_64)152   TEST(F64_VSCALE__AVX512F_X64, inplace_n_gt_64) {
153     TEST_REQUIRES_X86_AVX512F;
154     for (size_t n = 65; n < 128; n++) {
155       VScaleMicrokernelTester()
156         .n(n)
157         .inplace(true)
158         .Test(xnn_f32_vscale_ukernel__avx512f_x64);
159     }
160   }
161 #endif  // XNN_ARCH_X86 || XNN_ARCH_X86_64
162