blob: b5b960781ca44c1c1c134253cc51a1848722b632 [file] [log] [blame]
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +00001/*
morgolockaba2f912020-05-05 16:28:19 +01002 * Copyright (c) 2018-2020 ARM Limited.
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +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#include "arm_compute/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.h"
25#include "arm_compute/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.h"
26#include "arm_compute/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.h"
Gian Marco Iodice7026b302019-06-26 17:18:11 +010027#include "arm_compute/core/KernelDescriptors.h"
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000028#include "arm_compute/core/Types.h"
29#include "arm_compute/core/utils/misc/ShapeCalculator.h"
30#include "arm_compute/runtime/CL/CLTensor.h"
31#include "arm_compute/runtime/CL/CLTensorAllocator.h"
32#include "tests/CL/CLAccessor.h"
33#include "tests/CL/Helper.h"
34#include "tests/PaddingCalculator.h"
35#include "tests/datasets/ShapeDatasets.h"
36#include "tests/framework/Asserts.h"
37#include "tests/framework/Macros.h"
38#include "tests/framework/datasets/Datasets.h"
39#include "tests/validation/Validation.h"
40#include "tests/validation/fixtures/GEMMFixture.h"
41
42namespace arm_compute
43{
44namespace test
45{
46namespace validation
47{
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000048using namespace arm_compute::misc::shape_calculator;
49
50// Create function for CLGEMMReshapeLHSMatrixKernel
Gian Marco Iodicebacfec52019-01-11 11:30:55 +000051using CLGEMMReshapeLHSMatrix = CLSynthetizeFunction<CLGEMMReshapeLHSMatrixKernel>;
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000052
53// Create function for CLGEMMReshapeRHSMatrixKernel
Gian Marco Iodicebacfec52019-01-11 11:30:55 +000054using CLGEMMReshapeRHSMatrix = CLSynthetizeFunction<CLGEMMReshapeRHSMatrixKernel>;
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000055
56// Create function for CLGEMMMatrixMultiplyReshapedKernel
57using CLGEMMMatrixMultiplyReshaped = CLSynthetizeFunction<CLGEMMMatrixMultiplyReshapedKernel>;
58
59// Fixture for CLGEMMMatrixMultiplyReshaped
60template <typename T>
61using CLGEMMMatrixMultiplyReshapedFixture = GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
62
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +010063// Fixture for CLGEMMMatrixMultiplyReshaped mixed precision
64template <typename T>
65using CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture =
66 GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>;
67
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000068// Fixture for CLGEMMMatrixMultiplyReshaped3D
69template <typename T>
70using CLGEMMMatrixMultiplyReshaped3DFixture = GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
71
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +010072// Fixture for CLGEMMMatrixMultiplyReshaped3D mixed precision
73template <typename T>
74using CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture =
75 GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>;
76
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000077namespace
78{
79// *INDENT-OFF*
80// clang-format off
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000081RelativeTolerance<float> rel_tolerance_f32(0.001f);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000082constexpr float abs_tolerance_f32(0.0001f);
83
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +010084RelativeTolerance<float> rel_tolerance_f16_mixed_precision(0.001f);
85constexpr float abs_tolerance_f16_mixed_precision(0.01f);
86
Gian Marco Iodice05639f62019-09-24 12:05:06 +010087RelativeTolerance<float> rel_tolerance_f16(0.001f);
88constexpr float abs_tolerance_f16(0.01f);
89
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000090/** M values to test */
morgolockaba2f912020-05-05 16:28:19 +010091const auto m_values = framework::dataset::make("M", 17);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000092
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000093/** M_W values to test */
94const auto m_w_values = framework::dataset::make("M_W", 5);
95
96/** M_H values to test */
97const auto m_h_values = framework::dataset::make("M_H", 7);
98
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000099/** N values to test */
morgolockaba2f912020-05-05 16:28:19 +0100100const auto n_values = framework::dataset::make("N", 21);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000101
102/** K values to test */
morgolockaba2f912020-05-05 16:28:19 +0100103const auto k_values = framework::dataset::make("K", 13);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000104
105/** Batch size values to test */
morgolockaba2f912020-05-05 16:28:19 +0100106const auto b_values = framework::dataset::make("batch_size", 2, 3);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000107
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100108/** Activation values to test */
109const auto act_values = framework::dataset::make("Activation",
110{
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100111 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 8.f, 2.f),
112});
113
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100114/** Alpha values to test - Precommit */
115const auto a_values_precommit = framework::dataset::make("alpha", {-0.75f} );
116
117/** Beta values to test - Precommit */
118const auto beta_values_precommit = framework::dataset::make("beta", {-0.35f} );
119
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000120/** M0 values to test - Precommit */
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100121const auto m0_values_precommit = framework::dataset::make("M0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000122
123/** N0 values to test - Precommit */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100124const auto n0_values_precommit = framework::dataset::make("N0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000125
126/** K0 values to test - Precommit */
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000127const auto k0_values_precommit = framework::dataset::make("K0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000128
129/** V0 values to test - Precommit */
130const auto v0_values_precommit = framework::dataset::make("V0", 1, 3);
131
132/** H0 values to test - Precommit */
133const auto h0_values_precommit = framework::dataset::make("H0", 1, 3);
134
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100135/** Alpha values to test - Nightly */
136const auto a_values_nightly = framework::dataset::make("alpha", {1.0f} );
137
138/** Beta values to test - Nightly */
139const auto beta_values_nightly = framework::dataset::make("beta", {1.0f} );
140
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000141/** M0 values to test - Nightly */
Michele Di Giorgio2568c6b2019-09-17 12:08:46 +0100142const auto m0_values_nightly = framework::dataset::make("M0", { 2, 3, 4, 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000143
144/** N0 values to test - Nightly */
Gian Marco Iodicebacfec52019-01-11 11:30:55 +0000145const auto n0_values_nightly = framework::dataset::make("N0", { 2, 3, 4, 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000146
147/** K0 values to test - Nightly */
Gian Marco Iodicebacfec52019-01-11 11:30:55 +0000148const auto k0_values_nightly = framework::dataset::make("K0", { 2, 3, 4, 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000149
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100150/** N0 values to test with export to OpenCL image object - Nightly */
151const auto n0_export_to_cl_image_values_nightly = framework::dataset::make("N0", { 4, 8, 16 });
152
153/** K0 values to test with export to OpenCL image object - Nightly */
154const auto k0_export_to_cl_image_values_nightly = framework::dataset::make("K0", { 4, 8, 16 });
155
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000156/** V0 values to test - Nightly */
157const auto v0_values_nightly = framework::dataset::make("V0", 1, 4);
158
159/** H0 values to test - Nightly */
160const auto h0_values_nightly = framework::dataset::make("H0", 1, 4);
161
162/** Interleave values to test with LHS matrix */
163const auto i_values_lhs = framework::dataset::make("interleave_lhs", { true, false });
164
165/** Interleave values to test with RHS matrix */
166const auto i_values_rhs = framework::dataset::make("interleave_rhs", { true, false });
167
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100168/** Broadcast bias from vector to matrix */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100169const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } );
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100170
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100171/** LHS transposed values */
172const auto lhs_transpose_values = framework::dataset::make("lhs_transpose", { false, true } );
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000173} // namespace
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000174
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000175TEST_SUITE(CL)
176TEST_SUITE(GEMMMatrixMultiplyReshaped)
morgolockaba2f912020-05-05 16:28:19 +0100177
178// *INDENT-OFF*
179// clang-format off
180DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
181 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // OK
182 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK
183 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8), // Data type not supported
184 TensorInfo(TensorShape(10U, 5U, 2U), 1, DataType::F32), // Incorrect dimension bias
185 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // Mismatching shapes
186 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, do not broadcast bias
187 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, wider accummulation
188 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, RHS 4,4,2
189
190 }),
191 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32),
192 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
193 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8),
194 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32),
195 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
196 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
197 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
198 TensorInfo(TensorShape(128U, 3U, 2U), 1, DataType::F16),
199
200 })),
201 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(21U), 1, DataType::F32),
202 TensorInfo(TensorShape(21U), 1, DataType::F16),
203 TensorInfo(TensorShape(21U), 1, DataType::QASYMM8),
204 TensorInfo(TensorShape(21U), 1, DataType::F32),
205 TensorInfo(TensorShape(21U), 1, DataType::F32),
206 TensorInfo(TensorShape(21U,17U), 1, DataType::F16),
207 TensorInfo(TensorShape(21U,17U), 1, DataType::F16),
208 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
209
210 })),
211 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
212 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
213 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::QASYMM8),
214 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
215 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
216 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
217 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
218 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
219
220 })),
221 framework::dataset::make("LHSMInfo",{
222 GEMMLHSMatrixInfo(4,4,1,false,true),
223 GEMMLHSMatrixInfo(4,4,1,false,true),
224 GEMMLHSMatrixInfo(4,4,1,false,true),
225 GEMMLHSMatrixInfo(4,2,4,false,false),
226 GEMMLHSMatrixInfo(4,2,4,false,false),
227 GEMMLHSMatrixInfo(4,4,1,false,true),
228 GEMMLHSMatrixInfo(4,4,1,false,true),
229 GEMMLHSMatrixInfo(4,4,1,false,true),
230
231 })),
232 framework::dataset::make("RHSMInfo",{
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100233 GEMMRHSMatrixInfo(4,4,1,true,true,false),
234 GEMMRHSMatrixInfo(4,4,1,true,true,false),
235 GEMMRHSMatrixInfo(4,4,1,true,true,false),
236 GEMMRHSMatrixInfo(2,2,1,true,false,false),
237 GEMMRHSMatrixInfo(2,2,1,true,false,false),
238 GEMMRHSMatrixInfo(4,4,1,true,true,false),
239 GEMMRHSMatrixInfo(4,4,1,true,true,false),
240 GEMMRHSMatrixInfo(4,4,2,true,false,false),
morgolockaba2f912020-05-05 16:28:19 +0100241
242
243 })),
244
245
246 framework::dataset::make("GEMMInfo",{
247 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
248 21 /**<N Number of RHS columns*/,
249 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
250 false /**< reinterpret the input as 3D */,
251 true /**< Flag used to broadcast the bias addition */,
252 false /**< wider accumm */,
253 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
254 1 /**< Multiplication factor for the width of the 1xW transposed block */,
255 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
256 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100257 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100258 0 /**< Offset to be added to each element of the matrix A */,
259 0 /**< Offset to be added to each element of the matrix B */),
260
261 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
262 21 /**<N Number of RHS columns*/,
263 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
264 false /**< reinterpret the input as 3D */,
265 true /**< Flag used to broadcast the bias addition */,
266 false /**< wider accumm */,
267 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
268 1 /**< Multiplication factor for the width of the 1xW transposed block */,
269 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
270 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100271 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100272 0 /**< Offset to be added to each element of the matrix A */,
273 0 /**< Offset to be added to each element of the matrix B */),
274 GEMMKernelInfo(),
275 GEMMKernelInfo(),
276 GEMMKernelInfo(),
277
278 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
279 21 /**<N Number of RHS columns*/,
280 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
281 false /**< reinterpret the input as 3D */,
282 false /**< Flag used to broadcast the bias addition */,
283 false /**< wider accumm */,
284 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
285 1 /**< Multiplication factor for the width of the 1xW transposed block */,
286 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
287 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100288 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100289 0 /**< Offset to be added to each element of the matrix A */,
290 0 /**< Offset to be added to each element of the matrix B */),
291
292
293 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
294 21 /**<N Number of RHS columns*/,
295 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
296 false /**< reinterpret the input as 3D */,
297 false /**< Flag used to broadcast the bias addition */,
298 true /**< wider accumm */,
299 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
300 1 /**< Multiplication factor for the width of the 1xW transposed block */,
301 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
302 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100303 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100304 0 /**< Offset to be added to each element of the matrix A */,
305 0 /**< Offset to be added to each element of the matrix B */),
306
307 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
308 21 /**<N Number of RHS columns*/,
309 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
310 false /**< reinterpret the input as 3D */,
311 false /**< Flag used to broadcast the bias addition */,
312 false /**< wider accumm */,
313 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
314 1 /**< Multiplication factor for the width of the 1xW transposed block */,
315 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
316 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100317 GEMMRHSMatrixInfo(4,4,2,true,false,false),
morgolockaba2f912020-05-05 16:28:19 +0100318 0 /**< Offset to be added to each element of the matrix A */,
319 0 /**< Offset to be added to each element of the matrix B */),
320 })),
321 framework::dataset::make("Expected", { true, true, false, false, false, true, true,true})),
322 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
323{
324 ARM_COMPUTE_EXPECT(bool(CLGEMMMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
325 &input1_info.clone()->set_is_resizable(true),
326 &input2_info.clone()->set_is_resizable(true),
327 &output_info.clone()->set_is_resizable(true),1.f,1.f,
328 lhs_info,
329 rhs_info,
330 gemm_info)) == expected, framework::LogLevel::ERRORS);
331}
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000332TEST_SUITE(Float)
333TEST_SUITE(FP32)
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000334
335FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100336 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000337 m_values,
338 n_values),
339 k_values),
340 b_values),
341 m0_values_precommit),
342 n0_values_precommit),
343 k0_values_precommit),
344 v0_values_precommit),
345 h0_values_precommit),
346 i_values_lhs),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000347 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100348 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000349 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100350 a_values_precommit),
351 beta_values_precommit),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100352 broadcast_bias_values),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100353 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100354 act_values))
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000355{
356 // Validate output
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000357 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000358}
359
Michalis Spyrou1d897772019-12-09 18:47:29 +0000360FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100361 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000362 m_values,
363 n_values),
364 k_values),
365 b_values),
366 m0_values_nightly),
367 n0_values_nightly),
368 k0_values_nightly),
369 v0_values_nightly),
370 h0_values_nightly),
371 i_values_lhs),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000372 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100373 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000374 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100375 a_values_nightly),
376 beta_values_nightly),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100377 broadcast_bias_values),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100378 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100379 act_values))
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000380{
381 // Validate output
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000382 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000383}
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000384
385FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100386 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000387 m_w_values,
388 m_h_values),
389 n_values),
390 k_values),
391 b_values),
392 m0_values_precommit),
393 n0_values_precommit),
394 k0_values_precommit),
395 v0_values_precommit),
396 h0_values_precommit),
397 i_values_lhs),
398 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100399 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000400 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100401 a_values_precommit),
402 beta_values_precommit),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100403 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100404 act_values))
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000405{
406 // Validate output
407 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
408}
409
Michalis Spyrou1d897772019-12-09 18:47:29 +0000410FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100411 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000412 m_w_values,
413 m_h_values),
414 n_values),
415 k_values),
416 b_values),
417 m0_values_nightly),
418 n0_values_nightly),
419 k0_values_nightly),
420 v0_values_nightly),
421 h0_values_nightly),
422 i_values_lhs),
423 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100424 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000425 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100426 a_values_nightly),
427 beta_values_nightly),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100428 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100429 act_values))
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000430{
431 // Validate output
432 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
433}
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100434TEST_SUITE(ExportToCLImage)
435DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
436 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
437 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
438 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
439 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect k0
440 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect n0
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100441
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100442 }),
443 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
444 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
445 TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F32),
446 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
447 TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F32),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100448
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100449 })),
450 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F32),
451 TensorInfo(TensorShape(64U), 1, DataType::F32),
452 TensorInfo(TensorShape(64U), 1, DataType::F32),
453 TensorInfo(TensorShape(64U), 1, DataType::F32),
454 TensorInfo(TensorShape(64U), 1, DataType::F32),
455
456 })),
457 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
458 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
459 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
460 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
461 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
462 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
463
464 })),
465 framework::dataset::make("LHSMInfo",{
466 GEMMLHSMatrixInfo(4, 4, 1, false, true),
467 GEMMLHSMatrixInfo(4, 8, 1, false, true),
468 GEMMLHSMatrixInfo(4, 4, 1, false, true),
469 GEMMLHSMatrixInfo(4, 2, 1, false, false),
470 GEMMLHSMatrixInfo(4, 4, 1, false, false),
471
472 })),
473 framework::dataset::make("RHSMInfo",{
474 GEMMRHSMatrixInfo(4, 4, 1, true, true, true),
475 GEMMRHSMatrixInfo(4, 8, 1, true, true, true),
476 GEMMRHSMatrixInfo(8, 4, 1, true, true, true),
477 GEMMRHSMatrixInfo(4, 2, 1, true, false, true),
478 GEMMRHSMatrixInfo(2, 4, 1, true, false, true),
479 })),
480 framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
481 64 /**<N Number of RHS columns*/,
482 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
483 false /**< reinterpret the input as 3D */,
484 true /**< Flag used to broadcast the bias addition */,
485 false /**< wider accumm */,
486 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
487 1 /**< Multiplication factor for the width of the 1xW transposed block */,
488 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
489 GEMMLHSMatrixInfo(),
490 GEMMRHSMatrixInfo(),
491 0 /**< Offset to be added to each element of the matrix A */,
492 0 /**< Offset to be added to each element of the matrix B */),
493 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
494 64 /**<N Number of RHS columns*/,
495 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
496 false /**< reinterpret the input as 3D */,
497 true /**< Flag used to broadcast the bias addition */,
498 false /**< wider accumm */,
499 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
500 1 /**< Multiplication factor for the width of the 1xW transposed block */,
501 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
502 GEMMLHSMatrixInfo(),
503 GEMMRHSMatrixInfo(),
504 0 /**< Offset to be added to each element of the matrix A */,
505 0 /**< Offset to be added to each element of the matrix B */),
506 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
507 64 /**<N Number of RHS columns*/,
508 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
509 false /**< reinterpret the input as 3D */,
510 true /**< Flag used to broadcast the bias addition */,
511 false /**< wider accumm */,
512 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
513 1 /**< Multiplication factor for the width of the 1xW transposed block */,
514 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
515 GEMMLHSMatrixInfo(),
516 GEMMRHSMatrixInfo(),
517 0 /**< Offset to be added to each element of the matrix A */,
518 0 /**< Offset to be added to each element of the matrix B */),
519
520 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
521 64 /**<N Number of RHS columns*/,
522 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
523 false /**< reinterpret the input as 3D */,
524 true /**< Flag used to broadcast the bias addition */,
525 false /**< wider accumm */,
526 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
527 1 /**< Multiplication factor for the width of the 1xW transposed block */,
528 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
529 GEMMLHSMatrixInfo(),
530 GEMMRHSMatrixInfo(),
531 0 /**< Offset to be added to each element of the matrix A */,
532 0 /**< Offset to be added to each element of the matrix B */),
533 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
534 64 /**<N Number of RHS columns*/,
535 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
536 false /**< reinterpret the input as 3D */,
537 true /**< Flag used to broadcast the bias addition */,
538 false /**< wider accumm */,
539 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
540 1 /**< Multiplication factor for the width of the 1xW transposed block */,
541 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
542 GEMMLHSMatrixInfo(),
543 GEMMRHSMatrixInfo(),
544 0 /**< Offset to be added to each element of the matrix A */,
545 0 /**< Offset to be added to each element of the matrix B */)
546 })),
547 framework::dataset::make("Expected", { true,
548 true,
549 true,
550 false,
551 false})),
552 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
553{
554 ARM_COMPUTE_EXPECT(bool(CLGEMMMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
555 &input1_info.clone()->set_is_resizable(true),
556 &input2_info.clone()->set_is_resizable(true),
557 &output_info.clone()->set_is_resizable(true),1.f,1.f,
558 lhs_info,
559 rhs_info,
560 gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS);
561}
562
563FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL,
564 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100565 m_values,
566 n_values),
567 k_values),
568 b_values),
569 m0_values_precommit),
570 n0_values_precommit),
571 k0_values_precommit),
572 v0_values_precommit),
573 h0_values_precommit),
574 i_values_lhs),
575 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100576 framework::dataset::make("export_to_cl_image_rhs", true)),
577 framework::dataset::make("DataType", DataType::F32)),
578 a_values_precommit),
579 beta_values_precommit),
580 broadcast_bias_values),
581 lhs_transpose_values),
582 act_values))
583{
584 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
585 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
586 {
587 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
588 }
589 else
590 {
591 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
592 framework::ARM_COMPUTE_PRINT_INFO();
593 }
594
595}
596
597FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::NIGHTLY,
598 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
599 m_values,
600 n_values),
601 k_values),
602 b_values),
603 m0_values_nightly),
604 n0_export_to_cl_image_values_nightly),
605 k0_export_to_cl_image_values_nightly),
606 v0_values_nightly),
607 h0_values_nightly),
608 i_values_lhs),
609 i_values_rhs),
610 framework::dataset::make("export_to_cl_image_rhs", true)),
611 framework::dataset::make("DataType", DataType::F32)),
612 a_values_nightly),
613 beta_values_nightly),
614 broadcast_bias_values),
615 lhs_transpose_values),
616 act_values))
617{
618 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
619 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
620 {
621 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
622 }
623 else
624 {
625 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
626 framework::ARM_COMPUTE_PRINT_INFO();
627 }
628}
629
630FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL,
631 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
632 m_w_values,
633 m_h_values),
634 n_values),
635 k_values),
636 b_values),
637 m0_values_precommit),
638 n0_values_precommit),
639 k0_values_precommit),
640 v0_values_precommit),
641 h0_values_precommit),
642 i_values_lhs),
643 i_values_rhs),
644 framework::dataset::make("export_to_cl_image_rhs", true)),
645 framework::dataset::make("DataType", DataType::F32)),
646 a_values_precommit),
647 beta_values_precommit),
648 lhs_transpose_values),
649 act_values))
650{
651 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
652 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
653 {
654 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
655 }
656 else
657 {
658 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
659 framework::ARM_COMPUTE_PRINT_INFO();
660 }
661}
662
663FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::NIGHTLY,
664 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
665 m_w_values,
666 m_h_values),
667 n_values),
668 k_values),
669 b_values),
670 m0_values_nightly),
671 n0_export_to_cl_image_values_nightly),
672 k0_export_to_cl_image_values_nightly),
673 v0_values_nightly),
674 h0_values_nightly),
675 i_values_lhs),
676 i_values_rhs),
677 framework::dataset::make("export_to_cl_image_rhs", true)),
678 framework::dataset::make("DataType", DataType::F32)),
679 a_values_nightly),
680 beta_values_nightly),
681 lhs_transpose_values),
682 act_values))
683{
684 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
685 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
686 {
687 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
688 }
689 else
690 {
691 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
692 framework::ARM_COMPUTE_PRINT_INFO();
693 }
694}
695TEST_SUITE_END() // ExportToCLImage
696TEST_SUITE_END() // FP32
697
698TEST_SUITE(FP16)
699
700FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL,
701 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
702 m_values,
703 n_values),
704 k_values),
705 b_values),
706 m0_values_precommit),
707 n0_values_precommit),
708 k0_values_precommit),
709 v0_values_precommit),
710 h0_values_precommit),
711 i_values_lhs),
712 i_values_rhs),
713 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100714 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100715 a_values_precommit),
716 beta_values_precommit),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100717 broadcast_bias_values),
718 lhs_transpose_values),
719 act_values))
720{
721 // Validate output
722 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
723}
724
Michalis Spyrou1d897772019-12-09 18:47:29 +0000725FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100726 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100727 m_values,
728 n_values),
729 k_values),
730 b_values),
731 m0_values_nightly),
732 n0_values_nightly),
733 k0_values_nightly),
734 v0_values_nightly),
735 h0_values_nightly),
736 i_values_lhs),
737 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100738 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100739 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100740 a_values_nightly),
741 beta_values_nightly),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100742 broadcast_bias_values),
743 lhs_transpose_values),
744 act_values))
745{
746 // Validate output
747 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
748}
749
750FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100751 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100752 m_w_values,
753 m_h_values),
754 n_values),
755 k_values),
756 b_values),
757 m0_values_precommit),
758 n0_values_precommit),
759 k0_values_precommit),
760 v0_values_precommit),
761 h0_values_precommit),
762 i_values_lhs),
763 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100764 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100765 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100766 a_values_precommit),
767 beta_values_precommit),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100768 lhs_transpose_values),
769 act_values))
770{
771 // Validate output
772 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
773}
774
Michalis Spyrou1d897772019-12-09 18:47:29 +0000775FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100776 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100777 m_w_values,
778 m_h_values),
779 n_values),
780 k_values),
781 b_values),
782 m0_values_nightly),
783 n0_values_nightly),
784 k0_values_nightly),
785 v0_values_nightly),
786 h0_values_nightly),
787 i_values_lhs),
788 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100789 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100790 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100791 a_values_nightly),
792 beta_values_nightly),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100793 lhs_transpose_values),
794 act_values))
795{
796 // Validate output
797 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
798}
799TEST_SUITE_END() // FP16
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100800
801TEST_SUITE(MixedPrecision)
802
803FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100804 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100805 m_values,
806 n_values),
807 k_values),
808 b_values),
809 m0_values_precommit),
810 n0_values_precommit),
811 k0_values_precommit),
812 v0_values_precommit),
813 h0_values_precommit),
814 i_values_lhs),
815 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100816 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100817 framework::dataset::make("DataType", DataType::F16)),
818 a_values_precommit),
819 beta_values_precommit),
820 broadcast_bias_values),
821 lhs_transpose_values),
822 act_values))
823{
824 // Validate output
825 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
826}
827
Michalis Spyrou1d897772019-12-09 18:47:29 +0000828FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100829 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100830 m_values,
831 n_values),
832 k_values),
833 b_values),
834 m0_values_nightly),
835 n0_values_nightly),
836 k0_values_nightly),
837 v0_values_nightly),
838 h0_values_nightly),
839 i_values_lhs),
840 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100841 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100842 framework::dataset::make("DataType", DataType::F16)),
843 a_values_nightly),
844 beta_values_nightly),
845 broadcast_bias_values),
846 lhs_transpose_values),
847 act_values))
848{
849 // Validate output
850 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
851}
852
853FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100854 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100855 m_w_values,
856 m_h_values),
857 n_values),
858 k_values),
859 b_values),
860 m0_values_precommit),
861 n0_values_precommit),
862 k0_values_precommit),
863 v0_values_precommit),
864 h0_values_precommit),
865 i_values_lhs),
866 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100867 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100868 framework::dataset::make("DataType", DataType::F16)),
869 a_values_precommit),
870 beta_values_precommit),
871 lhs_transpose_values),
872 act_values))
873{
874 // Validate output
875 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
876}
877
Michalis Spyrou1d897772019-12-09 18:47:29 +0000878FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100879 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100880 m_w_values,
881 m_h_values),
882 n_values),
883 k_values),
884 b_values),
885 m0_values_nightly),
886 n0_values_nightly),
887 k0_values_nightly),
888 v0_values_nightly),
889 h0_values_nightly),
890 i_values_lhs),
891 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100892 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100893 framework::dataset::make("DataType", DataType::F16)),
894 a_values_nightly),
895 beta_values_nightly),
896 lhs_transpose_values),
897 act_values))
898{
899 // Validate output
900 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
901}
902TEST_SUITE_END() // MixedPrecision
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000903TEST_SUITE_END() // Float
Gian Marco Iodiced1f54762019-07-19 09:54:47 +0100904TEST_SUITE_END() // GEMMMatrixMultiplyReshaped
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000905TEST_SUITE_END() // CL
906} // namespace validation
907} // namespace test
Michele Di Giorgio2568c6b2019-09-17 12:08:46 +0100908} // namespace arm_compute