blob: b06e4bf213de37a636cba813ecd884d0493d4731 [file] [log] [blame]
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +00001/*
Jakub Sujak0d27b2e2023-08-24 14:01:20 +01002 * Copyright (c) 2018-2023 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 */
Gian Marco Iodice7026b302019-06-26 17:18:11 +010024#include "arm_compute/core/KernelDescriptors.h"
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000025#include "arm_compute/core/Types.h"
26#include "arm_compute/core/utils/misc/ShapeCalculator.h"
27#include "arm_compute/runtime/CL/CLTensor.h"
28#include "arm_compute/runtime/CL/CLTensorAllocator.h"
Georgios Pinitas7891a732021-08-20 21:39:25 +010029#include "src/gpu/cl/kernels/ClGemmMatrixMultiplyReshapedKernel.h"
30#include "src/gpu/cl/kernels/ClGemmReshapeLhsMatrixKernel.h"
31#include "src/gpu/cl/kernels/ClGemmReshapeRhsMatrixKernel.h"
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000032#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;
Georgios Pinitas856f66e2021-04-22 21:13:21 +010049using namespace arm_compute::opencl::kernels;
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000050
Georgios Pinitas856f66e2021-04-22 21:13:21 +010051// Create function for ClGemmReshapeLhsMatrixKernel
52using CLGEMMReshapeLHSMatrix = CLSynthetizeOperator<ClGemmReshapeLhsMatrixKernel>;
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000053
Georgios Pinitas856f66e2021-04-22 21:13:21 +010054// Create function for ClGemmReshapeRhsMatrixKernel
55using CLGEMMReshapeRHSMatrix = CLSynthetizeOperator<ClGemmReshapeRhsMatrixKernel>;
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000056
Georgios Pinitas856f66e2021-04-22 21:13:21 +010057// Create function for ClGemmMatrixMultiplyReshapedKernel
58using CLGEMMMatrixMultiplyReshaped = CLSynthetizeOperator<ClGemmMatrixMultiplyReshapedKernel>;
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000059
60// Fixture for CLGEMMMatrixMultiplyReshaped
61template <typename T>
62using CLGEMMMatrixMultiplyReshapedFixture = GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
63
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +010064// Fixture for CLGEMMMatrixMultiplyReshaped mixed precision
65template <typename T>
66using CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture =
67 GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>;
68
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000069// Fixture for CLGEMMMatrixMultiplyReshaped3D
70template <typename T>
71using CLGEMMMatrixMultiplyReshaped3DFixture = GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>;
72
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +010073// Fixture for CLGEMMMatrixMultiplyReshaped3D mixed precision
74template <typename T>
75using CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture =
76 GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>;
77
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000078namespace
79{
80// *INDENT-OFF*
81// clang-format off
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000082RelativeTolerance<float> rel_tolerance_f32(0.001f);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000083constexpr float abs_tolerance_f32(0.0001f);
84
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +010085RelativeTolerance<float> rel_tolerance_f16_mixed_precision(0.001f);
86constexpr float abs_tolerance_f16_mixed_precision(0.01f);
87
Gian Marco Iodice05639f62019-09-24 12:05:06 +010088RelativeTolerance<float> rel_tolerance_f16(0.001f);
89constexpr float abs_tolerance_f16(0.01f);
90
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000091/** M values to test */
morgolockaba2f912020-05-05 16:28:19 +010092const auto m_values = framework::dataset::make("M", 17);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +000093
Gian Marco Iodice9382ab32018-12-17 15:12:07 +000094/** M_W values to test */
95const auto m_w_values = framework::dataset::make("M_W", 5);
96
97/** M_H values to test */
98const auto m_h_values = framework::dataset::make("M_H", 7);
99
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000100/** N values to test */
morgolockaba2f912020-05-05 16:28:19 +0100101const auto n_values = framework::dataset::make("N", 21);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000102
103/** K values to test */
morgolockaba2f912020-05-05 16:28:19 +0100104const auto k_values = framework::dataset::make("K", 13);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000105
106/** Batch size values to test */
morgolockaba2f912020-05-05 16:28:19 +0100107const auto b_values = framework::dataset::make("batch_size", 2, 3);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000108
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100109/** Activation values to test */
110const auto act_values = framework::dataset::make("Activation",
111{
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100112 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 8.f, 2.f),
Gian Marco Iodice635013a2022-11-03 09:30:56 +0000113 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::ELU),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100114});
115
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100116/** Alpha values to test - Precommit */
117const auto a_values_precommit = framework::dataset::make("alpha", {-0.75f} );
118
119/** Beta values to test - Precommit */
120const auto beta_values_precommit = framework::dataset::make("beta", {-0.35f} );
121
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000122/** M0 values to test - Precommit */
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100123const auto m0_values_precommit = framework::dataset::make("M0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000124
125/** N0 values to test - Precommit */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100126const auto n0_values_precommit = framework::dataset::make("N0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000127
128/** K0 values to test - Precommit */
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000129const auto k0_values_precommit = framework::dataset::make("K0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000130
131/** V0 values to test - Precommit */
132const auto v0_values_precommit = framework::dataset::make("V0", 1, 3);
133
134/** H0 values to test - Precommit */
135const auto h0_values_precommit = framework::dataset::make("H0", 1, 3);
136
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100137/** Alpha values to test - Nightly */
138const auto a_values_nightly = framework::dataset::make("alpha", {1.0f} );
139
140/** Beta values to test - Nightly */
141const auto beta_values_nightly = framework::dataset::make("beta", {1.0f} );
142
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000143/** M0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100144const auto m0_values_nightly = framework::dataset::make("M0", { 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000145
146/** N0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100147const auto n0_values_nightly = framework::dataset::make("N0", { 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000148
149/** K0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100150const auto k0_values_nightly = framework::dataset::make("K0", { 4 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000151
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100152/** N0 values to test with export to OpenCL image object - Nightly */
153const auto n0_export_to_cl_image_values_nightly = framework::dataset::make("N0", { 4, 8, 16 });
154
155/** K0 values to test with export to OpenCL image object - Nightly */
156const auto k0_export_to_cl_image_values_nightly = framework::dataset::make("K0", { 4, 8, 16 });
157
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000158/** V0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100159const auto v0_values_nightly = framework::dataset::make("V0", 1, 3);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000160
161/** H0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100162const auto h0_values_nightly = framework::dataset::make("H0", 1, 3);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000163
164/** Interleave values to test with LHS matrix */
165const auto i_values_lhs = framework::dataset::make("interleave_lhs", { true, false });
166
167/** Interleave values to test with RHS matrix */
168const auto i_values_rhs = framework::dataset::make("interleave_rhs", { true, false });
169
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100170/** Broadcast bias from vector to matrix */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100171const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } );
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100172
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100173/** LHS transposed values */
174const auto lhs_transpose_values = framework::dataset::make("lhs_transpose", { false, true } );
Gian Marco Iodice088d63a2020-08-11 14:14:06 +0100175
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000176} // namespace
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000177
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000178TEST_SUITE(CL)
179TEST_SUITE(GEMMMatrixMultiplyReshaped)
morgolockaba2f912020-05-05 16:28:19 +0100180
181// *INDENT-OFF*
182// clang-format off
183DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
184 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // OK
185 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK
186 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8), // Data type not supported
187 TensorInfo(TensorShape(10U, 5U, 2U), 1, DataType::F32), // Incorrect dimension bias
188 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // Mismatching shapes
189 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, do not broadcast bias
190 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, wider accummulation
191 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, RHS 4,4,2
192
193 }),
194 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32),
195 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
196 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8),
197 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32),
198 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
199 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
200 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
201 TensorInfo(TensorShape(128U, 3U, 2U), 1, DataType::F16),
202
203 })),
204 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(21U), 1, DataType::F32),
205 TensorInfo(TensorShape(21U), 1, DataType::F16),
206 TensorInfo(TensorShape(21U), 1, DataType::QASYMM8),
207 TensorInfo(TensorShape(21U), 1, DataType::F32),
208 TensorInfo(TensorShape(21U), 1, DataType::F32),
209 TensorInfo(TensorShape(21U,17U), 1, DataType::F16),
210 TensorInfo(TensorShape(21U,17U), 1, DataType::F16),
211 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
212
213 })),
214 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
215 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
216 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::QASYMM8),
217 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
218 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
219 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
220 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
221 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
222
223 })),
224 framework::dataset::make("LHSMInfo",{
225 GEMMLHSMatrixInfo(4,4,1,false,true),
226 GEMMLHSMatrixInfo(4,4,1,false,true),
227 GEMMLHSMatrixInfo(4,4,1,false,true),
228 GEMMLHSMatrixInfo(4,2,4,false,false),
229 GEMMLHSMatrixInfo(4,2,4,false,false),
230 GEMMLHSMatrixInfo(4,4,1,false,true),
231 GEMMLHSMatrixInfo(4,4,1,false,true),
232 GEMMLHSMatrixInfo(4,4,1,false,true),
233
234 })),
235 framework::dataset::make("RHSMInfo",{
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100236 GEMMRHSMatrixInfo(4,4,1,true,true,false),
237 GEMMRHSMatrixInfo(4,4,1,true,true,false),
238 GEMMRHSMatrixInfo(4,4,1,true,true,false),
239 GEMMRHSMatrixInfo(2,2,1,true,false,false),
240 GEMMRHSMatrixInfo(2,2,1,true,false,false),
241 GEMMRHSMatrixInfo(4,4,1,true,true,false),
242 GEMMRHSMatrixInfo(4,4,1,true,true,false),
243 GEMMRHSMatrixInfo(4,4,2,true,false,false),
morgolockaba2f912020-05-05 16:28:19 +0100244
245
246 })),
247
248
249 framework::dataset::make("GEMMInfo",{
250 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
251 21 /**<N Number of RHS columns*/,
252 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
253 false /**< reinterpret the input as 3D */,
254 true /**< Flag used to broadcast the bias addition */,
255 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100256 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100257 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
258 1 /**< Multiplication factor for the width of the 1xW transposed block */,
259 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
260 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100261 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100262 0 /**< Offset to be added to each element of the matrix A */,
263 0 /**< Offset to be added to each element of the matrix B */),
264
265 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
266 21 /**<N Number of RHS columns*/,
267 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
268 false /**< reinterpret the input as 3D */,
269 true /**< Flag used to broadcast the bias addition */,
270 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100271 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100272 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
273 1 /**< Multiplication factor for the width of the 1xW transposed block */,
274 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
275 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100276 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100277 0 /**< Offset to be added to each element of the matrix A */,
278 0 /**< Offset to be added to each element of the matrix B */),
279 GEMMKernelInfo(),
280 GEMMKernelInfo(),
281 GEMMKernelInfo(),
282
283 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
284 21 /**<N Number of RHS columns*/,
285 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
286 false /**< reinterpret the input as 3D */,
287 false /**< Flag used to broadcast the bias addition */,
288 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100289 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100290 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
291 1 /**< Multiplication factor for the width of the 1xW transposed block */,
292 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
293 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100294 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100295 0 /**< Offset to be added to each element of the matrix A */,
296 0 /**< Offset to be added to each element of the matrix B */),
297
298
299 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
300 21 /**<N Number of RHS columns*/,
301 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
302 false /**< reinterpret the input as 3D */,
303 false /**< Flag used to broadcast the bias addition */,
304 true /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100305 true /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100306 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
307 1 /**< Multiplication factor for the width of the 1xW transposed block */,
308 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
309 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100310 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100311 0 /**< Offset to be added to each element of the matrix A */,
312 0 /**< Offset to be added to each element of the matrix B */),
313
314 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
315 21 /**<N Number of RHS columns*/,
316 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
317 false /**< reinterpret the input as 3D */,
318 false /**< Flag used to broadcast the bias addition */,
319 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100320 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100321 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
322 1 /**< Multiplication factor for the width of the 1xW transposed block */,
323 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
324 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100325 GEMMRHSMatrixInfo(4,4,2,true,false,false),
morgolockaba2f912020-05-05 16:28:19 +0100326 0 /**< Offset to be added to each element of the matrix A */,
327 0 /**< Offset to be added to each element of the matrix B */),
328 })),
329 framework::dataset::make("Expected", { true, true, false, false, false, true, true,true})),
330 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
331{
SiCongLi1af54162021-10-06 15:25:57 +0100332 ARM_COMPUTE_EXPECT(bool(ClGemmMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
morgolockaba2f912020-05-05 16:28:19 +0100333 &input1_info.clone()->set_is_resizable(true),
334 &input2_info.clone()->set_is_resizable(true),
335 &output_info.clone()->set_is_resizable(true),1.f,1.f,
336 lhs_info,
337 rhs_info,
338 gemm_info)) == expected, framework::LogLevel::ERRORS);
339}
SiCongLieb8bd812021-10-29 15:05:49 +0100340
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000341TEST_SUITE(Float)
342TEST_SUITE(FP32)
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000343
344FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100345 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 +0000346 m_values,
347 n_values),
348 k_values),
349 b_values),
350 m0_values_precommit),
351 n0_values_precommit),
352 k0_values_precommit),
353 v0_values_precommit),
354 h0_values_precommit),
355 i_values_lhs),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000356 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100357 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000358 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100359 a_values_precommit),
360 beta_values_precommit),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100361 broadcast_bias_values),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100362 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100363 act_values))
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000364{
365 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000366 if(validate_result)
367 {
368 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
369 }
370 else
371 {
372 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
373 framework::ARM_COMPUTE_PRINT_INFO();
374 }
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000375}
376
Michalis Spyrou1d897772019-12-09 18:47:29 +0000377FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100378 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 +0000379 m_values,
380 n_values),
381 k_values),
382 b_values),
383 m0_values_nightly),
384 n0_values_nightly),
385 k0_values_nightly),
386 v0_values_nightly),
387 h0_values_nightly),
388 i_values_lhs),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000389 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100390 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000391 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100392 a_values_nightly),
393 beta_values_nightly),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100394 broadcast_bias_values),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100395 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100396 act_values))
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000397{
398 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000399 if(validate_result)
400 {
401 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
402 }
403 else
404 {
405 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
406 framework::ARM_COMPUTE_PRINT_INFO();
407 }
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000408}
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000409
410FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL,
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_precommit),
418 n0_values_precommit),
419 k0_values_precommit),
420 v0_values_precommit),
421 h0_values_precommit),
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_precommit),
427 beta_values_precommit),
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
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000432 if(validate_result)
433 {
434 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
435 }
436 else
437 {
438 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
439 framework::ARM_COMPUTE_PRINT_INFO();
440 }
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000441}
442
Michalis Spyrou1d897772019-12-09 18:47:29 +0000443FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100444 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 +0000445 m_w_values,
446 m_h_values),
447 n_values),
448 k_values),
449 b_values),
450 m0_values_nightly),
451 n0_values_nightly),
452 k0_values_nightly),
453 v0_values_nightly),
454 h0_values_nightly),
455 i_values_lhs),
456 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100457 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000458 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100459 a_values_nightly),
460 beta_values_nightly),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100461 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100462 act_values))
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000463{
464 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000465 if(validate_result)
466 {
467 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
468 }
469 else
470 {
471 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
472 framework::ARM_COMPUTE_PRINT_INFO();
473 }
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000474}
SiCongLi1af54162021-10-06 15:25:57 +0100475
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100476TEST_SUITE(ExportToCLImage)
477DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
478 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
479 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
480 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
481 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect k0
482 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect n0
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100483
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100484 }),
485 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
486 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
487 TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F32),
488 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
489 TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F32),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100490
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100491 })),
492 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F32),
493 TensorInfo(TensorShape(64U), 1, DataType::F32),
494 TensorInfo(TensorShape(64U), 1, DataType::F32),
495 TensorInfo(TensorShape(64U), 1, DataType::F32),
496 TensorInfo(TensorShape(64U), 1, DataType::F32),
497
498 })),
499 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
500 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
501 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
502 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
503 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
504 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
505
506 })),
507 framework::dataset::make("LHSMInfo",{
508 GEMMLHSMatrixInfo(4, 4, 1, false, true),
509 GEMMLHSMatrixInfo(4, 8, 1, false, true),
510 GEMMLHSMatrixInfo(4, 4, 1, false, true),
511 GEMMLHSMatrixInfo(4, 2, 1, false, false),
512 GEMMLHSMatrixInfo(4, 4, 1, false, false),
513
514 })),
515 framework::dataset::make("RHSMInfo",{
516 GEMMRHSMatrixInfo(4, 4, 1, true, true, true),
517 GEMMRHSMatrixInfo(4, 8, 1, true, true, true),
518 GEMMRHSMatrixInfo(8, 4, 1, true, true, true),
519 GEMMRHSMatrixInfo(4, 2, 1, true, false, true),
520 GEMMRHSMatrixInfo(2, 4, 1, true, false, true),
521 })),
522 framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
523 64 /**<N Number of RHS columns*/,
524 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
525 false /**< reinterpret the input as 3D */,
526 true /**< Flag used to broadcast the bias addition */,
527 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100528 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100529 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
530 1 /**< Multiplication factor for the width of the 1xW transposed block */,
531 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
532 GEMMLHSMatrixInfo(),
533 GEMMRHSMatrixInfo(),
534 0 /**< Offset to be added to each element of the matrix A */,
535 0 /**< Offset to be added to each element of the matrix B */),
536 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
537 64 /**<N Number of RHS columns*/,
538 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
539 false /**< reinterpret the input as 3D */,
540 true /**< Flag used to broadcast the bias addition */,
541 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100542 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100543 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
544 1 /**< Multiplication factor for the width of the 1xW transposed block */,
545 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
546 GEMMLHSMatrixInfo(),
547 GEMMRHSMatrixInfo(),
548 0 /**< Offset to be added to each element of the matrix A */,
549 0 /**< Offset to be added to each element of the matrix B */),
550 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
551 64 /**<N Number of RHS columns*/,
552 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
553 false /**< reinterpret the input as 3D */,
554 true /**< Flag used to broadcast the bias addition */,
555 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100556 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100557 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
558 1 /**< Multiplication factor for the width of the 1xW transposed block */,
559 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
560 GEMMLHSMatrixInfo(),
561 GEMMRHSMatrixInfo(),
562 0 /**< Offset to be added to each element of the matrix A */,
563 0 /**< Offset to be added to each element of the matrix B */),
564
565 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
566 64 /**<N Number of RHS columns*/,
567 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
568 false /**< reinterpret the input as 3D */,
569 true /**< Flag used to broadcast the bias addition */,
570 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100571 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100572 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
573 1 /**< Multiplication factor for the width of the 1xW transposed block */,
574 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
575 GEMMLHSMatrixInfo(),
576 GEMMRHSMatrixInfo(),
577 0 /**< Offset to be added to each element of the matrix A */,
578 0 /**< Offset to be added to each element of the matrix B */),
579 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
580 64 /**<N Number of RHS columns*/,
581 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
582 false /**< reinterpret the input as 3D */,
583 true /**< Flag used to broadcast the bias addition */,
584 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100585 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100586 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
587 1 /**< Multiplication factor for the width of the 1xW transposed block */,
588 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
589 GEMMLHSMatrixInfo(),
590 GEMMRHSMatrixInfo(),
591 0 /**< Offset to be added to each element of the matrix A */,
592 0 /**< Offset to be added to each element of the matrix B */)
593 })),
594 framework::dataset::make("Expected", { true,
595 true,
596 true,
597 false,
Gian Marco Iodice047e5d02022-08-25 15:14:23 +0100598 true})),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100599 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
600{
Georgios Pinitas856f66e2021-04-22 21:13:21 +0100601 ARM_COMPUTE_EXPECT(bool(ClGemmMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100602 &input1_info.clone()->set_is_resizable(true),
603 &input2_info.clone()->set_is_resizable(true),
604 &output_info.clone()->set_is_resizable(true),1.f,1.f,
605 lhs_info,
606 rhs_info,
607 gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS);
608}
609
610FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL,
611 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 +0100612 m_values,
613 n_values),
614 k_values),
615 b_values),
616 m0_values_precommit),
617 n0_values_precommit),
618 k0_values_precommit),
619 v0_values_precommit),
620 h0_values_precommit),
621 i_values_lhs),
622 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100623 framework::dataset::make("export_to_cl_image_rhs", true)),
624 framework::dataset::make("DataType", DataType::F32)),
625 a_values_precommit),
626 beta_values_precommit),
627 broadcast_bias_values),
628 lhs_transpose_values),
629 act_values))
630{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000631 // Validate output only if validate() is successful
632 if(validate_result)
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100633 {
634 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
635 }
636 else
637 {
638 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
639 framework::ARM_COMPUTE_PRINT_INFO();
640 }
641
642}
643
644FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::NIGHTLY,
645 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
646 m_values,
647 n_values),
648 k_values),
649 b_values),
650 m0_values_nightly),
651 n0_export_to_cl_image_values_nightly),
652 k0_export_to_cl_image_values_nightly),
653 v0_values_nightly),
654 h0_values_nightly),
655 i_values_lhs),
656 i_values_rhs),
657 framework::dataset::make("export_to_cl_image_rhs", true)),
658 framework::dataset::make("DataType", DataType::F32)),
659 a_values_nightly),
660 beta_values_nightly),
661 broadcast_bias_values),
662 lhs_transpose_values),
663 act_values))
664{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000665 // Validate output only if validate() is successful
666 if(validate_result)
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100667 {
668 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
669 }
670 else
671 {
672 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
673 framework::ARM_COMPUTE_PRINT_INFO();
674 }
675}
676
677FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL,
678 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
679 m_w_values,
680 m_h_values),
681 n_values),
682 k_values),
683 b_values),
684 m0_values_precommit),
685 n0_values_precommit),
686 k0_values_precommit),
687 v0_values_precommit),
688 h0_values_precommit),
689 i_values_lhs),
690 i_values_rhs),
691 framework::dataset::make("export_to_cl_image_rhs", true)),
692 framework::dataset::make("DataType", DataType::F32)),
693 a_values_precommit),
694 beta_values_precommit),
695 lhs_transpose_values),
696 act_values))
697{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000698 // Validate output only if validate() is successful
699 if(validate_result)
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100700 {
701 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
702 }
703 else
704 {
705 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
706 framework::ARM_COMPUTE_PRINT_INFO();
707 }
708}
709
710FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::NIGHTLY,
711 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
712 m_w_values,
713 m_h_values),
714 n_values),
715 k_values),
716 b_values),
717 m0_values_nightly),
718 n0_export_to_cl_image_values_nightly),
719 k0_export_to_cl_image_values_nightly),
720 v0_values_nightly),
721 h0_values_nightly),
722 i_values_lhs),
723 i_values_rhs),
724 framework::dataset::make("export_to_cl_image_rhs", true)),
725 framework::dataset::make("DataType", DataType::F32)),
726 a_values_nightly),
727 beta_values_nightly),
728 lhs_transpose_values),
729 act_values))
730{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000731 // Validate output only if validate() is successful
732 if(validate_result)
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100733 {
734 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
735 }
736 else
737 {
738 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
739 framework::ARM_COMPUTE_PRINT_INFO();
740 }
741}
SiCongLi1af54162021-10-06 15:25:57 +0100742
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100743TEST_SUITE_END() // ExportToCLImage
744TEST_SUITE_END() // FP32
745
746TEST_SUITE(FP16)
747
748FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL,
749 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
750 m_values,
751 n_values),
752 k_values),
753 b_values),
754 m0_values_precommit),
755 n0_values_precommit),
756 k0_values_precommit),
757 v0_values_precommit),
758 h0_values_precommit),
759 i_values_lhs),
760 i_values_rhs),
761 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100762 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100763 a_values_precommit),
764 beta_values_precommit),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100765 broadcast_bias_values),
766 lhs_transpose_values),
767 act_values))
768{
769 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000770 if(validate_result)
771 {
772 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
773 }
774 else
775 {
776 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
777 framework::ARM_COMPUTE_PRINT_INFO();
778 }
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100779}
780
Michalis Spyrou1d897772019-12-09 18:47:29 +0000781FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100782 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 +0100783 m_values,
784 n_values),
785 k_values),
786 b_values),
787 m0_values_nightly),
788 n0_values_nightly),
789 k0_values_nightly),
790 v0_values_nightly),
791 h0_values_nightly),
792 i_values_lhs),
793 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100794 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100795 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100796 a_values_nightly),
797 beta_values_nightly),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100798 broadcast_bias_values),
799 lhs_transpose_values),
800 act_values))
801{
802 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000803 if(validate_result)
804 {
805 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
806 }
807 else
808 {
809 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
810 framework::ARM_COMPUTE_PRINT_INFO();
811 }
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100812}
813
814FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100815 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 +0100816 m_w_values,
817 m_h_values),
818 n_values),
819 k_values),
820 b_values),
821 m0_values_precommit),
822 n0_values_precommit),
823 k0_values_precommit),
824 v0_values_precommit),
825 h0_values_precommit),
826 i_values_lhs),
827 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100828 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100829 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100830 a_values_precommit),
831 beta_values_precommit),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100832 lhs_transpose_values),
833 act_values))
834{
835 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000836 if(validate_result)
837 {
838 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
839 }
840 else
841 {
842 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
843 framework::ARM_COMPUTE_PRINT_INFO();
844 }
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100845}
846
Michalis Spyrou1d897772019-12-09 18:47:29 +0000847FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100848 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 +0100849 m_w_values,
850 m_h_values),
851 n_values),
852 k_values),
853 b_values),
854 m0_values_nightly),
855 n0_values_nightly),
856 k0_values_nightly),
857 v0_values_nightly),
858 h0_values_nightly),
859 i_values_lhs),
860 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100861 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100862 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100863 a_values_nightly),
864 beta_values_nightly),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100865 lhs_transpose_values),
866 act_values))
867{
868 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +0000869 if(validate_result)
870 {
871 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
872 }
873 else
874 {
875 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
876 framework::ARM_COMPUTE_PRINT_INFO();
877 }
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100878}
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100879
880TEST_SUITE(ExportToCLImage)
881DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
882 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
883 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
884 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
885 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // Incorrect k0
886 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // Incorrect n0
887
888 }),
889 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16),
890 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16),
891 TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F16),
892 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16),
893 TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F16),
894
895 })),
896 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F16),
897 TensorInfo(TensorShape(64U), 1, DataType::F16),
898 TensorInfo(TensorShape(64U), 1, DataType::F16),
899 TensorInfo(TensorShape(64U), 1, DataType::F16),
900 TensorInfo(TensorShape(64U), 1, DataType::F16),
901
902 })),
903 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
904 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
905 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
906 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
907 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
908 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
909
910 })),
911 framework::dataset::make("LHSMInfo",{
912 GEMMLHSMatrixInfo(4, 4, 1, false, true),
913 GEMMLHSMatrixInfo(4, 8, 1, false, true),
914 GEMMLHSMatrixInfo(4, 4, 1, false, true),
915 GEMMLHSMatrixInfo(4, 2, 1, false, false),
916 GEMMLHSMatrixInfo(4, 4, 1, false, false),
917
918 })),
919 framework::dataset::make("RHSMInfo",{
920 GEMMRHSMatrixInfo(4, 4, 1, true, true, true),
921 GEMMRHSMatrixInfo(4, 8, 1, true, true, true),
922 GEMMRHSMatrixInfo(8, 4, 1, true, true, true),
923 GEMMRHSMatrixInfo(4, 2, 1, true, false, true),
924 GEMMRHSMatrixInfo(2, 4, 1, true, false, true),
925 })),
926 framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
927 64 /**<N Number of RHS columns*/,
928 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
929 false /**< reinterpret the input as 3D */,
930 true /**< Flag used to broadcast the bias addition */,
931 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100932 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100933 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
934 1 /**< Multiplication factor for the width of the 1xW transposed block */,
935 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
936 GEMMLHSMatrixInfo(),
937 GEMMRHSMatrixInfo(),
938 0 /**< Offset to be added to each element of the matrix A */,
939 0 /**< Offset to be added to each element of the matrix B */),
940 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
941 64 /**<N Number of RHS columns*/,
942 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
943 false /**< reinterpret the input as 3D */,
944 true /**< Flag used to broadcast the bias addition */,
945 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100946 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100947 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
948 1 /**< Multiplication factor for the width of the 1xW transposed block */,
949 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
950 GEMMLHSMatrixInfo(),
951 GEMMRHSMatrixInfo(),
952 0 /**< Offset to be added to each element of the matrix A */,
953 0 /**< Offset to be added to each element of the matrix B */),
954 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
955 64 /**<N Number of RHS columns*/,
956 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
957 false /**< reinterpret the input as 3D */,
958 true /**< Flag used to broadcast the bias addition */,
959 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100960 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100961 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
962 1 /**< Multiplication factor for the width of the 1xW transposed block */,
963 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
964 GEMMLHSMatrixInfo(),
965 GEMMRHSMatrixInfo(),
966 0 /**< Offset to be added to each element of the matrix A */,
967 0 /**< Offset to be added to each element of the matrix B */),
968
969 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
970 64 /**<N Number of RHS columns*/,
971 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
972 false /**< reinterpret the input as 3D */,
973 true /**< Flag used to broadcast the bias addition */,
974 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100975 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100976 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
977 1 /**< Multiplication factor for the width of the 1xW transposed block */,
978 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
979 GEMMLHSMatrixInfo(),
980 GEMMRHSMatrixInfo(),
981 0 /**< Offset to be added to each element of the matrix A */,
982 0 /**< Offset to be added to each element of the matrix B */),
983 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
984 64 /**<N Number of RHS columns*/,
985 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
986 false /**< reinterpret the input as 3D */,
987 true /**< Flag used to broadcast the bias addition */,
988 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100989 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100990 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
991 1 /**< Multiplication factor for the width of the 1xW transposed block */,
992 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
993 GEMMLHSMatrixInfo(),
994 GEMMRHSMatrixInfo(),
995 0 /**< Offset to be added to each element of the matrix A */,
996 0 /**< Offset to be added to each element of the matrix B */)
997 })),
998 framework::dataset::make("Expected", { true,
999 true,
1000 true,
1001 false,
Gian Marco Iodice047e5d02022-08-25 15:14:23 +01001002 true})),
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001003 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
1004{
Georgios Pinitas856f66e2021-04-22 21:13:21 +01001005 ARM_COMPUTE_EXPECT(bool(ClGemmMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001006 &input1_info.clone()->set_is_resizable(true),
1007 &input2_info.clone()->set_is_resizable(true),
1008 &output_info.clone()->set_is_resizable(true),1.f,1.f,
1009 lhs_info,
1010 rhs_info,
1011 gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS);
1012}
1013
1014FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL,
1015 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1016 m_values,
1017 n_values),
1018 k_values),
1019 b_values),
1020 m0_values_precommit),
1021 n0_values_precommit),
1022 k0_values_precommit),
1023 v0_values_precommit),
1024 h0_values_precommit),
1025 i_values_lhs),
1026 i_values_rhs),
1027 framework::dataset::make("export_to_cl_image_rhs", true)),
1028 framework::dataset::make("DataType", DataType::F16)),
1029 a_values_precommit),
1030 beta_values_precommit),
1031 broadcast_bias_values),
1032 lhs_transpose_values),
1033 act_values))
1034{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +00001035 // Validate output only if validate() is successful
1036 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001037 {
1038 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1039 }
1040 else
1041 {
1042 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1043 framework::ARM_COMPUTE_PRINT_INFO();
1044 }
1045
1046}
1047
1048FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::NIGHTLY,
1049 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1050 m_values,
1051 n_values),
1052 k_values),
1053 b_values),
1054 m0_values_nightly),
1055 n0_export_to_cl_image_values_nightly),
1056 k0_export_to_cl_image_values_nightly),
1057 v0_values_nightly),
1058 h0_values_nightly),
1059 i_values_lhs),
1060 i_values_rhs),
1061 framework::dataset::make("export_to_cl_image_rhs", true)),
1062 framework::dataset::make("DataType", DataType::F16)),
1063 a_values_nightly),
1064 beta_values_nightly),
1065 broadcast_bias_values),
1066 lhs_transpose_values),
1067 act_values))
1068{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +00001069 // Validate output only if validate() is successful
1070 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001071 {
1072 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1073 }
1074 else
1075 {
1076 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1077 framework::ARM_COMPUTE_PRINT_INFO();
1078 }
1079}
1080
1081FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL,
1082 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1083 m_w_values,
1084 m_h_values),
1085 n_values),
1086 k_values),
1087 b_values),
1088 m0_values_precommit),
1089 n0_values_precommit),
1090 k0_values_precommit),
1091 v0_values_precommit),
1092 h0_values_precommit),
1093 i_values_lhs),
1094 i_values_rhs),
1095 framework::dataset::make("export_to_cl_image_rhs", true)),
1096 framework::dataset::make("DataType", DataType::F16)),
1097 a_values_precommit),
1098 beta_values_precommit),
1099 lhs_transpose_values),
1100 act_values))
1101{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +00001102 // Validate output only if validate() is successful
1103 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001104 {
1105 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1106 }
1107 else
1108 {
1109 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1110 framework::ARM_COMPUTE_PRINT_INFO();
1111 }
1112}
1113
1114FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::NIGHTLY,
1115 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1116 m_w_values,
1117 m_h_values),
1118 n_values),
1119 k_values),
1120 b_values),
1121 m0_values_nightly),
1122 n0_export_to_cl_image_values_nightly),
1123 k0_export_to_cl_image_values_nightly),
1124 v0_values_nightly),
1125 h0_values_nightly),
1126 i_values_lhs),
1127 i_values_rhs),
1128 framework::dataset::make("export_to_cl_image_rhs", true)),
1129 framework::dataset::make("DataType", DataType::F16)),
1130 a_values_nightly),
1131 beta_values_nightly),
1132 lhs_transpose_values),
1133 act_values))
1134{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +00001135 // Validate output only if validate() is successful
1136 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001137 {
1138 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1139 }
1140 else
1141 {
1142 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1143 framework::ARM_COMPUTE_PRINT_INFO();
1144 }
1145}
SiCongLi1af54162021-10-06 15:25:57 +01001146
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001147TEST_SUITE_END() // ExportToCLImage
Gian Marco Iodice05639f62019-09-24 12:05:06 +01001148TEST_SUITE_END() // FP16
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001149
1150TEST_SUITE(MixedPrecision)
1151
1152FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001153 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 +01001154 m_values,
1155 n_values),
1156 k_values),
1157 b_values),
1158 m0_values_precommit),
1159 n0_values_precommit),
1160 k0_values_precommit),
1161 v0_values_precommit),
1162 h0_values_precommit),
1163 i_values_lhs),
1164 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001165 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001166 framework::dataset::make("DataType", DataType::F16)),
1167 a_values_precommit),
1168 beta_values_precommit),
1169 broadcast_bias_values),
1170 lhs_transpose_values),
1171 act_values))
1172{
1173 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +00001174 if(validate_result)
1175 {
1176 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1177 }
1178 else
1179 {
1180 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1181 framework::ARM_COMPUTE_PRINT_INFO();
1182 }
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001183}
1184
Michalis Spyrou1d897772019-12-09 18:47:29 +00001185FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001186 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 +01001187 m_values,
1188 n_values),
1189 k_values),
1190 b_values),
1191 m0_values_nightly),
1192 n0_values_nightly),
1193 k0_values_nightly),
1194 v0_values_nightly),
1195 h0_values_nightly),
1196 i_values_lhs),
1197 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001198 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001199 framework::dataset::make("DataType", DataType::F16)),
1200 a_values_nightly),
1201 beta_values_nightly),
1202 broadcast_bias_values),
1203 lhs_transpose_values),
1204 act_values))
1205{
1206 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +00001207 if(validate_result)
1208 {
1209 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1210 }
1211 else
1212 {
1213 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1214 framework::ARM_COMPUTE_PRINT_INFO();
1215 }
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001216}
1217
1218FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001219 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 +01001220 m_w_values,
1221 m_h_values),
1222 n_values),
1223 k_values),
1224 b_values),
1225 m0_values_precommit),
1226 n0_values_precommit),
1227 k0_values_precommit),
1228 v0_values_precommit),
1229 h0_values_precommit),
1230 i_values_lhs),
1231 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001232 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001233 framework::dataset::make("DataType", DataType::F16)),
1234 a_values_precommit),
1235 beta_values_precommit),
1236 lhs_transpose_values),
1237 act_values))
1238{
1239 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +00001240 if(validate_result)
1241 {
1242 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1243 }
1244 else
1245 {
1246 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1247 framework::ARM_COMPUTE_PRINT_INFO();
1248 }
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001249}
1250
Michalis Spyrou1d897772019-12-09 18:47:29 +00001251FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001252 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 +01001253 m_w_values,
1254 m_h_values),
1255 n_values),
1256 k_values),
1257 b_values),
1258 m0_values_nightly),
1259 n0_values_nightly),
1260 k0_values_nightly),
1261 v0_values_nightly),
1262 h0_values_nightly),
1263 i_values_lhs),
1264 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001265 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001266 framework::dataset::make("DataType", DataType::F16)),
1267 a_values_nightly),
1268 beta_values_nightly),
1269 lhs_transpose_values),
1270 act_values))
1271{
1272 // Validate output
Giorgio Arenaa3b13b52021-11-08 17:52:26 +00001273 if(validate_result)
1274 {
1275 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1276 }
1277 else
1278 {
1279 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1280 framework::ARM_COMPUTE_PRINT_INFO();
1281 }
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001282}
SiCongLi1af54162021-10-06 15:25:57 +01001283
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001284TEST_SUITE_END() // MixedPrecision
Gian Marco Iodice9382ab32018-12-17 15:12:07 +00001285TEST_SUITE_END() // Float
Gian Marco Iodiced1f54762019-07-19 09:54:47 +01001286TEST_SUITE_END() // GEMMMatrixMultiplyReshaped
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +00001287TEST_SUITE_END() // CL
1288} // namespace validation
1289} // namespace test
Michele Di Giorgio2568c6b2019-09-17 12:08:46 +01001290} // namespace arm_compute