blob: 860082f32bc71ef257002800ebcaba0157b3e706 [file] [log] [blame]
Gian Marco Iodiceadc53952019-02-15 11:10:31 +00001/*
Gian Marco Iodice10e88a72021-11-29 12:49:19 +00002 * Copyright (c) 2019-2022 Arm Limited.
Gian Marco Iodiceadc53952019-02-15 11:10:31 +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 Iodiceadc53952019-02-15 11:10:31 +000025#include "arm_compute/core/Types.h"
SiCongLi31778612021-11-12 17:33:45 +000026#include "arm_compute/core/experimental/PostOps.h"
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000027#include "arm_compute/core/utils/misc/ShapeCalculator.h"
28#include "arm_compute/runtime/CL/CLTensor.h"
29#include "arm_compute/runtime/CL/CLTensorAllocator.h"
Georgios Pinitas7891a732021-08-20 21:39:25 +010030#include "src/gpu/cl/kernels/ClGemmMatrixMultiplyReshapedOnlyRhsKernel.h"
31#include "src/gpu/cl/kernels/ClGemmReshapeRhsMatrixKernel.h"
Gian Marco Iodiceadc53952019-02-15 11:10:31 +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{
48using namespace arm_compute::misc::shape_calculator;
Georgios Pinitas856f66e2021-04-22 21:13:21 +010049using namespace arm_compute::opencl::kernels;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000050
Georgios Pinitas856f66e2021-04-22 21:13:21 +010051// Create function for ClGemmReshapeRhsMatrixKernel
52using CLGEMMReshapeRHSMatrix = CLSynthetizeOperator<ClGemmReshapeRhsMatrixKernel>;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000053
Georgios Pinitas856f66e2021-04-22 21:13:21 +010054// Create function for ClGemmMatrixMultiplyReshapedOnlyRhsKernel
55using CLGEMMMatrixMultiplyReshapedOnlyRHS = CLSynthetizeOperator<ClGemmMatrixMultiplyReshapedOnlyRhsKernel>;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000056
57// Fixture for CLGEMMMatrixMultiplyReshapedOnlyRHS
58template <typename T>
59using CLGEMMMatrixMultiplyReshapedOnlyRHSFixture = GEMMMatrixMultiplyReshapedOnlyRHSValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>;
60
61// Fixture for CLGEMMMatrixMultiplyReshapedOnlyRHS3D
62template <typename T>
63using CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture = GEMMMatrixMultiplyReshapedOnlyRHS3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>;
64
SiCongLiafa19722021-10-24 19:12:33 +010065// Fixture for CLGEMMMatrixMultiplyReshapedOnlyRHS with post ops
66template <typename T>
67using CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture =
68 GEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>;
69
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000070namespace
71{
72// *INDENT-OFF*
73// clang-format off
74RelativeTolerance<float> rel_tolerance_f32(0.001f);
75constexpr float abs_tolerance_f32(0.0001f);
76
Gian Marco Iodice781cba72020-06-19 16:56:57 +010077RelativeTolerance<float> rel_tolerance_f16(0.001f);
78constexpr float abs_tolerance_f16(0.01f);
79
Sheri Zhang1a378102020-04-30 12:59:39 +010080/** Alpha values to test */
81const auto a_values = framework::dataset::make("alpha", {-0.75f} );
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000082
Sheri Zhang1a378102020-04-30 12:59:39 +010083/** Beta values to test */
Gian Marco Iodice6f931342020-09-15 14:17:41 +010084const auto beta_values = framework::dataset::make("beta", {-0.35f} );
Georgios Pinitasb0f342e2019-05-21 13:32:43 +010085
Gian Marco Iodiceadc53952019-02-15 11:10:31 +000086/** M values to test */
87const auto m_values = framework::dataset::make("M", 37);
88
89/** M_W values to test */
90const auto m_w_values = framework::dataset::make("M_W", 5);
91
92/** M_H values to test */
93const auto m_h_values = framework::dataset::make("M_H", 7);
94
95/** N values to test */
96const auto n_values = framework::dataset::make("N", 51);
97
98/** K values to test */
99const auto k_values = framework::dataset::make("K", 23);
100
101/** Batch size values to test */
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100102const auto b_values = framework::dataset::make("batch_size", 2);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000103
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100104/** Activation values to test */
105const auto act_values = framework::dataset::make("Activation",
106{
Giorgio Arena2ab585b2021-02-25 15:41:49 +0000107 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 10.f),
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100108});
109
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000110/** Activation values to test */
111const auto act_identity = framework::dataset::make("Activation",
112{
113 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY),
114});
115
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100116/** M0 values to test - precommit */
117const auto m0_values_precommit = framework::dataset::make("M0", { 4 });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000118
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100119/** N0 values to test - precommit*/
120const auto n0_values_precommit = framework::dataset::make("N0", { 4 });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000121
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100122/** K0 values to test - precommit*/
123const auto k0_values_precommit = framework::dataset::make("K0", { 4 });
124
125/** M0 values to test - nightly */
126const auto m0_values_nightly = framework::dataset::make("M0", { 8 });
127
128/** N0 values to test - nightly */
129const auto n0_values_nightly = framework::dataset::make("N0", { 16 });
130
131/** K0 values to test - nightly */
132const auto k0_values_nightly = framework::dataset::make("K0", { 16 });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000133
Sheri Zhang1a378102020-04-30 12:59:39 +0100134/** H0 values to test */
135const auto h0_values = framework::dataset::make("H0", 1, 3);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000136
137/** Interleave values to test with RHS matrix */
138const auto i_values_rhs = framework::dataset::make("interleave_rhs", { true, false });
139
140/** Transpose values to test with RHS matrix */
Gian Marco Iodiceba5e0962019-03-11 12:17:44 +0000141const auto t_values_rhs = framework::dataset::make("transpose_rhs", { true, false });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000142
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100143/** Broadcast bias from vector to matrix */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100144const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } );
Georgios Pinitasb0f342e2019-05-21 13:32:43 +0100145
SiCong Lib972ae62020-08-03 15:39:45 +0100146/** Boundary handling cases for testing partial/non-partial (full) block dimensions, resulting from different combinations
147 * of M, M0, N and N0 values.
148 * M0 and N0 are kept constant, while the different test cases need to vary M and N.
149 *
150 * Eg. M = 64 and N = 33 result in a block dimension that has no partial blocks (all full blocks) in Y dimension and
151 * parital blocks in X dimension.
152 */
153const auto boundary_handling_cases = combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
154 // Large k to force potential out-of-bound reads on input0
155 framework::dataset::make("K", 315),
156 // Batch size == 1 to force potential out-of-bound reads on input0
157 framework::dataset::make("batch_size", 1)),
158 framework::dataset::make("M0", 4)),
159 framework::dataset::make("N0", 4)),
160 framework::dataset::make("K0", 4)),
161 framework::dataset::make("H0", 3)),
162 i_values_rhs),
163 t_values_rhs),
164 framework::dataset::make("export_to_cl_image_rhs", {true, false})),
165 // Only need to test F32 as F16 shares identical boundary handling logics
166 framework::dataset::make("DataType", DataType::F32)),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000167 framework::dataset::make("alpha", 1.0f )),
168 framework::dataset::make("beta", 0.0f )),
SiCong Lib972ae62020-08-03 15:39:45 +0100169 broadcast_bias_values),
170 framework::dataset::make("Activation", ActivationLayerInfo()));
171
SiCongLiafa19722021-10-24 19:12:33 +0100172/** Post Ops */
173using PostOpArgBroadcast = CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<float>::PostOpArgBroadcast;
174experimental::PostOpList<PostOpArgBroadcast> post_ops_1()
175{
176 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
177 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
178 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000179 std::make_tuple(false, false, false),
SiCongLiafa19722021-10-24 19:12:33 +0100180 0,
181 ConvertPolicy::SATURATE);
182 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
183 return post_ops;
184}
185experimental::PostOpList<PostOpArgBroadcast> post_ops_2()
186{
187 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
188 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000189 std::make_tuple(false, false, false),
SiCongLiafa19722021-10-24 19:12:33 +0100190 1,
191 ConvertPolicy::SATURATE);
192 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
193 return post_ops;
194}
195experimental::PostOpList<PostOpArgBroadcast> post_ops_3()
196{
197 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
SiCongLiafa19722021-10-24 19:12:33 +0100198 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000199 std::make_tuple(false, false, false),
SiCongLiafa19722021-10-24 19:12:33 +0100200 1,
201 ConvertPolicy::SATURATE);
202 return post_ops;
203}
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000204
SiCongLiafa19722021-10-24 19:12:33 +0100205/** Different Post Op Lists */
206const auto post_op_lists = framework::dataset::make("post_op_lists", {
207 post_ops_1(),
208 post_ops_2(),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000209 post_ops_3()
SiCongLiafa19722021-10-24 19:12:33 +0100210 } );
211
212 bool 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)
213{
214 const auto lhs_info = GEMMLHSMatrixInfo(4,4,1,false,true);
215 const auto rhs_info = GEMMRHSMatrixInfo(4,4,1,true,true,false);
216
217 // Create TensorInfo for post op arguments
218 TensorInfo input0_info(TensorShape(k, m, batch), 1, data_type);
219 TensorInfo input1_info(TensorShape(n, k, batch), 1, data_type);
220 TensorInfo input2_info(TensorShape(n), 1, data_type);
221 TensorInfo output_info(TensorShape(n, m, batch), 1, data_type);
222
223 const TensorInfo reshaped_input1_info = input1_info.clone()->set_tensor_shape(misc::shape_calculator::compute_rhs_reshaped_shape(input1_info, rhs_info));
224
225 GEMMKernelInfo gemm_info(m, n, k, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
226 false /**< reinterpret the input as 3D */,
227 true /**< Flag used to broadcast the bias addition */,
228 false /**< wider accumm */,
229 false /**< has pad y */,
230 ActivationLayerInfo::ActivationFunction::IDENTITY,
231 1 /**< Multiplication factor for the width of the 1xW transposed block */,
232 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
233 lhs_info,
234 rhs_info,
235 0 /**< Offset to be added to each element of the matrix A */,
236 0 /**< Offset to be added to each element of the matrix B */,
237 post_ops);
238 return bool(ClGemmMatrixMultiplyReshapedOnlyRhsKernel::validate(&input0_info.clone()->set_is_resizable(true),
239 &reshaped_input1_info.clone()->set_is_resizable(true),
240 &input2_info.clone()->set_is_resizable(true),
241 &output_info.clone()->set_is_resizable(true),1.f,1.f,
242 lhs_info,
243 rhs_info,
244 gemm_info));
245}
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000246/** Configuration test */
Sheri Zhang1a378102020-04-30 12:59:39 +0100247bool validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value,
248 unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, unsigned int h0_value,
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100249 bool i_value_rhs, bool t_value_rhs, bool export_to_cl_image, bool broadcast_bias, bool input_as_3d, unsigned int depth_output_gemm3d, const ActivationLayerInfo &act_info,
Sheri Zhang1a378102020-04-30 12:59:39 +0100250 DataType dt_input0, DataType dt_input1, DataType dt_input2, DataType dt_output, float alpha, float beta)
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000251{
252 const unsigned int M = m_value;
253 const unsigned int N = n_value;
254 const unsigned int K = k_value;
255
256 GEMMLHSMatrixInfo lhs_info;
257 lhs_info.m0 = m0_value;
258 lhs_info.k0 = k0_value;
259
260 GEMMRHSMatrixInfo rhs_info;
261 rhs_info.n0 = n0_value;
262 rhs_info.k0 = k0_value;
263 rhs_info.h0 = h0_value;
264 rhs_info.interleave = i_value_rhs;
Gian Marco Iodiceba5e0962019-03-11 12:17:44 +0000265 rhs_info.transpose = t_value_rhs;
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100266 rhs_info.export_to_cl_image = export_to_cl_image;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000267
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100268 GEMMKernelInfo kernel_info;
269 kernel_info.m = M;
270 kernel_info.n = N;
271 kernel_info.k = K;
Sheri Zhang1a378102020-04-30 12:59:39 +0100272 kernel_info.depth_output_gemm3d = depth_output_gemm3d;
273 kernel_info.reinterpret_input_as_3d = input_as_3d;
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100274 kernel_info.broadcast_bias = broadcast_bias;
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100275 kernel_info.activation_info = act_info;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000276
277 const TensorShape lhs_shape(K, M, b_value);
278 const TensorShape rhs_shape(N, K, b_value);
Sheri Zhang1a378102020-04-30 12:59:39 +0100279 const TensorShape rhs_shape_reshaped = compute_rhs_reshaped_shape(TensorInfo(rhs_shape, 1, dt_input1),
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000280 rhs_info);
281
Sheri Zhang1a378102020-04-30 12:59:39 +0100282 const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, dt_input0),
283 TensorInfo(rhs_shape_reshaped, 1, dt_input1),
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100284 kernel_info);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000285
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100286 const TensorShape bias_shape(N,
Sheri Zhang1a378102020-04-30 12:59:39 +0100287 M, // Correct calculation should be: broadcast_bias? 1 : M, it's wrong here on purpose just for validation test
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100288 broadcast_bias? 1 : b_value);
289
Sheri Zhang1a378102020-04-30 12:59:39 +0100290 // Create tensor info
291 TensorInfo lhs = TensorInfo(lhs_shape, 1, dt_input0);
292 TensorInfo rhs_reshaped = TensorInfo(rhs_shape_reshaped, 1, dt_input1);
293 TensorInfo bias = TensorInfo(bias_shape, 1, dt_input2);
294 TensorInfo dst = TensorInfo(dst_shape, 1, dt_output);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000295
296 // Create and configure function
297 CLGEMMMatrixMultiplyReshapedOnlyRHS gemm;
Sheri Zhang1a378102020-04-30 12:59:39 +0100298 return bool(gemm.validate(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info));
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000299}
SiCongLiafa19722021-10-24 19:12:33 +0100300
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000301} // namespace
302
303TEST_SUITE(CL)
304TEST_SUITE(GEMMMatrixMultiplyReshapedOnlyRHS)
Sheri Zhang1a378102020-04-30 12:59:39 +0100305
306/** Validate tests
307 *
308 * A series of validation tests on configurations which according to the API specification
309 * the function should fail against.
310 *
311 * Checks performed in order:
312 * - Mismachting data type: input1, input2 and output need to have same data type as input0. Support data type: F32/F16.
313 * - Unsupported M0: MO can only be 1,2,3,4,5,6,7,8
314 * - Unsupported N0: NO can only be 2,3,4,8,16
315 * - Unsupported K0: KO can only be 2,3,4,8,16
316 * - Unsupported bias addition: bias broadcast mode is 0 if the input or output has to be reinterpreted as 3D
317 * - Incorrect bias diemension when bias broadcast mode is 1 and beta is not 0.0f, should be (n, 1), not (n, m)
318 * - Incorrect input0 dimension when input is reinterpreted as 3D: input0->dimension(1) * input0->dimension(2) != m
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100319 * - Correct support for creating an OpenCL image object from buffer
320 * - Incorrect support for creating an OpenCL image object from buffer. N0 is 2 but it can only be 4,8 and 16
SiCong Li5bdde852020-08-26 13:55:15 +0100321 * - Correct F16 support for creating an OpenCL image object from buffer.
Sheri Zhang1a378102020-04-30 12:59:39 +0100322 */
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100323DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(
324framework::dataset::make("batch_size", { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1 }),
325framework::dataset::make("M0", { 4, 9, 4, 4, 4, 4, 4, 4, 4, 4 })),
326framework::dataset::make("N0", { 4, 4, 18, 4, 4, 4, 4, 8, 2, 8 })),
327framework::dataset::make("K0", { 4, 4, 4, 1, 4, 4, 4, 4, 4, 4 })),
328framework::dataset::make("broadcast_bias", { false, false, false, false, false, true, true, false, false, false })),
329framework::dataset::make("input_as_3d", { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0 })),
330framework::dataset::make("depth_output_gemm3d", { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 })),
331framework::dataset::make("export_to_cl_image", { false, false, false, false, false, false, false, true, true, true })),
332framework::dataset::make("data_type_input0", { DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F16})),
333framework::dataset::make("data_type_input1", { DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F16})),
334framework::dataset::make("data_type_input2", { DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F16})),
335framework::dataset::make("data_type_output", { DataType::F16, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F32, DataType::F16})),
336framework::dataset::make("Beta", { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f , 1.0f})),
SiCong Li5bdde852020-08-26 13:55:15 +0100337framework::dataset::make("Expected", { false, false, false, false, false, false, false, true, false, true })),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100338b_value, m0_value, n0_value, k0_value, broadcast_bias, input_as_3d, depth_output_gemm3d, export_to_cl_image, dt_input0, dt_intpu1, dt_input2, dt_output, beta, expected)
Sheri Zhang1a378102020-04-30 12:59:39 +0100339{
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100340 bool expected_value = expected;
341
342 // Change expected to false if the target platform does not support the OpenCL cl_khr_image2d_from_buffer extension
343 if(!image2d_from_buffer_supported(CLKernelLibrary::get().get_device()) && export_to_cl_image)
344 {
345 expected_value = false;
346 }
347
348 bool status = validate_configuration(37, 51, 23, b_value, m0_value, n0_value, k0_value, 1, false, false, export_to_cl_image, broadcast_bias, input_as_3d, depth_output_gemm3d, ActivationLayerInfo(), dt_input0, dt_intpu1, dt_input2, dt_output, 1.0f, beta);
349 ARM_COMPUTE_EXPECT(status == expected_value, framework::LogLevel::ERRORS);
Sheri Zhang1a378102020-04-30 12:59:39 +0100350}
351
SiCongLiafa19722021-10-24 19:12:33 +0100352TEST_SUITE(ValidateFusedPostOpsConfigs)
353TEST_SUITE(Invalid)
354TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
355{
356 const auto data_type = DataType::F32;
357 const unsigned int m = 17;
358 const unsigned int n = 1;
359 const unsigned int k = 13;
360 const unsigned int batch = 2;
361 TensorShape post_op_arg0_shape(n, m, batch);
362 TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
363 auto post_op_arg1_info = post_op_arg_info.clone();
364
365 // Unsupported sequence of post ops
366 experimental::PostOpList<ITensorInfo*> post_ops{};
367 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
368 &post_op_arg_info,
369 1,
370 ConvertPolicy::SATURATE);
371 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
372 post_op_arg1_info.get(),
373 0,
374 ConvertPolicy::SATURATE);
375
376 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
377}
378TEST_CASE(OutputWidened, framework::DatasetMode::ALL)
379{
380 // Invalid broadcast: post op tensors "widen" the output tensor
381 const auto data_type = DataType::F32;
382 const unsigned int m = 17;
383 const unsigned int n = 1;
384 const unsigned int k = 1;
385 const unsigned int batch = 1;
386 TensorShape post_op_arg_shape(n, m, batch + 4); // output's batch dimension is "widened", which is not allowed
387 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
388 experimental::PostOpList<ITensorInfo*> post_ops{};
389 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
390
391 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
392}
393TEST_CASE(BroadcastInXDimOnly, framework::DatasetMode::ALL)
394{
395 // Invalid broadcast: post op tensors broadcast in the first dimension (X) only
396 const auto data_type = DataType::F32;
397 const unsigned int m = 22;
398 const unsigned int n = 16;
399 const unsigned int k = 15;
400 const unsigned int batch = 3;
401 TensorShape post_op_arg_shape(1, m, batch);
402 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
403 experimental::PostOpList<ITensorInfo*> post_ops{};
404 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
405
406 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
407}
408TEST_SUITE_END() // Invalid
409TEST_SUITE(Valid)
410TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
411{
412 const auto data_type = DataType::F32;
413 const unsigned int m = 22;
414 const unsigned int n = 16;
415 const unsigned int k = 15;
416 const unsigned int batch = 3;
417 experimental::PostOpList<ITensorInfo*> post_ops{};
418
419 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
420}
421TEST_CASE(BroadcastInYDimOnly, framework::DatasetMode::ALL)
422{
423 const auto data_type = DataType::F32;
424 const unsigned int m = 22;
425 const unsigned int n = 16;
426 const unsigned int k = 15;
427 const unsigned int batch = 3;
428 TensorShape post_op_arg_shape(n, 1, batch);
429 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
430 experimental::PostOpList<ITensorInfo*> post_ops{};
431 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
432
433 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
434}
435TEST_CASE(BroadcastInBothXandYDims, framework::DatasetMode::ALL)
436{
437 const auto data_type = DataType::F32;
438 const unsigned int m = 22;
439 const unsigned int n = 16;
440 const unsigned int k = 15;
441 const unsigned int batch = 3;
442 TensorShape post_op_arg_shape(1, 1, batch);
443 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
444 experimental::PostOpList<ITensorInfo*> post_ops{};
445 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
446
447 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
448}
SiCongLiafa19722021-10-24 19:12:33 +0100449
SiCongLiafa19722021-10-24 19:12:33 +0100450TEST_SUITE_END() // Valid
451TEST_SUITE_END() // ValidateFusedPostOps
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000452TEST_SUITE(Float)
453TEST_SUITE(FP32)
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000454
SiCong Lib972ae62020-08-03 15:39:45 +0100455FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingPartialInXPartialInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
456 combine(combine(
457 framework::dataset::make("M", 3),
458 framework::dataset::make("N", 1)),
459 boundary_handling_cases))
460{
461 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000462 if(validate_result)
463 {
464 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
465 }
466 else
467 {
468 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
469 framework::ARM_COMPUTE_PRINT_INFO();
470 }
SiCong Lib972ae62020-08-03 15:39:45 +0100471}
472
473FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingPartialInXFullInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
474 combine(combine(
475 framework::dataset::make("M", 64),
476 framework::dataset::make("N", 43)),
477 boundary_handling_cases))
478{
479 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000480 if(validate_result)
481 {
482 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
483 }
484 else
485 {
486 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
487 framework::ARM_COMPUTE_PRINT_INFO();
488 }
SiCong Lib972ae62020-08-03 15:39:45 +0100489}
490
491FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingFullInXFullInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
492 combine(combine(
493 framework::dataset::make("M", 64),
494 framework::dataset::make("N", 32)),
495 boundary_handling_cases))
496{
497 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000498 if(validate_result)
499 {
500 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
501 }
502 else
503 {
504 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
505 framework::ARM_COMPUTE_PRINT_INFO();
506 }
SiCong Lib972ae62020-08-03 15:39:45 +0100507}
508
509FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingFullInXPartialInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
510 combine(combine(
511 framework::dataset::make("M", 37),
512 framework::dataset::make("N", 32)),
513 boundary_handling_cases))
514{
515 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000516 if(validate_result)
517 {
518 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
519 }
520 else
521 {
522 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
523 framework::ARM_COMPUTE_PRINT_INFO();
524 }
SiCong Lib972ae62020-08-03 15:39:45 +0100525}
526
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100527FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
528 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000529 m_values,
530 n_values),
531 k_values),
532 b_values),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100533 m0_values_precommit),
534 n0_values_precommit),
535 k0_values_precommit),
Sheri Zhang1a378102020-04-30 12:59:39 +0100536 h0_values),
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000537 i_values_rhs),
538 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000539 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100540 framework::dataset::make("DataType", DataType::F32)),
541 a_values),
542 beta_values),
543 broadcast_bias_values),
544 act_values))
545{
546 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000547 if(validate_result)
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100548 {
549 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
550 }
551 else
552 {
553 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
554 framework::ARM_COMPUTE_PRINT_INFO();
555 }
556}
557
558FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::NIGHTLY,
559 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
560 m_values,
561 n_values),
562 k_values),
563 b_values),
564 m0_values_nightly),
565 n0_values_nightly),
566 k0_values_nightly),
567 h0_values),
568 i_values_rhs),
569 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000570 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100571 framework::dataset::make("DataType", DataType::F32)),
572 a_values),
573 beta_values),
574 broadcast_bias_values),
575 act_values))
576{
577 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000578 if(validate_result)
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100579 {
580 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
581 }
582 else
583 {
584 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
585 framework::ARM_COMPUTE_PRINT_INFO();
586 }
587}
588
589FIXTURE_DATA_TEST_CASE(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::PRECOMMIT,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100590 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100591 m_w_values,
592 m_h_values),
593 n_values),
594 k_values),
595 b_values),
596 m0_values_precommit),
597 n0_values_precommit),
598 k0_values_precommit),
599 h0_values),
600 i_values_rhs),
601 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000602 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000603 framework::dataset::make("has_pad_y", {false})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100604 framework::dataset::make("DataType", DataType::F32)),
605 a_values),
606 beta_values),
607 act_values))
608{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000609 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
610 if(validate_result)
611 {
612 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
613 }
614 else
615 {
616 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
617 framework::ARM_COMPUTE_PRINT_INFO();
618 }
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100619}
620
621FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100622 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100623 m_w_values,
624 m_h_values),
625 n_values),
626 k_values),
627 b_values),
628 m0_values_nightly),
629 n0_values_nightly),
630 k0_values_nightly),
631 h0_values),
632 i_values_rhs),
633 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000634 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000635 framework::dataset::make("has_pad_y", {false})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100636 framework::dataset::make("DataType", DataType::F32)),
637 a_values),
638 beta_values),
639 act_values))
640{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000641 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
642 if(validate_result)
643 {
644 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
645 }
646 else
647 {
648 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
649 framework::ARM_COMPUTE_PRINT_INFO();
650 }
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100651}
SiCongLiafa19722021-10-24 19:12:33 +0100652
653TEST_SUITE(FusedPostOps)
654
655FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<float>, framework::DatasetMode::ALL,
656 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
657 m_values,
658 n_values),
659 k_values),
660 b_values),
661 m0_values_precommit),
662 n0_values_precommit),
663 k0_values_precommit),
664 framework::dataset::make("H0", {1})),
665 framework::dataset::make("interleave_rhs", { true })),
666 t_values_rhs),
SiCongLibc788382021-11-02 14:52:02 +0000667 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
SiCongLiafa19722021-10-24 19:12:33 +0100668 framework::dataset::make("DataType", DataType::F32)),
669 a_values),
670 beta_values),
671 framework::dataset::make("broadcast_bias", { false } )),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000672 act_identity),
SiCongLiafa19722021-10-24 19:12:33 +0100673 post_op_lists)
674 )
675{
676 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
677 if(validate_result)
678 {
679 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
680 }
681 else
682 {
683 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
684 framework::ARM_COMPUTE_PRINT_INFO();
685 }
686}
687
688TEST_SUITE_END() // FusedPostOps
689
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000690TEST_SUITE_END() // FP32
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100691
692TEST_SUITE(FP16)
693FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<half>, framework::DatasetMode::PRECOMMIT,
694 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
695 m_values,
696 n_values),
697 k_values),
698 b_values),
699 m0_values_precommit),
700 n0_values_precommit),
701 k0_values_precommit),
702 h0_values),
703 i_values_rhs),
704 t_values_rhs),
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100705 framework::dataset::make("export_to_cl_image_rhs", true)),
706 framework::dataset::make("DataType", DataType::F16)),
707 a_values),
708 beta_values),
709 broadcast_bias_values),
710 act_values))
711{
712 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000713 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100714 {
715 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
716 }
717 else
718 {
719 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
720 framework::ARM_COMPUTE_PRINT_INFO();
721 }
722}
723
724FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<half>, framework::DatasetMode::NIGHTLY,
725 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
726 m_values,
727 n_values),
728 k_values),
729 b_values),
730 m0_values_nightly),
731 n0_values_nightly),
732 k0_values_nightly),
733 h0_values),
734 i_values_rhs),
735 t_values_rhs),
736 framework::dataset::make("export_to_cl_image_rhs", true)),
737 framework::dataset::make("DataType", DataType::F16)),
738 a_values),
739 beta_values),
740 broadcast_bias_values),
741 act_values))
742{
743 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000744 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100745 {
746 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
747 }
748 else
749 {
750 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
751 framework::ARM_COMPUTE_PRINT_INFO();
752 }
753}
754
755FIXTURE_DATA_TEST_CASE(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<half>, framework::DatasetMode::PRECOMMIT,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100756 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100757 m_w_values,
758 m_h_values),
759 n_values),
760 k_values),
761 b_values),
762 m0_values_precommit),
763 n0_values_precommit),
764 k0_values_precommit),
765 h0_values),
766 i_values_rhs),
767 t_values_rhs),
768 framework::dataset::make("export_to_cl_image_rhs", true)),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000769 framework::dataset::make("has_pad_y", {false})),
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100770 framework::dataset::make("DataType", DataType::F16)),
771 a_values),
772 beta_values),
773 act_values))
774{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000775 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
776 if(validate_result)
777 {
778 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
779 }
780 else
781 {
782 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
783 framework::ARM_COMPUTE_PRINT_INFO();
784 }
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100785}
786
787FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<half>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100788 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100789 m_w_values,
790 m_h_values),
791 n_values),
792 k_values),
793 b_values),
794 m0_values_nightly),
795 n0_values_nightly),
796 k0_values_nightly),
797 h0_values),
798 i_values_rhs),
799 t_values_rhs),
800 framework::dataset::make("export_to_cl_image_rhs", true)),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000801 framework::dataset::make("has_pad_y", {false})),
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100802 framework::dataset::make("DataType", DataType::F16)),
803 a_values),
804 beta_values),
805 act_values))
806{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000807 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
808 if(validate_result)
809 {
810 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
811 }
812 else
813 {
814 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
815 framework::ARM_COMPUTE_PRINT_INFO();
816 }
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100817}
SiCongLiafa19722021-10-24 19:12:33 +0100818TEST_SUITE(FusedPostOps)
819
820FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<half>, framework::DatasetMode::ALL,
821 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
822 m_values,
823 n_values),
824 k_values),
825 b_values),
826 m0_values_precommit),
827 n0_values_precommit),
828 k0_values_precommit),
829 framework::dataset::make("H0", {1})),
830 framework::dataset::make("interleave_rhs", { true })),
831 t_values_rhs),
832 framework::dataset::make("export_to_cl_image_rhs", true)),
833 framework::dataset::make("DataType", DataType::F16)),
834 a_values),
835 beta_values),
836 framework::dataset::make("broadcast_bias", { false } )),
Gian Marco Iodice10e88a72021-11-29 12:49:19 +0000837 act_identity),
SiCongLiafa19722021-10-24 19:12:33 +0100838 post_op_lists)
839 )
840{
841 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
842 if(validate_result)
843 {
844 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
845 }
846 else
847 {
848 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
849 framework::ARM_COMPUTE_PRINT_INFO();
850 }
851}
852
853TEST_SUITE_END() // FusedPostOps
854
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100855TEST_SUITE_END() // FP16
856
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000857TEST_SUITE_END() // Float
858TEST_SUITE_END() // GEMMMatrixMulipltyReshapedOnlyRHS
859TEST_SUITE_END() // CL
860} // namespace validation
861} // namespace test
Georgios Pinitasb0f342e2019-05-21 13:32:43 +0100862} // namespace arm_compute