blob: e3f151a2ca6af81bc6e03c5feb1cbde3067bdeab [file] [log] [blame]
giuros01b3204e72019-04-01 13:50:22 +01001/*
Georgios Pinitas856f66e2021-04-22 21:13:21 +01002 * Copyright (c) 2019-2021 Arm Limited.
giuros01b3204e72019-04-01 13:50:22 +01003 *
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"
giuros01b3204e72019-04-01 13:50:22 +010025#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/ClGemmMatrixMultiplyNativeKernel.h"
giuros01b3204e72019-04-01 13:50:22 +010030#include "tests/CL/CLAccessor.h"
31#include "tests/CL/Helper.h"
32#include "tests/PaddingCalculator.h"
33#include "tests/datasets/ShapeDatasets.h"
34#include "tests/framework/Asserts.h"
35#include "tests/framework/Macros.h"
36#include "tests/framework/datasets/Datasets.h"
37#include "tests/validation/Validation.h"
38#include "tests/validation/fixtures/GEMMFixture.h"
39
40namespace arm_compute
41{
42namespace test
43{
44namespace validation
45{
46using namespace arm_compute::misc::shape_calculator;
Georgios Pinitas856f66e2021-04-22 21:13:21 +010047using namespace arm_compute::opencl::kernels;
giuros01b3204e72019-04-01 13:50:22 +010048
Georgios Pinitas856f66e2021-04-22 21:13:21 +010049// Create function for ClGemmMatrixMultiplyNativeKernel
50using CLGEMMMatrixMultiplyNative = CLSynthetizeOperator<ClGemmMatrixMultiplyNativeKernel>;
giuros01b3204e72019-04-01 13:50:22 +010051
52// Fixture for CLGEMMMatrixMultiplyNative
53template <typename T>
54using CLGEMMMatrixMultiplyNativeFixture = GEMMMatrixMultiplyNativeValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>;
55
SiCongLiafa19722021-10-24 19:12:33 +010056// Fixture for CLGEMMMatrixMultiplyNative with post ops
57template <typename T>
58using CLGEMMMatrixMultiplyNativeWithPostOpsFixture =
59 GEMMMatrixMultiplyNativeWithPostOpsValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>;
60
giuros01b3204e72019-04-01 13:50:22 +010061// Fixture for CLGEMMMatrixMultiplyNative3D
62template <typename T>
63using CLGEMMMatrixMultiplyNative3DFixture = GEMMMatrixMultiplyNative3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>;
64
65namespace
66{
67// *INDENT-OFF*
68// clang-format off
69RelativeTolerance<float> rel_tolerance_f32(0.001f);
70constexpr float abs_tolerance_f32(0.0001f);
71
giuros01b3204e72019-04-01 13:50:22 +010072/** Alpha values to test - Precommit */
73const auto a_values = framework::dataset::make("alpha", {1.0f, -0.75f} );
74
Gian Marco Iodice944170e2019-06-24 14:40:30 +010075/** Beta values to test - Precommit */
76const auto beta_values = framework::dataset::make("beta", {-0.75f, 0.0f} );
77
giuros01b3204e72019-04-01 13:50:22 +010078/** M values to test */
79const auto m_values = framework::dataset::make("M", 37);
80
81/** M_W values to test */
82const auto m_w_values = framework::dataset::make("M_W", 5);
83
84/** M_H values to test */
85const auto m_h_values = framework::dataset::make("M_H", 7);
86
87/** N values to test */
88const auto n_values = framework::dataset::make("N", 51);
89
90/** K values to test */
91const auto k_values = framework::dataset::make("K", 23);
92
93/** Batch size values to test */
94const auto b_values = framework::dataset::make("batch_size", 1, 3);
95
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +010096/** Activation values to test */
97const auto act_values = framework::dataset::make("Activation",
98{
99 ActivationLayerInfo(),
100 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 8.f, 2.f),
101});
102
giuros01b3204e72019-04-01 13:50:22 +0100103/** M0 values to test - Precommit */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100104const auto m0_values_precommit = framework::dataset::make("M0", { 4, 6 });
giuros01b3204e72019-04-01 13:50:22 +0100105
106/** N0 values to test - Precommit */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100107const auto n0_values_precommit = framework::dataset::make("N0", { 4 });
giuros01b3204e72019-04-01 13:50:22 +0100108
109/** K0 values to test - Precommit */
110const auto k0_values_precommit = framework::dataset::make("K0", { 4 });
111
112/** H0 values to test - Precommit */
113const auto h0_values_precommit = framework::dataset::make("H0", 1, 3);
114
115/** M0 values to test - Nightly */
116const auto m0_values_nightly = framework::dataset::make("M0", 1, 8);
117
118/** N0 values to test - Nightly */
119const auto n0_values_nightly = framework::dataset::make("N0", { 2, 3, 4, 8 });
120
121/** K0 values to test - Nightly */
122const auto k0_values_nightly = framework::dataset::make("K0", { 2, 3, 4, 8 });
123
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100124/** Broadcast bias from vector to matrix */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100125const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } );
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100126
SiCong Lib972ae62020-08-03 15:39:45 +0100127/** Boundary handling cases for testing partial/non-partial (full) block dimensions, resulting from different combinations
128 * of M, M0, N and N0 values.
129 * M0 and N0 are kept constant, while the different test cases need to vary M and N.
130 *
131 * Eg. M = 64 and N = 33 result in a block dimension that has no partial blocks (all full blocks) in Y dimension and
132 * parital blocks in X dimension.
133 */
134const auto boundary_handling_cases = combine(combine(combine(combine(combine(combine(combine(combine(combine(
135 // Large k to force potential out-of-bound reads on input0
136 framework::dataset::make("K", 315),
137 // Batch size == 1 to force potential out-of-bound reads on input0
138 framework::dataset::make("batch_size", 1)),
139 framework::dataset::make("M0", 4)),
140 framework::dataset::make("N0", 4)),
141 framework::dataset::make("K0", 4)),
142 // Only need to test F32 as F16 shares identical boundary handling logics
143 framework::dataset::make("DataType", DataType::F32)),
144 framework::dataset::make("alpha", -0.75f )),
145 framework::dataset::make("beta", -0.35f )),
146 broadcast_bias_values),
147 framework::dataset::make("Activation", ActivationLayerInfo()));
148
SiCongLiafa19722021-10-24 19:12:33 +0100149/** Post Ops */
150using PostOpArgBroadcast = CLGEMMMatrixMultiplyNativeWithPostOpsFixture<float>::PostOpArgBroadcast;
151experimental::PostOpList<PostOpArgBroadcast> post_ops_1()
152{
153 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
154 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
155 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
156 std::make_tuple(true, true, false), // If broadcast in dims 0, 1 and 2
157 0,
158 ConvertPolicy::SATURATE);
159 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
160 return post_ops;
161}
162experimental::PostOpList<PostOpArgBroadcast> post_ops_2()
163{
164 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
165 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
166 std::make_tuple(false, true, true), // If broadcast in dims 0, 1 and 2
167 1,
168 ConvertPolicy::SATURATE);
169 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
170 return post_ops;
171}
172experimental::PostOpList<PostOpArgBroadcast> post_ops_3()
173{
174 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
175 // post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
176 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
177 std::make_tuple(false, false, false), // If broadcast in dims 0, 1 and 2
178 1,
179 ConvertPolicy::SATURATE);
180 return post_ops;
181}
182
183/** Different Post Op Lists */
184const auto post_op_lists = framework::dataset::make("post_op_lists", {
185 post_ops_1(),
186 post_ops_2(),
187 post_ops_3(),
188} );
189
190bool is_post_op_list_valid(unsigned int m, unsigned int n, unsigned int k, unsigned int batch, DataType data_type, const experimental::PostOpList<ITensorInfo*>& post_ops)
191{
192 const auto lhs_info = GEMMLHSMatrixInfo(4,4,1,false,true);
193 const auto rhs_info = GEMMRHSMatrixInfo(4,4,1,true,true,false);
194
195 // Create TensorInfo for post op arguments
196 TensorInfo input0_info(TensorShape(k, m, batch), 1, data_type);
197 TensorInfo input1_info(TensorShape(n, k, batch), 1, data_type);
198 TensorInfo input2_info(TensorShape(n), 1, data_type);
199 TensorInfo output_info(TensorShape(n, m, batch), 1, data_type);
200
201 GEMMKernelInfo gemm_info(m, n, k, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
202 false /**< reinterpret the input as 3D */,
203 true /**< Flag used to broadcast the bias addition */,
204 false /**< wider accumm */,
205 false /**< has pad y */,
206 ActivationLayerInfo::ActivationFunction::IDENTITY,
207 1 /**< Multiplication factor for the width of the 1xW transposed block */,
208 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
209 lhs_info,
210 rhs_info,
211 0 /**< Offset to be added to each element of the matrix A */,
212 0 /**< Offset to be added to each element of the matrix B */,
213 post_ops);
214 return bool(ClGemmMatrixMultiplyNativeKernel::validate(&input0_info.clone()->set_is_resizable(true),
215 &input1_info.clone()->set_is_resizable(true),
216 &input2_info.clone()->set_is_resizable(true),
217 &output_info.clone()->set_is_resizable(true),1.f,1.f,
218 lhs_info,
219 rhs_info,
220 gemm_info));
221}
222
giuros01b3204e72019-04-01 13:50:22 +0100223/** Configuration test */
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100224void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value, unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, bool broadcast_bias, DataType data_type, const ActivationLayerInfo &act_info)
giuros01b3204e72019-04-01 13:50:22 +0100225{
226 const unsigned int M = m_value;
227 const unsigned int N = n_value;
228 const unsigned int K = k_value;
229
230 GEMMLHSMatrixInfo lhs_info;
231 lhs_info.m0 = m0_value;
232 lhs_info.k0 = k0_value;
233
234 GEMMRHSMatrixInfo rhs_info;
235 rhs_info.n0 = n0_value;
236 rhs_info.k0 = k0_value;
237
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100238 GEMMKernelInfo kernel_info;
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100239 kernel_info.m = M;
240 kernel_info.n = N;
241 kernel_info.k = K;
242 kernel_info.broadcast_bias = broadcast_bias;
243 kernel_info.activation_info = act_info;
giuros01b3204e72019-04-01 13:50:22 +0100244
245 const TensorShape lhs_shape(K, M, b_value);
246 const TensorShape rhs_shape(N, K, b_value);
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100247 const TensorShape bias_shape(N,
248 broadcast_bias? 1 : M,
249 broadcast_bias? 1 : b_value);
giuros01b3204e72019-04-01 13:50:22 +0100250 const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, data_type),
251 TensorInfo(rhs_shape, 1, data_type),
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100252 kernel_info);
253
giuros01b3204e72019-04-01 13:50:22 +0100254 // Create tensors
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100255 CLTensor lhs = create_tensor<CLTensor>(lhs_shape, data_type);
giuros01b3204e72019-04-01 13:50:22 +0100256 CLTensor rhs = create_tensor<CLTensor>(rhs_shape, data_type);
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100257 CLTensor bias = create_tensor<CLTensor>(bias_shape, data_type);
258 CLTensor dst = create_tensor<CLTensor>(dst_shape, data_type);
giuros01b3204e72019-04-01 13:50:22 +0100259
260 ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
261 ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100262 ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
giuros01b3204e72019-04-01 13:50:22 +0100263 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
264
265 // Create and configure function
266 CLGEMMMatrixMultiplyNative gemm;
Georgios Pinitas856f66e2021-04-22 21:13:21 +0100267 gemm.configure(lhs.info(), rhs.info(), bias.info(), dst.info(), 1.0f, 1.0f, lhs_info, rhs_info, kernel_info);
giuros01b3204e72019-04-01 13:50:22 +0100268}
269} // namespace
270
271TEST_SUITE(CL)
272TEST_SUITE(GEMMMatrixMultiplyNative)
SiCongLiafa19722021-10-24 19:12:33 +0100273TEST_SUITE(ValidateFusedPostOpsConfigs)
274TEST_SUITE(Invalid)
275TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
276{
277 const auto data_type = DataType::F32;
278 const unsigned int m = 17;
279 const unsigned int n = 1;
280 const unsigned int k = 13;
281 const unsigned int batch = 2;
282 TensorShape post_op_arg0_shape(n, m, batch);
283 TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
284 auto post_op_arg1_info = post_op_arg_info.clone();
285
286 // Unsupported sequence of post ops
287 experimental::PostOpList<ITensorInfo*> post_ops{};
288 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
289 &post_op_arg_info,
290 1,
291 ConvertPolicy::SATURATE);
292 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
293 post_op_arg1_info.get(),
294 0,
295 ConvertPolicy::SATURATE);
296
297 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
298}
299TEST_CASE(OutputWidened, framework::DatasetMode::ALL)
300{
301 // Invalid broadcast: post op tensors "widen" the output tensor
302 const auto data_type = DataType::F32;
303 const unsigned int m = 1;
304 const unsigned int n = 18;
305 const unsigned int k = 13;
306 const unsigned int batch = 2;
307 TensorShape post_op_arg_shape(n, m + 1, batch); // output's Y dimension (m) is "widened", which is not allowed
308 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
309 experimental::PostOpList<ITensorInfo*> post_ops{};
310 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
311
312 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
313}
314TEST_CASE(BroadcastInXDimOnly, framework::DatasetMode::ALL)
315{
316 // Invalid broadcast: post op tensors broadcast in the first dimension (X) only
317 const auto data_type = DataType::F32;
318 const unsigned int m = 22;
319 const unsigned int n = 16;
320 const unsigned int k = 15;
321 const unsigned int batch = 3;
322 TensorShape post_op_arg_shape(1, m, batch);
323 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
324 experimental::PostOpList<ITensorInfo*> post_ops{};
325 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
326
327 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
328}
329TEST_SUITE_END() // Invalid
330TEST_SUITE(Valid)
331TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
332{
333 const auto data_type = DataType::F32;
334 const unsigned int m = 22;
335 const unsigned int n = 16;
336 const unsigned int k = 15;
337 const unsigned int batch = 3;
338 experimental::PostOpList<ITensorInfo*> post_ops{};
339
340 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
341}
342TEST_CASE(BroadcastInYDimOnly, framework::DatasetMode::ALL)
343{
344 const auto data_type = DataType::F32;
345 const unsigned int m = 22;
346 const unsigned int n = 16;
347 const unsigned int k = 15;
348 const unsigned int batch = 3;
349 TensorShape post_op_arg_shape(n, 1, batch);
350 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
351 experimental::PostOpList<ITensorInfo*> post_ops{};
352 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
353
354 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
355}
356TEST_CASE(BroadcastInBothXandYDims, framework::DatasetMode::ALL)
357{
358 const auto data_type = DataType::F32;
359 const unsigned int m = 22;
360 const unsigned int n = 16;
361 const unsigned int k = 15;
362 const unsigned int batch = 3;
363 TensorShape post_op_arg_shape(1, 1, batch);
364 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
365 experimental::PostOpList<ITensorInfo*> post_ops{};
366 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
367
368 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
369}
370TEST_CASE(BroadcastInAllDims, framework::DatasetMode::ALL)
371{
372 const auto data_type = DataType::F32;
373 const unsigned int m = 22;
374 const unsigned int n = 16;
375 const unsigned int k = 15;
376 const unsigned int batch = 3;
377 TensorShape post_op_arg_shape(1, 1, 1);
378 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
379 experimental::PostOpList<ITensorInfo*> post_ops{};
380 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
381
382 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
383}
384TEST_SUITE_END() // Valid
385TEST_SUITE_END() // ValidateFusedPostOps
giuros01b3204e72019-04-01 13:50:22 +0100386TEST_SUITE(Float)
387TEST_SUITE(FP32)
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100388DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(combine(combine(
giuros01b3204e72019-04-01 13:50:22 +0100389 m_values,
390 n_values),
391 k_values),
392 framework::dataset::make("batch_size", 1)),
393 m0_values_precommit),
394 n0_values_precommit),
395 k0_values_precommit),
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100396 broadcast_bias_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100397 act_values),
398m_value, n_value, k_value, b_value, m0_value, n0_value, k0_value, broadcast_bias, act_value)
giuros01b3204e72019-04-01 13:50:22 +0100399{
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100400 validate_configuration(m_value, n_value, k_value, b_value, m0_value, n0_value, k0_value, broadcast_bias, DataType::F32, act_value);
giuros01b3204e72019-04-01 13:50:22 +0100401}
402
SiCong Lib972ae62020-08-03 15:39:45 +0100403FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingPartialInXPartialInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL,
404 combine(combine(
405 framework::dataset::make("M", 3),
406 framework::dataset::make("N", 1)),
407 boundary_handling_cases))
408{
409 // Validate output
410 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
411}
412
413FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingPartialInXFullInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL,
414 combine(combine(
415 framework::dataset::make("M", 64),
416 framework::dataset::make("N", 51)),
417 boundary_handling_cases))
418{
419 // Validate output
420 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
421}
422
423FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingFullInXFullInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL,
424 combine(combine(
425 framework::dataset::make("M", 64),
426 framework::dataset::make("N", 32)),
427 boundary_handling_cases))
428{
429 // Validate output
430 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
431}
432
433FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingFullInXPartialInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL,
434 combine(combine(
435 framework::dataset::make("M", 37),
436 framework::dataset::make("N", 32)),
437 boundary_handling_cases))
438{
439 // Validate output
440 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
441}
442
giuros01b3204e72019-04-01 13:50:22 +0100443FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100444 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
giuros01b3204e72019-04-01 13:50:22 +0100445 m_values,
446 n_values),
447 k_values),
448 b_values),
449 m0_values_precommit),
450 n0_values_precommit),
451 k0_values_precommit),
452 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100453 a_values),
454 beta_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100455 broadcast_bias_values),
456 act_values))
giuros01b3204e72019-04-01 13:50:22 +0100457{
458 // Validate output
459 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
460}
461
Michalis Spyrou1d897772019-12-09 18:47:29 +0000462FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100463 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
giuros01b3204e72019-04-01 13:50:22 +0100464 m_values,
465 n_values),
466 k_values),
467 b_values),
468 m0_values_nightly),
469 n0_values_nightly),
470 k0_values_nightly),
471 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100472 a_values),
473 beta_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100474 broadcast_bias_values),
475 act_values))
giuros01b3204e72019-04-01 13:50:22 +0100476{
477 // Validate output
478 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
479}
480
481FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyNative3DFixture<float>, framework::DatasetMode::ALL,
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100482 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
giuros01b3204e72019-04-01 13:50:22 +0100483 m_w_values,
484 m_h_values),
485 n_values),
486 k_values),
487 b_values),
488 m0_values_precommit),
489 n0_values_precommit),
490 k0_values_precommit),
491 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100492 a_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100493 beta_values),
494 act_values))
giuros01b3204e72019-04-01 13:50:22 +0100495{
496 // Validate output
497 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
498}
499
Michalis Spyrou1d897772019-12-09 18:47:29 +0000500FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyNative3DFixture<float>, framework::DatasetMode::DISABLED,
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100501 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
giuros01b3204e72019-04-01 13:50:22 +0100502 m_w_values,
503 m_h_values),
504 n_values),
505 k_values),
506 b_values),
507 m0_values_nightly),
508 n0_values_nightly),
509 k0_values_nightly),
510 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice944170e2019-06-24 14:40:30 +0100511 a_values),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100512 beta_values),
513 act_values))
giuros01b3204e72019-04-01 13:50:22 +0100514{
515 // Validate output
516 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
517}
SiCongLiafa19722021-10-24 19:12:33 +0100518
519TEST_SUITE(FusedPostOps)
520
521FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyNativeWithPostOpsFixture<float>, framework::DatasetMode::ALL,
522 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
523 m_values,
524 n_values),
525 k_values),
526 b_values),
527 framework::dataset::make("M0", { 4 })),
528 n0_values_precommit),
529 k0_values_precommit),
530 framework::dataset::make("DataType", DataType::F32)),
531 framework::dataset::make("alpha", {1.0f} )),
532 framework::dataset::make("beta", {1.0f} )),
533 framework::dataset::make("broadcast_bias", { false, true } )),
534 framework::dataset::make("Activation", { ActivationLayerInfo() })),
535 post_op_lists)
536 )
537{
538 // Validate output
539 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
540}
541
542TEST_SUITE_END() // FusedPostOps
543
giuros01b3204e72019-04-01 13:50:22 +0100544TEST_SUITE_END() // FP32
giuros01b3204e72019-04-01 13:50:22 +0100545TEST_SUITE_END() // Float
546TEST_SUITE_END() // GEMMMatrixMulipltyNative
547TEST_SUITE_END() // CL
548} // namespace validation
549} // namespace test
550} // namespace arm_compute