Debian Codegraph @

test/f16-dwconv-minmax-unipass.cc

raw symbols SCIP
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8 //
9 // Auto-generated file. Do not edit!
10 // Microkernel: f16-dwconv-minmax-unipass
11 // Generator: tools/generate-dwconv-unipass-test.py
12
13
14 #include <algorithm>
15 #include <cstddef>
16 #include <functional>
17 #include <string>
18 #include <vector>
19
20 #include <gtest/gtest.h>
21 #include "xnnpack/common.h"
22 #include "xnnpack/dwconv.h"
23 #include "xnnpack/isa-checks.h"
24 #include "xnnpack/microparams-init.h"
25 #include "xnnpack/requantization.h"
26 #include "dwconv-microkernel-tester.h"
27 #include "next_prime.h"
28
29 namespace {
30
31 std::vector<DWConvTestParams> CreateTests(
32 size_t c_block, bool is_pipelined, size_t cr, size_t kr,
33 std::function<void(DWConvMicrokernelTester& tester)> test_func) {
34 size_t adj_c_block = is_pipelined ? c_block * 2 : c_block;
35 const std::string cbs = std::to_string(c_block);
36 const std::string acbs = std::to_string(adj_c_block);
37
38 std::vector<DWConvTestParams> tests;
39 tests.reserve(18);
40
41 tests.push_back(DWConvTestParams(
42 "c_eq_" + cbs,
43 DWConvMicrokernelTester()
44 .channel_tile(cr)
45 .kernel_tile(kr)
46 .channels(c_block)
47 , test_func));
48
49 if (is_pipelined) {
50 tests.push_back(DWConvTestParams(
51 "c_eq_" + std::to_string(c_block * 2),
52 DWConvMicrokernelTester()
53 .channel_tile(cr)
54 .kernel_tile(kr)
55 .channels(c_block * 2)
56 , test_func));
57 }
58
59 if (c_block > 1) {
60 tests.push_back(DWConvTestParams(
61 "c_div_" + cbs,
62 DWConvMicrokernelTester()
63 .channel_tile(cr)
64 .kernel_tile(kr)
65 , test_func)
66 .loop_channels(adj_c_block + c_block, cr * 16 - 1, cr * 3));
67
68 tests.push_back(DWConvTestParams(
69 "c_div_" + cbs + "_with_qmin",
70 DWConvMicrokernelTester()
71 .channel_tile(cr)
72 .kernel_tile(kr)
73 .qmin(128)
74 , test_func)
75 .loop_channels(adj_c_block + c_block, cr * 16 - 1, cr * 3));
76
77 tests.push_back(DWConvTestParams(
78 "c_div_" + cbs + "_with_qmax",
79 DWConvMicrokernelTester()
80 .channel_tile(cr)
81 .kernel_tile(kr)
82 .qmax(128)
83 , test_func)
84 .loop_channels(adj_c_block + c_block, cr * 16 - 1, cr * 3));
85
86 tests.push_back(DWConvTestParams(
87 "c_lt_" + acbs,
88 DWConvMicrokernelTester()
89 .channel_tile(cr)
90 .kernel_tile(kr)
91 , test_func)
92 .loop_channels(1, adj_c_block - 1));
93 }
94
95 tests.push_back(DWConvTestParams(
96 "c_gt_" + acbs,
97 DWConvMicrokernelTester()
98 .channel_tile(cr)
99 .kernel_tile(kr)
100 , test_func)
101 .loop_channels(adj_c_block + 1, (c_block == 1 ? 10 : adj_c_block + c_block) - 1));
102
103 tests.push_back(DWConvTestParams(
104 "c_gt_" + acbs + "_with_qmin",
105 DWConvMicrokernelTester()
106 .channel_tile(cr)
107 .kernel_tile(kr)
108 .qmin(128)
109 , test_func)
110 .loop_channels(adj_c_block + 1, (c_block == 1 ? 10 : adj_c_block + c_block) - 1));
111
112 tests.push_back(DWConvTestParams(
113 "c_gt_" + acbs + "_with_qmax",
114 DWConvMicrokernelTester()
115 .channel_tile(cr)
116 .kernel_tile(kr)
117 .qmax(128)
118 , test_func)
119 .loop_channels(adj_c_block + 1, (c_block == 1 ? 10 : adj_c_block + c_block) - 1));
120
121 tests.push_back(DWConvTestParams(
122 "multipixel",
123 DWConvMicrokernelTester()
124 .channel_tile(cr)
125 .kernel_tile(kr)
126 .width(3)
127 , test_func)
128 .loop_channels(1, c_block * 5, std::max(size_t(1), c_block - 1)));
129
130 tests.push_back(DWConvTestParams(
131 "multipixel_with_step",
132 DWConvMicrokernelTester()
133 .channel_tile(cr)
134 .kernel_tile(kr)
135 .width(3)
136 , test_func)
137 .loop_channels(1, c_block * 5, std::max(size_t(1), c_block - 1))
138 .loop_step(2, kr));
139
140 tests.push_back(DWConvTestParams(
141 "multipixel_with_output_stride",
142 DWConvMicrokernelTester()
143 .channel_tile(cr)
144 .kernel_tile(kr)
145 .width(5)
146 .output_stride(xnnpack::NextPrime(cr * 5 + 1))
147 , test_func)
148 .loop_channels(1, c_block * 5, std::max(size_t(1), c_block - 1)));
149
150 tests.push_back(DWConvTestParams(
151 "multipixel_with_qmin",
152 DWConvMicrokernelTester()
153 .channel_tile(cr)
154 .kernel_tile(kr)
155 .width(3)
156 .qmin(128)
157 , test_func)
158 .loop_channels(1, c_block * 5, std::max(size_t(1), c_block - 1)));
159
160 tests.push_back(DWConvTestParams(
161 "multipixel_with_qmax",
162 DWConvMicrokernelTester()
163 .channel_tile(cr)
164 .kernel_tile(kr)
165 .width(3)
166 .qmax(128)
167 , test_func)
168 .loop_channels(1, c_block * 5, std::max(size_t(1), c_block - 1)));
169
170
171 tests.push_back(DWConvTestParams(
172 "input_offset",
173 DWConvMicrokernelTester()
174 .channel_tile(cr)
175 .kernel_tile(kr)
176 .input_offset(xnnpack::NextPrime(cr + 1) * 16)
177 , test_func)
178 .loop_channels(adj_c_block + c_block, cr * 16 - 1, cr * 3));
179
180 tests.push_back(DWConvTestParams(
181 "zero",
182 DWConvMicrokernelTester()
183 .channel_tile(cr)
184 .kernel_tile(kr)
185 .input_offset(xnnpack::NextPrime(cr + 1) * 16)
186 , test_func)
187 .loop_zi(0, kr - 1)
188 .loop_channels(adj_c_block + c_block, cr * 16 - 1, cr * 3));
189
190 return tests;
191 }
192
193 } // namespace
194
195 #define XNN_DWCONV_UNIPASS(arch_flags, ukernel, c_block, is_pipelined, cr, kr, datatype, weights_type, params_type, init_params)\
196 INSTANTIATE_TEST_SUITE_P( \
197 ukernel, DWConvTest, \
198 testing::ValuesIn(CreateTests( \
199 c_block, is_pipelined, cr, kr, \
200 [](DWConvMicrokernelTester& tester) { \
201 TEST_REQUIRES_ARCH_FLAGS(arch_flags); \
202 tester.Test(ukernel, init_params); \
203 })), \
204 [](const testing::TestParamInfo<DWConvTest::ParamType>& info) { \
205 return info.param.test_name; \
206 });
207 #include "f16-dwconv/f16-dwconv-minmax-unipass.h"
208 #undef XNN_UKERNEL_WITH_PARAMS