blob: 40e1ea892988754c614e0c42cdda77fbada07f17 [file] [log] [blame]
Gunes Bayir7dc02342022-11-21 21:46:50 +00001/*
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +00002 * Copyright (c) 2022-2024 Arm Limited.
Gunes Bayir7dc02342022-11-21 21:46:50 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuDepthwiseConv2d.h"
26
27#include "tests/CL/CLAccessor.h"
28#include "tests/datasets/DepthwiseConvolutionLayerDataset.h"
29#include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h"
30#include "tests/framework/Asserts.h"
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +000031#include "tests/framework/datasets/Datasets.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000032#include "tests/framework/Fixture.h"
33#include "tests/framework/Macros.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000034#include "tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h"
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +000035#include "tests/validation/Validation.h"
Gunes Bayir7dc02342022-11-21 21:46:50 +000036
37namespace arm_compute
38{
39namespace test
40{
41namespace validation
42{
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +000043const auto depth_multipliers = framework::dataset::make("DepthMultiplier", {1U, 4U});
44const auto large_depth_multipliers = framework::dataset::make("DepthMultiplier", {1, 2, 5, 8});
Gunes Bayir7dc02342022-11-21 21:46:50 +000045
46TEST_SUITE(CL)
47TEST_SUITE(DYNAMIC_FUSION)
48TEST_SUITE(DEPTHWISE_CONV2D)
49
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +000050RelativeTolerance<float> tolerance_f32(
51 0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
52RelativeTolerance<half_float::half> tolerance_f16(half_float::half(
53 0.1)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
54constexpr float tolerance_num = 0.02f; /**< Tolerance number */
Gunes Bayir7dc02342022-11-21 21:46:50 +000055
56// *INDENT-OFF*
57// clang-format off
Gunes Bayircc287732023-01-19 15:56:00 +000058DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( // Explanations of failing tests
59 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Mismatching data type input/weights
60 TensorInfo(TensorShape(3U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Mismatching input feature maps
61 TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Mismatching depth multiplier
62 TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Invalid biases size
63 TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Invalid biases dimensions
64 TensorInfo(TensorShape(8U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // dilation < 1
Gunes Bayir7dc02342022-11-21 21:46:50 +000065 TensorInfo(TensorShape(8U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC),
Gunes Bayircc287732023-01-19 15:56:00 +000066 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QASYMM8, DataLayout::NHWC), // Unsupported data type
67 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QASYMM8_SIGNED, DataLayout::NHWC), // Unsupported data type
68 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QSYMM16, DataLayout::NHWC), // Unsupported data type
69 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QSYMM8, DataLayout::NHWC), // Unsupported data type
70 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QSYMM8_PER_CHANNEL, DataLayout::NHWC), // Unsupported data type
71 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::QASYMM16, DataLayout::NHWC), // Unsupported data type
72 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::U8, DataLayout::NHWC), // Unsupported data type
73 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::S8, DataLayout::NHWC), // Unsupported data type
74 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::U16, DataLayout::NHWC), // Unsupported data type
75 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::S16, DataLayout::NHWC), // Unsupported data type
76 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::U32, DataLayout::NHWC), // Unsupported data type
77 TensorInfo(TensorShape(8U, 32U, 13U), 1, DataType::S32, DataLayout::NHWC), // Unsupported data type
78 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::F32, DataLayout::NCHW), // Unsupported data layout
Gunes Bayir7dc02342022-11-21 21:46:50 +000079 TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC),
Gunes Bayircc287732023-01-19 15:56:00 +000080 TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), // weight dimension > 3
Gunes Bayir7dc02342022-11-21 21:46:50 +000081 TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC),
82 TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC),
83 TensorInfo(TensorShape(8U, 32U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC),
84 }),
85 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F16, DataLayout::NHWC),
86 TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC),
87 TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC),
88 TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC),
89 TensorInfo(TensorShape(2U, 3U, 3U, 2U), 1, DataType::F32, DataLayout::NHWC),
Gunes Bayir7dc02342022-11-21 21:46:50 +000090 TensorInfo(TensorShape(16U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC),
91 TensorInfo(TensorShape(16U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC),
92 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QASYMM8, DataLayout::NHWC),
93 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QASYMM8_SIGNED, DataLayout::NHWC),
94 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QSYMM16, DataLayout::NHWC),
95 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QSYMM8, DataLayout::NHWC),
96 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QSYMM8_PER_CHANNEL, DataLayout::NHWC),
97 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::QASYMM16, DataLayout::NHWC),
98 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::U8, DataLayout::NHWC),
99 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::S8, DataLayout::NHWC),
100 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::U16, DataLayout::NHWC),
101 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::S16, DataLayout::NHWC),
102 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::U32, DataLayout::NHWC),
103 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::S32, DataLayout::NHWC),
104 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::F32, DataLayout::NCHW),
105 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC),
106 TensorInfo(TensorShape(24U, 3U, 3U, 5U), 1, DataType::F32, DataLayout::NHWC),
107 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC),
108 TensorInfo(TensorShape(24U, 3U, 3U), 1, DataType::F32, DataLayout::NHWC),
109 TensorInfo(TensorShape(24U, 4U, 3U), 1, DataType::F32, DataLayout::NHWC),
110 })),
111 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32, DataLayout::NHWC),
112 TensorInfo(TensorShape(2U), 1, DataType::F32, DataLayout::NHWC),
113 TensorInfo(TensorShape(2U), 1, DataType::F32, DataLayout::NHWC),
114 TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NHWC),
115 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32, DataLayout::NHWC),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000116 TensorInfo(TensorShape(16U), 1, DataType::F32, DataLayout::NHWC),
117 TensorInfo(TensorShape(16U), 1, DataType::F32, DataLayout::NHWC),
118 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
119 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
120 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
121 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
122 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
123 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
124 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
125 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
126 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
127 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
128 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
129 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NHWC),
130 TensorInfo(TensorShape(24U), 1, DataType::S32, DataLayout::NCHW),
131 TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC),
132 TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC),
133 TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC),
134 TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC),
135 TensorInfo(TensorShape(24U), 1, DataType::F32, DataLayout::NHWC),
136 })),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000137 framework::dataset::make("Padding", { Padding2D(0, 0, 0, 0),
138 Padding2D(0, 0, 0, 0),
139 Padding2D(0, 0, 0, 0),
140 Padding2D(0, 0, 0, 0),
141 Padding2D(0, 0, 0, 0),
142 Padding2D(0, 0, 0, 0),
143 Padding2D(0, 0, 0, 0),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000144 Padding2D(1, 1, 0, 0),
145 Padding2D(1, 1, 0, 0),
146 Padding2D(1, 1, 0, 0),
147 Padding2D(1, 1, 0, 0),
148 Padding2D(1, 1, 0, 0),
149 Padding2D(1, 1, 0, 0),
150 Padding2D(1, 1, 0, 0),
151 Padding2D(1, 1, 0, 0),
152 Padding2D(1, 1, 0, 0),
153 Padding2D(1, 1, 0, 0),
154 Padding2D(1, 1, 0, 0),
155 Padding2D(1, 1, 0, 0),
156 Padding2D(1, 1, 0, 0),
157 Padding2D(1, 1, 0, 0),
158 Padding2D(1, 1, 0, 0),
159 Padding2D(2, 1, 2, 1),
160 Padding2D(2, 1, 2, 1),
161 Padding2D(2, 1, 2, 1),
162 })),
163 framework::dataset::make("Stride", { Size2D(1, 1),
164 Size2D(1, 1),
165 Size2D(1, 1),
166 Size2D(1, 1),
167 Size2D(1, 1),
168 Size2D(1, 1),
169 Size2D(1, 1),
170 Size2D(1, 1),
171 Size2D(1, 1),
172 Size2D(1, 1),
173 Size2D(1, 1),
174 Size2D(1, 1),
175 Size2D(1, 1),
176 Size2D(1, 1),
177 Size2D(1, 1),
178 Size2D(1, 1),
179 Size2D(1, 1),
180 Size2D(1, 1),
181 Size2D(1, 1),
182 Size2D(1, 1),
183 Size2D(1, 1),
184 Size2D(1, 1),
185 Size2D(1, 1),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000186 Size2D(2, 3),
187 Size2D(2, 3),
188 })),
189 framework::dataset::make("DepthMultiplier", { 1,
190 1,
191 3,
192 1,
193 1,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000194 2,
195 2,
196 3,
197 3,
198 3,
199 3,
200 3,
201 3,
202 3,
203 3,
204 3,
205 3,
206 3,
207 3,
208 3,
209 3,
210 3,
211 3,
212 3,
213 3,
214 })),
215 framework::dataset::make("Dilation", { Size2D(1U, 1U),
216 Size2D(1U, 1U),
217 Size2D(1U, 1U),
218 Size2D(1U, 1U),
219 Size2D(1U, 1U),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000220 Size2D(0U, 1U),
221 Size2D(1U, 1U),
222 Size2D(1U, 1U),
223 Size2D(1U, 1U),
224 Size2D(1U, 1U),
225 Size2D(1U, 1U),
226 Size2D(1U, 1U),
227 Size2D(1U, 1U),
228 Size2D(1U, 1U),
229 Size2D(1U, 1U),
230 Size2D(1U, 1U),
231 Size2D(1U, 1U),
232 Size2D(1U, 1U),
233 Size2D(1U, 1U),
234 Size2D(1U, 1U),
235 Size2D(1U, 1U),
236 Size2D(1U, 1U),
237 Size2D(1U, 1U),
238 Size2D(1U, 1U),
239 Size2D(2U, 3U),
240 })),
Gunes Bayircc287732023-01-19 15:56:00 +0000241 framework::dataset::make("Expected", { false, false, false, false, false, false, true, false,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000242 false, false, false, false, false, false, false, false, false, false,
243 false, false, true, false, true, true, true })),
Gunes Bayircc287732023-01-19 15:56:00 +0000244 input_info, weights_info, biases_info, padding, stride, depth_multiplier, dilation, expected)
Gunes Bayir7dc02342022-11-21 21:46:50 +0000245{
246 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100247 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
248 GpuWorkloadSketch sketch{ &context };
Gunes Bayir7dc02342022-11-21 21:46:50 +0000249
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000250 const ITensorInfo* sketch_input_info = context.create_tensor_info(input_info);
251 const ITensorInfo* sketch_weights_info = context.create_tensor_info(weights_info);
252 const ITensorInfo* sketch_biases_info = context.create_tensor_info(biases_info);
Gunes Bayir7dc02342022-11-21 21:46:50 +0000253
254 DepthwiseConv2dAttributes attributes {};
255 attributes.pad(padding)
256 .stride(stride)
257 .dilation(dilation)
258 .depth_multiplier(depth_multiplier);
259
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000260 const Status status = GpuDepthwiseConv2d::validate_op(sketch, sketch_input_info, sketch_weights_info, sketch_biases_info, attributes);
Gunes Bayir7dc02342022-11-21 21:46:50 +0000261 const bool res = bool(status);
262 ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
263}
264// clang-format on
265// *INDENT-ON*
266
267template <typename T>
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000268using DynamicFusionGpuDepthwiseConv2dFixture =
269 DynamicFusionGpuDepthwiseConv2dValidationFixture<CLTensor, CLAccessor, GpuDepthwiseConv2d, T>;
Gunes Bayir7dc02342022-11-21 21:46:50 +0000270
271TEST_SUITE(Float)
272TEST_SUITE(FP16)
273TEST_SUITE(W3x3)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000274FIXTURE_DATA_TEST_CASE(RunSmall,
275 DynamicFusionGpuDepthwiseConv2dFixture<half>,
276 framework::DatasetMode::ALL,
277 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000278 framework::dataset::make("DataType", DataType::F16)),
279 framework::dataset::make("DataLayout", DataLayout::NHWC)))
280{
281 validate(CLAccessor(_target), _reference, tolerance_f16);
282}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000283FIXTURE_DATA_TEST_CASE(RunLarge,
284 DynamicFusionGpuDepthwiseConv2dFixture<half>,
285 framework::DatasetMode::NIGHTLY,
286 combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
287 large_depth_multipliers),
288 framework::dataset::make("DataType", DataType::F16)),
289 framework::dataset::make("DataLayout", DataLayout::NHWC)))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000290{
291 validate(CLAccessor(_target), _reference, tolerance_f16);
292}
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100293#ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel
Gunes Bayir7dc02342022-11-21 21:46:50 +0000294TEST_SUITE(Dilation)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000295FIXTURE_DATA_TEST_CASE(RunSmall,
296 DynamicFusionGpuDepthwiseConv2dFixture<half>,
297 framework::DatasetMode::ALL,
298 combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
299 depth_multipliers),
300 framework::dataset::make("DataType", DataType::F16)),
301 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000302{
303 validate(CLAccessor(_target), _reference, tolerance_f16);
304}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000305FIXTURE_DATA_TEST_CASE(RunLarge,
306 DynamicFusionGpuDepthwiseConv2dFixture<half>,
307 framework::DatasetMode::NIGHTLY,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000308 combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
309 large_depth_multipliers),
310 framework::dataset::make("DataType", DataType::F16)),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000311 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000312{
313 validate(CLAccessor(_target), _reference, tolerance_f16);
314}
315TEST_SUITE_END() // Dilation
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100316#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir7dc02342022-11-21 21:46:50 +0000317TEST_SUITE_END() // W3x3
318
319TEST_SUITE(Generic)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000320FIXTURE_DATA_TEST_CASE(RunSmall,
321 DynamicFusionGpuDepthwiseConv2dFixture<half>,
322 framework::DatasetMode::ALL,
323 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
324 framework::dataset::make("DataType", DataType::F16)),
325 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000326{
327 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
328}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000329FIXTURE_DATA_TEST_CASE(RunLarge,
330 DynamicFusionGpuDepthwiseConv2dFixture<half>,
331 framework::DatasetMode::NIGHTLY,
332 combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
333 large_depth_multipliers),
334 framework::dataset::make("DataType", DataType::F16)),
335 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000336{
337 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
338}
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100339#ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel
Gunes Bayir7dc02342022-11-21 21:46:50 +0000340TEST_SUITE(Dilation)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000341FIXTURE_DATA_TEST_CASE(RunSmall,
342 DynamicFusionGpuDepthwiseConv2dFixture<half>,
343 framework::DatasetMode::ALL,
344 combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
345 depth_multipliers),
346 framework::dataset::make("DataType", DataType::F16)),
347 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000348{
349 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
350}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000351FIXTURE_DATA_TEST_CASE(RunLarge,
352 DynamicFusionGpuDepthwiseConv2dFixture<half>,
353 framework::DatasetMode::NIGHTLY,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000354 combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
355 large_depth_multipliers),
356 framework::dataset::make("DataType", DataType::F16)),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000357 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000358{
359 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
360}
361TEST_SUITE_END() // Dilation
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100362#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir7dc02342022-11-21 21:46:50 +0000363TEST_SUITE_END() // Generic
364TEST_SUITE_END() // FP16
365
366TEST_SUITE(FP32)
367TEST_SUITE(W3x3)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000368FIXTURE_DATA_TEST_CASE(RunSmall,
369 DynamicFusionGpuDepthwiseConv2dFixture<float>,
370 framework::DatasetMode::ALL,
371 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000372 framework::dataset::make("DataType", DataType::F32)),
373 framework::dataset::make("DataLayout", DataLayout::NHWC)))
374{
375 validate(CLAccessor(_target), _reference, tolerance_f32);
376}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000377FIXTURE_DATA_TEST_CASE(RunLarge,
378 DynamicFusionGpuDepthwiseConv2dFixture<float>,
379 framework::DatasetMode::NIGHTLY,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000380 combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
381 large_depth_multipliers),
382 framework::dataset::make("DataType", DataType::F32)),
383 framework::dataset::make("DataLayout", DataLayout::NHWC)))
384{
385 validate(CLAccessor(_target), _reference, tolerance_f32);
386}
387
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100388#ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel
Gunes Bayir7dc02342022-11-21 21:46:50 +0000389TEST_SUITE(Dilation)
390
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000391FIXTURE_DATA_TEST_CASE(RunSmall,
392 DynamicFusionGpuDepthwiseConv2dFixture<float>,
393 framework::DatasetMode::ALL,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000394 combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
395 depth_multipliers),
396 framework::dataset::make("DataType", DataType::F32)),
397 framework::dataset::make("DataLayout", DataLayout::NHWC)))
398{
399 validate(CLAccessor(_target), _reference, tolerance_f32);
400}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000401FIXTURE_DATA_TEST_CASE(RunLarge,
402 DynamicFusionGpuDepthwiseConv2dFixture<float>,
403 framework::DatasetMode::NIGHTLY,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000404 combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
405 large_depth_multipliers),
406 framework::dataset::make("DataType", DataType::F32)),
407 framework::dataset::make("DataLayout", DataLayout::NHWC)))
408{
409 validate(CLAccessor(_target), _reference, tolerance_f32);
410}
411TEST_SUITE_END() // Dilation
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100412#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir7dc02342022-11-21 21:46:50 +0000413TEST_SUITE_END() // W3x3
414
415TEST_SUITE(Generic)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000416FIXTURE_DATA_TEST_CASE(RunSmall,
417 DynamicFusionGpuDepthwiseConv2dFixture<float>,
418 framework::DatasetMode::ALL,
419 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000420 framework::dataset::make("DataType", DataType::F32)),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000421 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000422{
423 validate(CLAccessor(_target), _reference, tolerance_f32);
424}
425
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000426FIXTURE_DATA_TEST_CASE(RunLarge,
427 DynamicFusionGpuDepthwiseConv2dFixture<float>,
428 framework::DatasetMode::NIGHTLY,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000429 combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
430 large_depth_multipliers),
431 framework::dataset::make("DataType", DataType::F32)),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000432 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000433{
434 validate(CLAccessor(_target), _reference, tolerance_f32);
435}
436
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000437FIXTURE_DATA_TEST_CASE(RunLargeKernelSize,
438 DynamicFusionGpuDepthwiseConv2dFixture<float>,
439 framework::DatasetMode::ALL,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000440 combine(combine(combine(datasets::LargeKernelSizeDepthwiseConvolutionLayerNHWCDataset(),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000441 framework::dataset::make("DepthMultiplier", {1})),
Gunes Bayir7dc02342022-11-21 21:46:50 +0000442 framework::dataset::make("DataType", DataType::F32)),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000443 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000444{
445 validate(CLAccessor(_target), _reference, tolerance_f32);
446}
447
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100448#ifndef ACL_INTERNAL_TEST_CKW_IN_DF // Do not include this test as dilation not supported yet in DepthwiseConv2d CKW kernel
Gunes Bayir7dc02342022-11-21 21:46:50 +0000449TEST_SUITE(Dilation)
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000450FIXTURE_DATA_TEST_CASE(RunSmall,
451 DynamicFusionGpuDepthwiseConv2dFixture<float>,
452 framework::DatasetMode::ALL,
453 combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
454 depth_multipliers),
455 framework::dataset::make("DataType", DataType::F32)),
456 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000457{
458 validate(CLAccessor(_target), _reference, tolerance_f32);
459}
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000460FIXTURE_DATA_TEST_CASE(RunLarge,
461 DynamicFusionGpuDepthwiseConv2dFixture<float>,
462 framework::DatasetMode::NIGHTLY,
Gunes Bayir7dc02342022-11-21 21:46:50 +0000463 combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
464 large_depth_multipliers),
465 framework::dataset::make("DataType", DataType::F32)),
Viet-Hoa Dofdf56fb2024-01-18 16:10:46 +0000466 framework::dataset::make("DataLayout", {DataLayout::NHWC})))
Gunes Bayir7dc02342022-11-21 21:46:50 +0000467{
468 validate(CLAccessor(_target), _reference, tolerance_f32);
469}
470TEST_SUITE_END() // Dilation
ramy.elgammal@arm.coma04ae3e2023-07-27 18:23:17 +0100471#endif // ACL_INTERNAL_TEST_CKW_IN_DF
Gunes Bayir7dc02342022-11-21 21:46:50 +0000472TEST_SUITE_END() // Generic
473TEST_SUITE_END() // FP32
474TEST_SUITE_END() // Float
475TEST_SUITE_END() // DEPTHWISE_CONV2D
476TEST_SUITE_END() // DYNAMIC_FUSION
477TEST_SUITE_END() // CL
478} // namespace validation
479} // namespace test
480} // namespace arm_compute