blob: 0a0a1fc397a5e9842888b4bf05f3d6de8e7223c8 [file] [log] [blame]
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +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 */
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"
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +010029#include "src/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.h"
30#include "src/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.h"
31#include "src/core/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;
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 */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100142const auto m0_values_nightly = framework::dataset::make("M0", { 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000143
144/** N0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100145const auto n0_values_nightly = framework::dataset::make("N0", { 8 });
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000146
147/** K0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100148const auto k0_values_nightly = framework::dataset::make("K0", { 4 });
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 */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100157const auto v0_values_nightly = framework::dataset::make("V0", 1, 3);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000158
159/** H0 values to test - Nightly */
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100160const auto h0_values_nightly = framework::dataset::make("H0", 1, 3);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000161
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 Iodice088d63a2020-08-11 14:14:06 +0100173
174/** Zero padding test */
175bool validate_zero_padding(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value,
176 unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, unsigned int h0_value,
177 bool i_value_rhs, bool t_value_rhs, bool export_to_cl_image, bool broadcast_bias, unsigned int depth_output_gemm3d, const ActivationLayerInfo &act_info,
178 DataType dt_input0, DataType dt_input1, DataType dt_input2, DataType dt_output, float alpha, float beta)
179{
180 const unsigned int M = m_value;
181 const unsigned int N = n_value;
182 const unsigned int K = k_value;
183
184 GEMMLHSMatrixInfo lhs_info;
185 lhs_info.m0 = m0_value;
186 lhs_info.k0 = k0_value;
187
188 GEMMRHSMatrixInfo rhs_info;
189 rhs_info.n0 = n0_value;
190 rhs_info.k0 = k0_value;
191 rhs_info.h0 = h0_value;
192 rhs_info.interleave = i_value_rhs;
193 rhs_info.transpose = t_value_rhs;
194 rhs_info.export_to_cl_image = export_to_cl_image;
195
196 GEMMKernelInfo kernel_info;
197 kernel_info.m = M;
198 kernel_info.n = N;
199 kernel_info.k = K;
200 kernel_info.depth_output_gemm3d = depth_output_gemm3d;
201 kernel_info.reinterpret_input_as_3d = false;
202 kernel_info.broadcast_bias = broadcast_bias;
203 kernel_info.activation_info = act_info;
204
205 const TensorShape lhs_shape(K, M, b_value);
206 const TensorShape rhs_shape(N, K, b_value);
207 const TensorShape lhs_shape_reshaped = compute_lhs_reshaped_shape(TensorInfo(lhs_shape, 1, dt_input0),
208 lhs_info);
209 const TensorShape rhs_shape_reshaped = compute_rhs_reshaped_shape(TensorInfo(rhs_shape, 1, dt_input1),
210 rhs_info);
211
212 const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape_reshaped, 1, dt_input0),
213 TensorInfo(rhs_shape_reshaped, 1, dt_input1),
214 kernel_info);
215
216 const TensorShape bias_shape(N,
217 M, // Correct calculation should be: broadcast_bias? 1 : M, it's wrong here on purpose just for validation test
218 broadcast_bias? 1 : b_value);
219
220 // Create tensors
221 CLTensor lhs_reshaped = create_tensor<CLTensor>(lhs_shape_reshaped, dt_input0);
222 CLTensor rhs_reshaped = create_tensor<CLTensor>(rhs_shape_reshaped, dt_input1);
223 CLTensor bias = create_tensor<CLTensor>(bias_shape, dt_input2);
224 CLTensor dst = create_tensor<CLTensor>(dst_shape, dt_output);
225
226 ARM_COMPUTE_EXPECT(lhs_reshaped.info()->is_resizable(), framework::LogLevel::ERRORS);
227 ARM_COMPUTE_EXPECT(rhs_reshaped.info()->is_resizable(), framework::LogLevel::ERRORS);
228 ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
229 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
230
231 // Validate zero-padding
232 CLGEMMMatrixMultiplyReshaped gemm;
233
234 gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
235
236 // Padding can be added along rhs and bias's X/Y dimension
237 return dst.info()->padding().empty() && lhs_reshaped.info()->padding().empty();
238}
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000239} // namespace
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000240
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000241TEST_SUITE(CL)
242TEST_SUITE(GEMMMatrixMultiplyReshaped)
morgolockaba2f912020-05-05 16:28:19 +0100243
Gian Marco Iodice088d63a2020-08-11 14:14:06 +0100244/** Validate zero padding tests
245 *
246 * A series of validation tests to check the zero padding requirement
247 *
248 * Checks performed in order:
249 * - No partial blocks in both x and y dimensions
250 * - Partial blocks in x dimension
251 * - Partial blocks in y dimension
252 * - Partial blocks in both x and y dimensions
253 * - Special case: partial_n0 == 9 (vstore1 should be invoked instead of vstore_partial_1)
254 */
255DATA_TEST_CASE(ValidateZeroPadding, framework::DatasetMode::ALL, zip(zip(zip(
256framework::dataset::make("M", { 24, 64, 101, 1, 103 }),
257framework::dataset::make("N", { 48, 29, 16, 121, 41 })),
258framework::dataset::make("M0", { 4, 8, 4, 2, 4 })),
259framework::dataset::make("N0", { 4, 4, 16, 2, 16 })),
260m_value, n_value, m0_value, n0_value)
261{
262 constexpr DataType dt = DataType::F32;
263
264 bool status = validate_zero_padding(m_value, n_value, 23, 1, m0_value, n0_value, 4, 1, false, false, false, 0, 0, ActivationLayerInfo(), dt, dt, dt, dt, 1.0f, 1.0f);
265 ARM_COMPUTE_EXPECT(status, framework::LogLevel::ERRORS);
266}
267
morgolockaba2f912020-05-05 16:28:19 +0100268// *INDENT-OFF*
269// clang-format off
270DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
271 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // OK
272 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK
273 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8), // Data type not supported
274 TensorInfo(TensorShape(10U, 5U, 2U), 1, DataType::F32), // Incorrect dimension bias
275 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // Mismatching shapes
276 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, do not broadcast bias
277 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, wider accummulation
278 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, RHS 4,4,2
279
280 }),
281 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32),
282 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
283 TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8),
284 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32),
285 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
286 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
287 TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16),
288 TensorInfo(TensorShape(128U, 3U, 2U), 1, DataType::F16),
289
290 })),
291 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(21U), 1, DataType::F32),
292 TensorInfo(TensorShape(21U), 1, DataType::F16),
293 TensorInfo(TensorShape(21U), 1, DataType::QASYMM8),
294 TensorInfo(TensorShape(21U), 1, DataType::F32),
295 TensorInfo(TensorShape(21U), 1, DataType::F32),
296 TensorInfo(TensorShape(21U,17U), 1, DataType::F16),
297 TensorInfo(TensorShape(21U,17U), 1, DataType::F16),
298 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
299
300 })),
301 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
302 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
303 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::QASYMM8),
304 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
305 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32),
306 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
307 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
308 TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16),
309
310 })),
311 framework::dataset::make("LHSMInfo",{
312 GEMMLHSMatrixInfo(4,4,1,false,true),
313 GEMMLHSMatrixInfo(4,4,1,false,true),
314 GEMMLHSMatrixInfo(4,4,1,false,true),
315 GEMMLHSMatrixInfo(4,2,4,false,false),
316 GEMMLHSMatrixInfo(4,2,4,false,false),
317 GEMMLHSMatrixInfo(4,4,1,false,true),
318 GEMMLHSMatrixInfo(4,4,1,false,true),
319 GEMMLHSMatrixInfo(4,4,1,false,true),
320
321 })),
322 framework::dataset::make("RHSMInfo",{
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100323 GEMMRHSMatrixInfo(4,4,1,true,true,false),
324 GEMMRHSMatrixInfo(4,4,1,true,true,false),
325 GEMMRHSMatrixInfo(4,4,1,true,true,false),
326 GEMMRHSMatrixInfo(2,2,1,true,false,false),
327 GEMMRHSMatrixInfo(2,2,1,true,false,false),
328 GEMMRHSMatrixInfo(4,4,1,true,true,false),
329 GEMMRHSMatrixInfo(4,4,1,true,true,false),
330 GEMMRHSMatrixInfo(4,4,2,true,false,false),
morgolockaba2f912020-05-05 16:28:19 +0100331
332
333 })),
334
335
336 framework::dataset::make("GEMMInfo",{
337 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
338 21 /**<N Number of RHS columns*/,
339 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
340 false /**< reinterpret the input as 3D */,
341 true /**< Flag used to broadcast the bias addition */,
342 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100343 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100344 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
345 1 /**< Multiplication factor for the width of the 1xW transposed block */,
346 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
347 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100348 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100349 0 /**< Offset to be added to each element of the matrix A */,
350 0 /**< Offset to be added to each element of the matrix B */),
351
352 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
353 21 /**<N Number of RHS columns*/,
354 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
355 false /**< reinterpret the input as 3D */,
356 true /**< Flag used to broadcast the bias addition */,
357 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100358 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100359 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
360 1 /**< Multiplication factor for the width of the 1xW transposed block */,
361 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
362 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100363 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100364 0 /**< Offset to be added to each element of the matrix A */,
365 0 /**< Offset to be added to each element of the matrix B */),
366 GEMMKernelInfo(),
367 GEMMKernelInfo(),
368 GEMMKernelInfo(),
369
370 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
371 21 /**<N Number of RHS columns*/,
372 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
373 false /**< reinterpret the input as 3D */,
374 false /**< Flag used to broadcast the bias addition */,
375 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100376 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100377 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
378 1 /**< Multiplication factor for the width of the 1xW transposed block */,
379 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
380 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100381 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100382 0 /**< Offset to be added to each element of the matrix A */,
383 0 /**< Offset to be added to each element of the matrix B */),
384
385
386 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
387 21 /**<N Number of RHS columns*/,
388 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
389 false /**< reinterpret the input as 3D */,
390 false /**< Flag used to broadcast the bias addition */,
391 true /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100392 true /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100393 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
394 1 /**< Multiplication factor for the width of the 1xW transposed block */,
395 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
396 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100397 GEMMRHSMatrixInfo(4,4,1,true,true,false),
morgolockaba2f912020-05-05 16:28:19 +0100398 0 /**< Offset to be added to each element of the matrix A */,
399 0 /**< Offset to be added to each element of the matrix B */),
400
401 GEMMKernelInfo( 17 /**<M Number of LHS rows*/,
402 21 /**<N Number of RHS columns*/,
403 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
404 false /**< reinterpret the input as 3D */,
405 false /**< Flag used to broadcast the bias addition */,
406 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100407 false /**< has pad y */,
morgolockaba2f912020-05-05 16:28:19 +0100408 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
409 1 /**< Multiplication factor for the width of the 1xW transposed block */,
410 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
411 GEMMLHSMatrixInfo(4,4,1,false,true),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100412 GEMMRHSMatrixInfo(4,4,2,true,false,false),
morgolockaba2f912020-05-05 16:28:19 +0100413 0 /**< Offset to be added to each element of the matrix A */,
414 0 /**< Offset to be added to each element of the matrix B */),
415 })),
416 framework::dataset::make("Expected", { true, true, false, false, false, true, true,true})),
417 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
418{
419 ARM_COMPUTE_EXPECT(bool(CLGEMMMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
420 &input1_info.clone()->set_is_resizable(true),
421 &input2_info.clone()->set_is_resizable(true),
422 &output_info.clone()->set_is_resizable(true),1.f,1.f,
423 lhs_info,
424 rhs_info,
425 gemm_info)) == expected, framework::LogLevel::ERRORS);
426}
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000427TEST_SUITE(Float)
428TEST_SUITE(FP32)
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000429
430FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100431 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 +0000432 m_values,
433 n_values),
434 k_values),
435 b_values),
436 m0_values_precommit),
437 n0_values_precommit),
438 k0_values_precommit),
439 v0_values_precommit),
440 h0_values_precommit),
441 i_values_lhs),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000442 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100443 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000444 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100445 a_values_precommit),
446 beta_values_precommit),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100447 broadcast_bias_values),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100448 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100449 act_values))
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000450{
451 // Validate output
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000452 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000453}
454
Michalis Spyrou1d897772019-12-09 18:47:29 +0000455FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100456 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 +0000457 m_values,
458 n_values),
459 k_values),
460 b_values),
461 m0_values_nightly),
462 n0_values_nightly),
463 k0_values_nightly),
464 v0_values_nightly),
465 h0_values_nightly),
466 i_values_lhs),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000467 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100468 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000469 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100470 a_values_nightly),
471 beta_values_nightly),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100472 broadcast_bias_values),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100473 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100474 act_values))
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000475{
476 // Validate output
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000477 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000478}
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000479
480FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100481 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 +0000482 m_w_values,
483 m_h_values),
484 n_values),
485 k_values),
486 b_values),
487 m0_values_precommit),
488 n0_values_precommit),
489 k0_values_precommit),
490 v0_values_precommit),
491 h0_values_precommit),
492 i_values_lhs),
493 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100494 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000495 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100496 a_values_precommit),
497 beta_values_precommit),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100498 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100499 act_values))
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000500{
501 // Validate output
502 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
503}
504
Michalis Spyrou1d897772019-12-09 18:47:29 +0000505FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100506 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 +0000507 m_w_values,
508 m_h_values),
509 n_values),
510 k_values),
511 b_values),
512 m0_values_nightly),
513 n0_values_nightly),
514 k0_values_nightly),
515 v0_values_nightly),
516 h0_values_nightly),
517 i_values_lhs),
518 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100519 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000520 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100521 a_values_nightly),
522 beta_values_nightly),
Giorgio Arenaae99b6e2019-08-01 14:22:12 +0100523 lhs_transpose_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100524 act_values))
Gian Marco Iodice9382ab32018-12-17 15:12:07 +0000525{
526 // Validate output
527 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
528}
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100529TEST_SUITE(ExportToCLImage)
530DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
531 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
532 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
533 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported
534 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect k0
535 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect n0
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100536
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100537 }),
538 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
539 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
540 TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F32),
541 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32),
542 TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F32),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100543
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100544 })),
545 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F32),
546 TensorInfo(TensorShape(64U), 1, DataType::F32),
547 TensorInfo(TensorShape(64U), 1, DataType::F32),
548 TensorInfo(TensorShape(64U), 1, DataType::F32),
549 TensorInfo(TensorShape(64U), 1, DataType::F32),
550
551 })),
552 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
553 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
554 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
555 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
556 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
557 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32),
558
559 })),
560 framework::dataset::make("LHSMInfo",{
561 GEMMLHSMatrixInfo(4, 4, 1, false, true),
562 GEMMLHSMatrixInfo(4, 8, 1, false, true),
563 GEMMLHSMatrixInfo(4, 4, 1, false, true),
564 GEMMLHSMatrixInfo(4, 2, 1, false, false),
565 GEMMLHSMatrixInfo(4, 4, 1, false, false),
566
567 })),
568 framework::dataset::make("RHSMInfo",{
569 GEMMRHSMatrixInfo(4, 4, 1, true, true, true),
570 GEMMRHSMatrixInfo(4, 8, 1, true, true, true),
571 GEMMRHSMatrixInfo(8, 4, 1, true, true, true),
572 GEMMRHSMatrixInfo(4, 2, 1, true, false, true),
573 GEMMRHSMatrixInfo(2, 4, 1, true, false, true),
574 })),
575 framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
576 64 /**<N Number of RHS columns*/,
577 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
578 false /**< reinterpret the input as 3D */,
579 true /**< Flag used to broadcast the bias addition */,
580 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100581 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100582 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
583 1 /**< Multiplication factor for the width of the 1xW transposed block */,
584 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
585 GEMMLHSMatrixInfo(),
586 GEMMRHSMatrixInfo(),
587 0 /**< Offset to be added to each element of the matrix A */,
588 0 /**< Offset to be added to each element of the matrix B */),
589 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
590 64 /**<N Number of RHS columns*/,
591 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
592 false /**< reinterpret the input as 3D */,
593 true /**< Flag used to broadcast the bias addition */,
594 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100595 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100596 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
597 1 /**< Multiplication factor for the width of the 1xW transposed block */,
598 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
599 GEMMLHSMatrixInfo(),
600 GEMMRHSMatrixInfo(),
601 0 /**< Offset to be added to each element of the matrix A */,
602 0 /**< Offset to be added to each element of the matrix B */),
603 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
604 64 /**<N Number of RHS columns*/,
605 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
606 false /**< reinterpret the input as 3D */,
607 true /**< Flag used to broadcast the bias addition */,
608 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100609 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100610 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
611 1 /**< Multiplication factor for the width of the 1xW transposed block */,
612 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
613 GEMMLHSMatrixInfo(),
614 GEMMRHSMatrixInfo(),
615 0 /**< Offset to be added to each element of the matrix A */,
616 0 /**< Offset to be added to each element of the matrix B */),
617
618 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
619 64 /**<N Number of RHS columns*/,
620 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
621 false /**< reinterpret the input as 3D */,
622 true /**< Flag used to broadcast the bias addition */,
623 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100624 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100625 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
626 1 /**< Multiplication factor for the width of the 1xW transposed block */,
627 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
628 GEMMLHSMatrixInfo(),
629 GEMMRHSMatrixInfo(),
630 0 /**< Offset to be added to each element of the matrix A */,
631 0 /**< Offset to be added to each element of the matrix B */),
632 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
633 64 /**<N Number of RHS columns*/,
634 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
635 false /**< reinterpret the input as 3D */,
636 true /**< Flag used to broadcast the bias addition */,
637 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100638 false /**< has pad y */,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100639 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
640 1 /**< Multiplication factor for the width of the 1xW transposed block */,
641 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
642 GEMMLHSMatrixInfo(),
643 GEMMRHSMatrixInfo(),
644 0 /**< Offset to be added to each element of the matrix A */,
645 0 /**< Offset to be added to each element of the matrix B */)
646 })),
647 framework::dataset::make("Expected", { true,
648 true,
649 true,
650 false,
651 false})),
652 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
653{
654 ARM_COMPUTE_EXPECT(bool(CLGEMMMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
655 &input1_info.clone()->set_is_resizable(true),
656 &input2_info.clone()->set_is_resizable(true),
657 &output_info.clone()->set_is_resizable(true),1.f,1.f,
658 lhs_info,
659 rhs_info,
660 gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS);
661}
662
663FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL,
664 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 +0100665 m_values,
666 n_values),
667 k_values),
668 b_values),
669 m0_values_precommit),
670 n0_values_precommit),
671 k0_values_precommit),
672 v0_values_precommit),
673 h0_values_precommit),
674 i_values_lhs),
675 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100676 framework::dataset::make("export_to_cl_image_rhs", true)),
677 framework::dataset::make("DataType", DataType::F32)),
678 a_values_precommit),
679 beta_values_precommit),
680 broadcast_bias_values),
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
695}
696
697FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::NIGHTLY,
698 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
699 m_values,
700 n_values),
701 k_values),
702 b_values),
703 m0_values_nightly),
704 n0_export_to_cl_image_values_nightly),
705 k0_export_to_cl_image_values_nightly),
706 v0_values_nightly),
707 h0_values_nightly),
708 i_values_lhs),
709 i_values_rhs),
710 framework::dataset::make("export_to_cl_image_rhs", true)),
711 framework::dataset::make("DataType", DataType::F32)),
712 a_values_nightly),
713 beta_values_nightly),
714 broadcast_bias_values),
715 lhs_transpose_values),
716 act_values))
717{
718 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
719 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
720 {
721 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
722 }
723 else
724 {
725 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
726 framework::ARM_COMPUTE_PRINT_INFO();
727 }
728}
729
730FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL,
731 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
732 m_w_values,
733 m_h_values),
734 n_values),
735 k_values),
736 b_values),
737 m0_values_precommit),
738 n0_values_precommit),
739 k0_values_precommit),
740 v0_values_precommit),
741 h0_values_precommit),
742 i_values_lhs),
743 i_values_rhs),
744 framework::dataset::make("export_to_cl_image_rhs", true)),
745 framework::dataset::make("DataType", DataType::F32)),
746 a_values_precommit),
747 beta_values_precommit),
748 lhs_transpose_values),
749 act_values))
750{
751 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
752 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
753 {
754 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
755 }
756 else
757 {
758 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
759 framework::ARM_COMPUTE_PRINT_INFO();
760 }
761}
762
763FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::NIGHTLY,
764 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
765 m_w_values,
766 m_h_values),
767 n_values),
768 k_values),
769 b_values),
770 m0_values_nightly),
771 n0_export_to_cl_image_values_nightly),
772 k0_export_to_cl_image_values_nightly),
773 v0_values_nightly),
774 h0_values_nightly),
775 i_values_lhs),
776 i_values_rhs),
777 framework::dataset::make("export_to_cl_image_rhs", true)),
778 framework::dataset::make("DataType", DataType::F32)),
779 a_values_nightly),
780 beta_values_nightly),
781 lhs_transpose_values),
782 act_values))
783{
784 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
785 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
786 {
787 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
788 }
789 else
790 {
791 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
792 framework::ARM_COMPUTE_PRINT_INFO();
793 }
794}
795TEST_SUITE_END() // ExportToCLImage
796TEST_SUITE_END() // FP32
797
798TEST_SUITE(FP16)
799
800FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL,
801 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
802 m_values,
803 n_values),
804 k_values),
805 b_values),
806 m0_values_precommit),
807 n0_values_precommit),
808 k0_values_precommit),
809 v0_values_precommit),
810 h0_values_precommit),
811 i_values_lhs),
812 i_values_rhs),
813 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100814 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100815 a_values_precommit),
816 beta_values_precommit),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100817 broadcast_bias_values),
818 lhs_transpose_values),
819 act_values))
820{
821 // Validate output
822 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
823}
824
Michalis Spyrou1d897772019-12-09 18:47:29 +0000825FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100826 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 +0100827 m_values,
828 n_values),
829 k_values),
830 b_values),
831 m0_values_nightly),
832 n0_values_nightly),
833 k0_values_nightly),
834 v0_values_nightly),
835 h0_values_nightly),
836 i_values_lhs),
837 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100838 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100839 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100840 a_values_nightly),
841 beta_values_nightly),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100842 broadcast_bias_values),
843 lhs_transpose_values),
844 act_values))
845{
846 // Validate output
847 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
848}
849
850FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100851 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 +0100852 m_w_values,
853 m_h_values),
854 n_values),
855 k_values),
856 b_values),
857 m0_values_precommit),
858 n0_values_precommit),
859 k0_values_precommit),
860 v0_values_precommit),
861 h0_values_precommit),
862 i_values_lhs),
863 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100864 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100865 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100866 a_values_precommit),
867 beta_values_precommit),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100868 lhs_transpose_values),
869 act_values))
870{
871 // Validate output
872 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
873}
874
Michalis Spyrou1d897772019-12-09 18:47:29 +0000875FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100876 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 +0100877 m_w_values,
878 m_h_values),
879 n_values),
880 k_values),
881 b_values),
882 m0_values_nightly),
883 n0_values_nightly),
884 k0_values_nightly),
885 v0_values_nightly),
886 h0_values_nightly),
887 i_values_lhs),
888 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +0100889 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100890 framework::dataset::make("DataType", DataType::F16)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +0100891 a_values_nightly),
892 beta_values_nightly),
Gian Marco Iodice05639f62019-09-24 12:05:06 +0100893 lhs_transpose_values),
894 act_values))
895{
896 // Validate output
897 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
898}
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100899
900TEST_SUITE(ExportToCLImage)
901DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
902 framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
903 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
904 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported
905 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // Incorrect k0
906 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // Incorrect n0
907
908 }),
909 framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16),
910 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16),
911 TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F16),
912 TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16),
913 TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F16),
914
915 })),
916 framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F16),
917 TensorInfo(TensorShape(64U), 1, DataType::F16),
918 TensorInfo(TensorShape(64U), 1, DataType::F16),
919 TensorInfo(TensorShape(64U), 1, DataType::F16),
920 TensorInfo(TensorShape(64U), 1, DataType::F16),
921
922 })),
923 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
924 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
925 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
926 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
927 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
928 TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16),
929
930 })),
931 framework::dataset::make("LHSMInfo",{
932 GEMMLHSMatrixInfo(4, 4, 1, false, true),
933 GEMMLHSMatrixInfo(4, 8, 1, false, true),
934 GEMMLHSMatrixInfo(4, 4, 1, false, true),
935 GEMMLHSMatrixInfo(4, 2, 1, false, false),
936 GEMMLHSMatrixInfo(4, 4, 1, false, false),
937
938 })),
939 framework::dataset::make("RHSMInfo",{
940 GEMMRHSMatrixInfo(4, 4, 1, true, true, true),
941 GEMMRHSMatrixInfo(4, 8, 1, true, true, true),
942 GEMMRHSMatrixInfo(8, 4, 1, true, true, true),
943 GEMMRHSMatrixInfo(4, 2, 1, true, false, true),
944 GEMMRHSMatrixInfo(2, 4, 1, true, false, true),
945 })),
946 framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
947 64 /**<N Number of RHS columns*/,
948 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
949 false /**< reinterpret the input as 3D */,
950 true /**< Flag used to broadcast the bias addition */,
951 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100952 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100953 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
954 1 /**< Multiplication factor for the width of the 1xW transposed block */,
955 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
956 GEMMLHSMatrixInfo(),
957 GEMMRHSMatrixInfo(),
958 0 /**< Offset to be added to each element of the matrix A */,
959 0 /**< Offset to be added to each element of the matrix B */),
960 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
961 64 /**<N Number of RHS columns*/,
962 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
963 false /**< reinterpret the input as 3D */,
964 true /**< Flag used to broadcast the bias addition */,
965 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100966 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100967 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
968 1 /**< Multiplication factor for the width of the 1xW transposed block */,
969 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
970 GEMMLHSMatrixInfo(),
971 GEMMRHSMatrixInfo(),
972 0 /**< Offset to be added to each element of the matrix A */,
973 0 /**< Offset to be added to each element of the matrix B */),
974 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
975 64 /**<N Number of RHS columns*/,
976 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
977 false /**< reinterpret the input as 3D */,
978 true /**< Flag used to broadcast the bias addition */,
979 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100980 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100981 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
982 1 /**< Multiplication factor for the width of the 1xW transposed block */,
983 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
984 GEMMLHSMatrixInfo(),
985 GEMMRHSMatrixInfo(),
986 0 /**< Offset to be added to each element of the matrix A */,
987 0 /**< Offset to be added to each element of the matrix B */),
988
989 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
990 64 /**<N Number of RHS columns*/,
991 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
992 false /**< reinterpret the input as 3D */,
993 true /**< Flag used to broadcast the bias addition */,
994 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100995 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100996 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
997 1 /**< Multiplication factor for the width of the 1xW transposed block */,
998 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
999 GEMMLHSMatrixInfo(),
1000 GEMMRHSMatrixInfo(),
1001 0 /**< Offset to be added to each element of the matrix A */,
1002 0 /**< Offset to be added to each element of the matrix B */),
1003 GEMMKernelInfo( 64 /**<M Number of LHS rows*/,
1004 64 /**<N Number of RHS columns*/,
1005 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
1006 false /**< reinterpret the input as 3D */,
1007 true /**< Flag used to broadcast the bias addition */,
1008 false /**< wider accumm */,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +01001009 false /**< has pad y */,
Gian Marco Iodice6f931342020-09-15 14:17:41 +01001010 ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
1011 1 /**< Multiplication factor for the width of the 1xW transposed block */,
1012 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
1013 GEMMLHSMatrixInfo(),
1014 GEMMRHSMatrixInfo(),
1015 0 /**< Offset to be added to each element of the matrix A */,
1016 0 /**< Offset to be added to each element of the matrix B */)
1017 })),
1018 framework::dataset::make("Expected", { true,
1019 true,
1020 true,
1021 false,
1022 false})),
1023 input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected)
1024{
1025 ARM_COMPUTE_EXPECT(bool(CLGEMMMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true),
1026 &input1_info.clone()->set_is_resizable(true),
1027 &input2_info.clone()->set_is_resizable(true),
1028 &output_info.clone()->set_is_resizable(true),1.f,1.f,
1029 lhs_info,
1030 rhs_info,
1031 gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS);
1032}
1033
1034FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL,
1035 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1036 m_values,
1037 n_values),
1038 k_values),
1039 b_values),
1040 m0_values_precommit),
1041 n0_values_precommit),
1042 k0_values_precommit),
1043 v0_values_precommit),
1044 h0_values_precommit),
1045 i_values_lhs),
1046 i_values_rhs),
1047 framework::dataset::make("export_to_cl_image_rhs", true)),
1048 framework::dataset::make("DataType", DataType::F16)),
1049 a_values_precommit),
1050 beta_values_precommit),
1051 broadcast_bias_values),
1052 lhs_transpose_values),
1053 act_values))
1054{
1055 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
1056 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
1057 {
1058 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1059 }
1060 else
1061 {
1062 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1063 framework::ARM_COMPUTE_PRINT_INFO();
1064 }
1065
1066}
1067
1068FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::NIGHTLY,
1069 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1070 m_values,
1071 n_values),
1072 k_values),
1073 b_values),
1074 m0_values_nightly),
1075 n0_export_to_cl_image_values_nightly),
1076 k0_export_to_cl_image_values_nightly),
1077 v0_values_nightly),
1078 h0_values_nightly),
1079 i_values_lhs),
1080 i_values_rhs),
1081 framework::dataset::make("export_to_cl_image_rhs", true)),
1082 framework::dataset::make("DataType", DataType::F16)),
1083 a_values_nightly),
1084 beta_values_nightly),
1085 broadcast_bias_values),
1086 lhs_transpose_values),
1087 act_values))
1088{
1089 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
1090 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
1091 {
1092 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1093 }
1094 else
1095 {
1096 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1097 framework::ARM_COMPUTE_PRINT_INFO();
1098 }
1099}
1100
1101FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL,
1102 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1103 m_w_values,
1104 m_h_values),
1105 n_values),
1106 k_values),
1107 b_values),
1108 m0_values_precommit),
1109 n0_values_precommit),
1110 k0_values_precommit),
1111 v0_values_precommit),
1112 h0_values_precommit),
1113 i_values_lhs),
1114 i_values_rhs),
1115 framework::dataset::make("export_to_cl_image_rhs", true)),
1116 framework::dataset::make("DataType", DataType::F16)),
1117 a_values_precommit),
1118 beta_values_precommit),
1119 lhs_transpose_values),
1120 act_values))
1121{
1122 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
1123 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
1124 {
1125 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1126 }
1127 else
1128 {
1129 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1130 framework::ARM_COMPUTE_PRINT_INFO();
1131 }
1132}
1133
1134FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::NIGHTLY,
1135 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
1136 m_w_values,
1137 m_h_values),
1138 n_values),
1139 k_values),
1140 b_values),
1141 m0_values_nightly),
1142 n0_export_to_cl_image_values_nightly),
1143 k0_export_to_cl_image_values_nightly),
1144 v0_values_nightly),
1145 h0_values_nightly),
1146 i_values_lhs),
1147 i_values_rhs),
1148 framework::dataset::make("export_to_cl_image_rhs", true)),
1149 framework::dataset::make("DataType", DataType::F16)),
1150 a_values_nightly),
1151 beta_values_nightly),
1152 lhs_transpose_values),
1153 act_values))
1154{
1155 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
1156 if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
1157 {
1158 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
1159 }
1160 else
1161 {
1162 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
1163 framework::ARM_COMPUTE_PRINT_INFO();
1164 }
1165}
1166TEST_SUITE_END() // ExportToCLImage
Gian Marco Iodice05639f62019-09-24 12:05:06 +01001167TEST_SUITE_END() // FP16
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001168
1169TEST_SUITE(MixedPrecision)
1170
1171FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001172 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 +01001173 m_values,
1174 n_values),
1175 k_values),
1176 b_values),
1177 m0_values_precommit),
1178 n0_values_precommit),
1179 k0_values_precommit),
1180 v0_values_precommit),
1181 h0_values_precommit),
1182 i_values_lhs),
1183 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001184 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001185 framework::dataset::make("DataType", DataType::F16)),
1186 a_values_precommit),
1187 beta_values_precommit),
1188 broadcast_bias_values),
1189 lhs_transpose_values),
1190 act_values))
1191{
1192 // Validate output
1193 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1194}
1195
Michalis Spyrou1d897772019-12-09 18:47:29 +00001196FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001197 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 +01001198 m_values,
1199 n_values),
1200 k_values),
1201 b_values),
1202 m0_values_nightly),
1203 n0_values_nightly),
1204 k0_values_nightly),
1205 v0_values_nightly),
1206 h0_values_nightly),
1207 i_values_lhs),
1208 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001209 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001210 framework::dataset::make("DataType", DataType::F16)),
1211 a_values_nightly),
1212 beta_values_nightly),
1213 broadcast_bias_values),
1214 lhs_transpose_values),
1215 act_values))
1216{
1217 // Validate output
1218 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1219}
1220
1221FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::ALL,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001222 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 +01001223 m_w_values,
1224 m_h_values),
1225 n_values),
1226 k_values),
1227 b_values),
1228 m0_values_precommit),
1229 n0_values_precommit),
1230 k0_values_precommit),
1231 v0_values_precommit),
1232 h0_values_precommit),
1233 i_values_lhs),
1234 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001235 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001236 framework::dataset::make("DataType", DataType::F16)),
1237 a_values_precommit),
1238 beta_values_precommit),
1239 lhs_transpose_values),
1240 act_values))
1241{
1242 // Validate output
1243 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1244}
1245
Michalis Spyrou1d897772019-12-09 18:47:29 +00001246FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED,
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001247 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 +01001248 m_w_values,
1249 m_h_values),
1250 n_values),
1251 k_values),
1252 b_values),
1253 m0_values_nightly),
1254 n0_values_nightly),
1255 k0_values_nightly),
1256 v0_values_nightly),
1257 h0_values_nightly),
1258 i_values_lhs),
1259 i_values_rhs),
Gian Marco Iodicee3a849a2020-06-10 17:59:30 +01001260 framework::dataset::make("export_to_cl_image_rhs", false)),
Gian Marco Iodice0c17aa22019-09-27 09:23:15 +01001261 framework::dataset::make("DataType", DataType::F16)),
1262 a_values_nightly),
1263 beta_values_nightly),
1264 lhs_transpose_values),
1265 act_values))
1266{
1267 // Validate output
1268 validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision);
1269}
1270TEST_SUITE_END() // MixedPrecision
Gian Marco Iodice9382ab32018-12-17 15:12:07 +00001271TEST_SUITE_END() // Float
Gian Marco Iodiced1f54762019-07-19 09:54:47 +01001272TEST_SUITE_END() // GEMMMatrixMultiplyReshaped
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +00001273TEST_SUITE_END() // CL
1274} // namespace validation
1275} // namespace test
Michele Di Giorgio2568c6b2019-09-17 12:08:46 +01001276} // namespace arm_compute