blob: ca8b21cd0d85fe2810fe69afa614875ed78dc8a2 [file] [log] [blame]
Gian Marco Iodiceadc53952019-02-15 11:10:31 +00001/*
Giorgio Arena2ab585b2021-02-25 15:41:49 +00002 * Copyright (c) 2019-2021 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"
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"
SiCongLiafa19722021-10-24 19:12:33 +010029#include "src/core/experimental/PostOp.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 Iodice781cba72020-06-19 16:56:57 +0100110/** M0 values to test - precommit */
111const auto m0_values_precommit = framework::dataset::make("M0", { 4 });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000112
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100113/** N0 values to test - precommit*/
114const auto n0_values_precommit = framework::dataset::make("N0", { 4 });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000115
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100116/** K0 values to test - precommit*/
117const auto k0_values_precommit = framework::dataset::make("K0", { 4 });
118
119/** M0 values to test - nightly */
120const auto m0_values_nightly = framework::dataset::make("M0", { 8 });
121
122/** N0 values to test - nightly */
123const auto n0_values_nightly = framework::dataset::make("N0", { 16 });
124
125/** K0 values to test - nightly */
126const auto k0_values_nightly = framework::dataset::make("K0", { 16 });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000127
Sheri Zhang1a378102020-04-30 12:59:39 +0100128/** H0 values to test */
129const auto h0_values = framework::dataset::make("H0", 1, 3);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000130
131/** Interleave values to test with RHS matrix */
132const auto i_values_rhs = framework::dataset::make("interleave_rhs", { true, false });
133
134/** Transpose values to test with RHS matrix */
Gian Marco Iodiceba5e0962019-03-11 12:17:44 +0000135const auto t_values_rhs = framework::dataset::make("transpose_rhs", { true, false });
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000136
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100137/** Broadcast bias from vector to matrix */
Gian Marco Iodiced820db62019-08-05 14:23:23 +0100138const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } );
Georgios Pinitasb0f342e2019-05-21 13:32:43 +0100139
SiCong Lib972ae62020-08-03 15:39:45 +0100140/** Boundary handling cases for testing partial/non-partial (full) block dimensions, resulting from different combinations
141 * of M, M0, N and N0 values.
142 * M0 and N0 are kept constant, while the different test cases need to vary M and N.
143 *
144 * Eg. M = 64 and N = 33 result in a block dimension that has no partial blocks (all full blocks) in Y dimension and
145 * parital blocks in X dimension.
146 */
147const auto boundary_handling_cases = combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
148 // Large k to force potential out-of-bound reads on input0
149 framework::dataset::make("K", 315),
150 // Batch size == 1 to force potential out-of-bound reads on input0
151 framework::dataset::make("batch_size", 1)),
152 framework::dataset::make("M0", 4)),
153 framework::dataset::make("N0", 4)),
154 framework::dataset::make("K0", 4)),
155 framework::dataset::make("H0", 3)),
156 i_values_rhs),
157 t_values_rhs),
158 framework::dataset::make("export_to_cl_image_rhs", {true, false})),
159 // Only need to test F32 as F16 shares identical boundary handling logics
160 framework::dataset::make("DataType", DataType::F32)),
161 framework::dataset::make("alpha", -0.75f )),
162 framework::dataset::make("beta", -0.35f )),
163 broadcast_bias_values),
164 framework::dataset::make("Activation", ActivationLayerInfo()));
165
SiCongLiafa19722021-10-24 19:12:33 +0100166/** Post Ops */
167using PostOpArgBroadcast = CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<float>::PostOpArgBroadcast;
168experimental::PostOpList<PostOpArgBroadcast> post_ops_1()
169{
170 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
171 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::LINEAR, 0.5F, 0.0F});
172 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
173 std::make_tuple(true, true, false), // If broadcast in dims 0, 1 and 2
174 0,
175 ConvertPolicy::SATURATE);
176 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
177 return post_ops;
178}
179experimental::PostOpList<PostOpArgBroadcast> post_ops_2()
180{
181 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
182 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
183 std::make_tuple(false, true, true), // If broadcast in dims 0, 1 and 2
184 1,
185 ConvertPolicy::SATURATE);
186 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
187 return post_ops;
188}
189experimental::PostOpList<PostOpArgBroadcast> post_ops_3()
190{
191 experimental::PostOpList<PostOpArgBroadcast> post_ops{};
192 post_ops.push_back_op<experimental::PostOpAct<PostOpArgBroadcast>>(ActivationLayerInfo{ActivationLayerInfo::ActivationFunction::RELU, 2.1F, 1.3F});
193 post_ops.push_back_op<experimental::PostOpEltwiseAdd<PostOpArgBroadcast>>(
194 std::make_tuple(false, false, true), // If broadcast in dims 0, 1 and 2
195 1,
196 ConvertPolicy::SATURATE);
197 return post_ops;
198}
199
200/** Different Post Op Lists */
201const auto post_op_lists = framework::dataset::make("post_op_lists", {
202 post_ops_1(),
203 post_ops_2(),
204 post_ops_3(),
205 } );
206
207 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)
208{
209 const auto lhs_info = GEMMLHSMatrixInfo(4,4,1,false,true);
210 const auto rhs_info = GEMMRHSMatrixInfo(4,4,1,true,true,false);
211
212 // Create TensorInfo for post op arguments
213 TensorInfo input0_info(TensorShape(k, m, batch), 1, data_type);
214 TensorInfo input1_info(TensorShape(n, k, batch), 1, data_type);
215 TensorInfo input2_info(TensorShape(n), 1, data_type);
216 TensorInfo output_info(TensorShape(n, m, batch), 1, data_type);
217
218 const TensorInfo reshaped_input1_info = input1_info.clone()->set_tensor_shape(misc::shape_calculator::compute_rhs_reshaped_shape(input1_info, rhs_info));
219
220 GEMMKernelInfo gemm_info(m, n, k, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */,
221 false /**< reinterpret the input as 3D */,
222 true /**< Flag used to broadcast the bias addition */,
223 false /**< wider accumm */,
224 false /**< has pad y */,
225 ActivationLayerInfo::ActivationFunction::IDENTITY,
226 1 /**< Multiplication factor for the width of the 1xW transposed block */,
227 1 /**< Multiplication factor for the height of the 4x4 interleaved block */,
228 lhs_info,
229 rhs_info,
230 0 /**< Offset to be added to each element of the matrix A */,
231 0 /**< Offset to be added to each element of the matrix B */,
232 post_ops);
233 return bool(ClGemmMatrixMultiplyReshapedOnlyRhsKernel::validate(&input0_info.clone()->set_is_resizable(true),
234 &reshaped_input1_info.clone()->set_is_resizable(true),
235 &input2_info.clone()->set_is_resizable(true),
236 &output_info.clone()->set_is_resizable(true),1.f,1.f,
237 lhs_info,
238 rhs_info,
239 gemm_info));
240}
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000241/** Configuration test */
Sheri Zhang1a378102020-04-30 12:59:39 +0100242bool validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value,
243 unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, unsigned int h0_value,
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100244 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 +0100245 DataType dt_input0, DataType dt_input1, DataType dt_input2, DataType dt_output, float alpha, float beta)
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000246{
247 const unsigned int M = m_value;
248 const unsigned int N = n_value;
249 const unsigned int K = k_value;
250
251 GEMMLHSMatrixInfo lhs_info;
252 lhs_info.m0 = m0_value;
253 lhs_info.k0 = k0_value;
254
255 GEMMRHSMatrixInfo rhs_info;
256 rhs_info.n0 = n0_value;
257 rhs_info.k0 = k0_value;
258 rhs_info.h0 = h0_value;
259 rhs_info.interleave = i_value_rhs;
Gian Marco Iodiceba5e0962019-03-11 12:17:44 +0000260 rhs_info.transpose = t_value_rhs;
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100261 rhs_info.export_to_cl_image = export_to_cl_image;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000262
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100263 GEMMKernelInfo kernel_info;
264 kernel_info.m = M;
265 kernel_info.n = N;
266 kernel_info.k = K;
Sheri Zhang1a378102020-04-30 12:59:39 +0100267 kernel_info.depth_output_gemm3d = depth_output_gemm3d;
268 kernel_info.reinterpret_input_as_3d = input_as_3d;
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100269 kernel_info.broadcast_bias = broadcast_bias;
Gian Marco Iodiceca1f4602019-07-16 15:46:48 +0100270 kernel_info.activation_info = act_info;
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000271
272 const TensorShape lhs_shape(K, M, b_value);
273 const TensorShape rhs_shape(N, K, b_value);
Sheri Zhang1a378102020-04-30 12:59:39 +0100274 const TensorShape rhs_shape_reshaped = compute_rhs_reshaped_shape(TensorInfo(rhs_shape, 1, dt_input1),
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000275 rhs_info);
276
Sheri Zhang1a378102020-04-30 12:59:39 +0100277 const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, dt_input0),
278 TensorInfo(rhs_shape_reshaped, 1, dt_input1),
Gian Marco Iodice7026b302019-06-26 17:18:11 +0100279 kernel_info);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000280
Gian Marco Iodicee16c8902019-06-14 16:11:10 +0100281 const TensorShape bias_shape(N,
Sheri Zhang1a378102020-04-30 12:59:39 +0100282 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 +0100283 broadcast_bias? 1 : b_value);
284
Sheri Zhang1a378102020-04-30 12:59:39 +0100285 // Create tensor info
286 TensorInfo lhs = TensorInfo(lhs_shape, 1, dt_input0);
287 TensorInfo rhs_reshaped = TensorInfo(rhs_shape_reshaped, 1, dt_input1);
288 TensorInfo bias = TensorInfo(bias_shape, 1, dt_input2);
289 TensorInfo dst = TensorInfo(dst_shape, 1, dt_output);
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000290
291 // Create and configure function
292 CLGEMMMatrixMultiplyReshapedOnlyRHS gemm;
Sheri Zhang1a378102020-04-30 12:59:39 +0100293 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 +0000294}
SiCongLiafa19722021-10-24 19:12:33 +0100295
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000296} // namespace
297
298TEST_SUITE(CL)
299TEST_SUITE(GEMMMatrixMultiplyReshapedOnlyRHS)
Sheri Zhang1a378102020-04-30 12:59:39 +0100300
301/** Validate tests
302 *
303 * A series of validation tests on configurations which according to the API specification
304 * the function should fail against.
305 *
306 * Checks performed in order:
307 * - Mismachting data type: input1, input2 and output need to have same data type as input0. Support data type: F32/F16.
308 * - Unsupported M0: MO can only be 1,2,3,4,5,6,7,8
309 * - Unsupported N0: NO can only be 2,3,4,8,16
310 * - Unsupported K0: KO can only be 2,3,4,8,16
311 * - Unsupported bias addition: bias broadcast mode is 0 if the input or output has to be reinterpreted as 3D
312 * - Incorrect bias diemension when bias broadcast mode is 1 and beta is not 0.0f, should be (n, 1), not (n, m)
313 * - Incorrect input0 dimension when input is reinterpreted as 3D: input0->dimension(1) * input0->dimension(2) != m
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100314 * - Correct support for creating an OpenCL image object from buffer
315 * - 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 +0100316 * - Correct F16 support for creating an OpenCL image object from buffer.
Sheri Zhang1a378102020-04-30 12:59:39 +0100317 */
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100318DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(
319framework::dataset::make("batch_size", { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1 }),
320framework::dataset::make("M0", { 4, 9, 4, 4, 4, 4, 4, 4, 4, 4 })),
321framework::dataset::make("N0", { 4, 4, 18, 4, 4, 4, 4, 8, 2, 8 })),
322framework::dataset::make("K0", { 4, 4, 4, 1, 4, 4, 4, 4, 4, 4 })),
323framework::dataset::make("broadcast_bias", { false, false, false, false, false, true, true, false, false, false })),
324framework::dataset::make("input_as_3d", { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0 })),
325framework::dataset::make("depth_output_gemm3d", { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 })),
326framework::dataset::make("export_to_cl_image", { false, false, false, false, false, false, false, true, true, true })),
327framework::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})),
328framework::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})),
329framework::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})),
330framework::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})),
331framework::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 +0100332framework::dataset::make("Expected", { false, false, false, false, false, false, false, true, false, true })),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100333b_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 +0100334{
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100335 bool expected_value = expected;
336
337 // Change expected to false if the target platform does not support the OpenCL cl_khr_image2d_from_buffer extension
338 if(!image2d_from_buffer_supported(CLKernelLibrary::get().get_device()) && export_to_cl_image)
339 {
340 expected_value = false;
341 }
342
343 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);
344 ARM_COMPUTE_EXPECT(status == expected_value, framework::LogLevel::ERRORS);
Sheri Zhang1a378102020-04-30 12:59:39 +0100345}
346
SiCongLiafa19722021-10-24 19:12:33 +0100347TEST_SUITE(ValidateFusedPostOpsConfigs)
348TEST_SUITE(Invalid)
349TEST_CASE(UnsupportedPostOpSequence, framework::DatasetMode::ALL)
350{
351 const auto data_type = DataType::F32;
352 const unsigned int m = 17;
353 const unsigned int n = 1;
354 const unsigned int k = 13;
355 const unsigned int batch = 2;
356 TensorShape post_op_arg0_shape(n, m, batch);
357 TensorInfo post_op_arg_info(post_op_arg0_shape, 1, data_type);
358 auto post_op_arg1_info = post_op_arg_info.clone();
359
360 // Unsupported sequence of post ops
361 experimental::PostOpList<ITensorInfo*> post_ops{};
362 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
363 &post_op_arg_info,
364 1,
365 ConvertPolicy::SATURATE);
366 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>(
367 post_op_arg1_info.get(),
368 0,
369 ConvertPolicy::SATURATE);
370
371 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
372}
373TEST_CASE(OutputWidened, framework::DatasetMode::ALL)
374{
375 // Invalid broadcast: post op tensors "widen" the output tensor
376 const auto data_type = DataType::F32;
377 const unsigned int m = 17;
378 const unsigned int n = 1;
379 const unsigned int k = 1;
380 const unsigned int batch = 1;
381 TensorShape post_op_arg_shape(n, m, batch + 4); // output's batch dimension is "widened", which is not allowed
382 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
383 experimental::PostOpList<ITensorInfo*> post_ops{};
384 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
385
386 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
387}
388TEST_CASE(BroadcastInXDimOnly, framework::DatasetMode::ALL)
389{
390 // Invalid broadcast: post op tensors broadcast in the first dimension (X) only
391 const auto data_type = DataType::F32;
392 const unsigned int m = 22;
393 const unsigned int n = 16;
394 const unsigned int k = 15;
395 const unsigned int batch = 3;
396 TensorShape post_op_arg_shape(1, m, batch);
397 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
398 experimental::PostOpList<ITensorInfo*> post_ops{};
399 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
400
401 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == false, framework::LogLevel::ERRORS);
402}
403TEST_SUITE_END() // Invalid
404TEST_SUITE(Valid)
405TEST_CASE(EmptyPostOpList, framework::DatasetMode::ALL)
406{
407 const auto data_type = DataType::F32;
408 const unsigned int m = 22;
409 const unsigned int n = 16;
410 const unsigned int k = 15;
411 const unsigned int batch = 3;
412 experimental::PostOpList<ITensorInfo*> post_ops{};
413
414 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
415}
416TEST_CASE(BroadcastInYDimOnly, framework::DatasetMode::ALL)
417{
418 const auto data_type = DataType::F32;
419 const unsigned int m = 22;
420 const unsigned int n = 16;
421 const unsigned int k = 15;
422 const unsigned int batch = 3;
423 TensorShape post_op_arg_shape(n, 1, batch);
424 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
425 experimental::PostOpList<ITensorInfo*> post_ops{};
426 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
427
428 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
429}
430TEST_CASE(BroadcastInBothXandYDims, framework::DatasetMode::ALL)
431{
432 const auto data_type = DataType::F32;
433 const unsigned int m = 22;
434 const unsigned int n = 16;
435 const unsigned int k = 15;
436 const unsigned int batch = 3;
437 TensorShape post_op_arg_shape(1, 1, batch);
438 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
439 experimental::PostOpList<ITensorInfo*> post_ops{};
440 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
441
442 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
443}
444TEST_CASE(BroadcastInAllDims, framework::DatasetMode::ALL)
445{
446 const auto data_type = DataType::F32;
447 const unsigned int m = 22;
448 const unsigned int n = 16;
449 const unsigned int k = 15;
450 const unsigned int batch = 3;
451 TensorShape post_op_arg_shape(1, 1, 1);
452 TensorInfo post_op_arg_info(post_op_arg_shape, 1, data_type);
453 experimental::PostOpList<ITensorInfo*> post_ops{};
454 post_ops.push_back_op<experimental::PostOpEltwiseAdd<ITensorInfo*>>( &post_op_arg_info, 0, ConvertPolicy::SATURATE);
455
456 ARM_COMPUTE_EXPECT(is_post_op_list_valid(m, n, k, batch, data_type, post_ops) == true, framework::LogLevel::ERRORS);
457}
458TEST_SUITE_END() // Valid
459TEST_SUITE_END() // ValidateFusedPostOps
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000460TEST_SUITE(Float)
461TEST_SUITE(FP32)
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000462
SiCong Lib972ae62020-08-03 15:39:45 +0100463FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingPartialInXPartialInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
464 combine(combine(
465 framework::dataset::make("M", 3),
466 framework::dataset::make("N", 1)),
467 boundary_handling_cases))
468{
469 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000470 if(validate_result)
471 {
472 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
473 }
474 else
475 {
476 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
477 framework::ARM_COMPUTE_PRINT_INFO();
478 }
SiCong Lib972ae62020-08-03 15:39:45 +0100479}
480
481FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingPartialInXFullInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
482 combine(combine(
483 framework::dataset::make("M", 64),
484 framework::dataset::make("N", 43)),
485 boundary_handling_cases))
486{
487 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000488 if(validate_result)
489 {
490 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
491 }
492 else
493 {
494 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
495 framework::ARM_COMPUTE_PRINT_INFO();
496 }
SiCong Lib972ae62020-08-03 15:39:45 +0100497}
498
499FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingFullInXFullInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
500 combine(combine(
501 framework::dataset::make("M", 64),
502 framework::dataset::make("N", 32)),
503 boundary_handling_cases))
504{
505 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000506 if(validate_result)
507 {
508 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
509 }
510 else
511 {
512 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
513 framework::ARM_COMPUTE_PRINT_INFO();
514 }
SiCong Lib972ae62020-08-03 15:39:45 +0100515}
516
517FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingFullInXPartialInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
518 combine(combine(
519 framework::dataset::make("M", 37),
520 framework::dataset::make("N", 32)),
521 boundary_handling_cases))
522{
523 // Validate output
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000524 if(validate_result)
525 {
526 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
527 }
528 else
529 {
530 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
531 framework::ARM_COMPUTE_PRINT_INFO();
532 }
SiCong Lib972ae62020-08-03 15:39:45 +0100533}
534
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100535FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT,
536 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000537 m_values,
538 n_values),
539 k_values),
540 b_values),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100541 m0_values_precommit),
542 n0_values_precommit),
543 k0_values_precommit),
Sheri Zhang1a378102020-04-30 12:59:39 +0100544 h0_values),
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000545 i_values_rhs),
546 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000547 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100548 framework::dataset::make("DataType", DataType::F32)),
549 a_values),
550 beta_values),
551 broadcast_bias_values),
552 act_values))
553{
554 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000555 if(validate_result)
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100556 {
557 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
558 }
559 else
560 {
561 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
562 framework::ARM_COMPUTE_PRINT_INFO();
563 }
564}
565
566FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::NIGHTLY,
567 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
568 m_values,
569 n_values),
570 k_values),
571 b_values),
572 m0_values_nightly),
573 n0_values_nightly),
574 k0_values_nightly),
575 h0_values),
576 i_values_rhs),
577 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000578 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100579 framework::dataset::make("DataType", DataType::F32)),
580 a_values),
581 beta_values),
582 broadcast_bias_values),
583 act_values))
584{
585 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000586 if(validate_result)
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100587 {
588 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
589 }
590 else
591 {
592 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
593 framework::ARM_COMPUTE_PRINT_INFO();
594 }
595}
596
597FIXTURE_DATA_TEST_CASE(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::PRECOMMIT,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100598 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100599 m_w_values,
600 m_h_values),
601 n_values),
602 k_values),
603 b_values),
604 m0_values_precommit),
605 n0_values_precommit),
606 k0_values_precommit),
607 h0_values),
608 i_values_rhs),
609 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000610 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100611 framework::dataset::make("has_pad_y", {false, true})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100612 framework::dataset::make("DataType", DataType::F32)),
613 a_values),
614 beta_values),
615 act_values))
616{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000617 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
618 if(validate_result)
619 {
620 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
621 }
622 else
623 {
624 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
625 framework::ARM_COMPUTE_PRINT_INFO();
626 }
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100627}
628
629FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100630 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100631 m_w_values,
632 m_h_values),
633 n_values),
634 k_values),
635 b_values),
636 m0_values_nightly),
637 n0_values_nightly),
638 k0_values_nightly),
639 h0_values),
640 i_values_rhs),
641 t_values_rhs),
Manuel Bottini827817e2020-11-19 12:12:06 +0000642 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100643 framework::dataset::make("has_pad_y", {false, true})),
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100644 framework::dataset::make("DataType", DataType::F32)),
645 a_values),
646 beta_values),
647 act_values))
648{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000649 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
650 if(validate_result)
651 {
652 validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
653 }
654 else
655 {
656 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
657 framework::ARM_COMPUTE_PRINT_INFO();
658 }
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100659}
SiCongLiafa19722021-10-24 19:12:33 +0100660
661TEST_SUITE(FusedPostOps)
662
663FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<float>, framework::DatasetMode::ALL,
664 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
665 m_values,
666 n_values),
667 k_values),
668 b_values),
669 m0_values_precommit),
670 n0_values_precommit),
671 k0_values_precommit),
672 framework::dataset::make("H0", {1})),
673 framework::dataset::make("interleave_rhs", { true })),
674 t_values_rhs),
SiCongLibc788382021-11-02 14:52:02 +0000675 framework::dataset::make("export_to_cl_image_rhs", {false, true})),
SiCongLiafa19722021-10-24 19:12:33 +0100676 framework::dataset::make("DataType", DataType::F32)),
677 a_values),
678 beta_values),
679 framework::dataset::make("broadcast_bias", { false } )),
680 act_values),
681 post_op_lists)
682 )
683{
684 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
685 if(validate_result)
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
696TEST_SUITE_END() // FusedPostOps
697
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000698TEST_SUITE_END() // FP32
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100699
700TEST_SUITE(FP16)
701FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<half>, framework::DatasetMode::PRECOMMIT,
702 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
703 m_values,
704 n_values),
705 k_values),
706 b_values),
707 m0_values_precommit),
708 n0_values_precommit),
709 k0_values_precommit),
710 h0_values),
711 i_values_rhs),
712 t_values_rhs),
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100713 framework::dataset::make("export_to_cl_image_rhs", true)),
714 framework::dataset::make("DataType", DataType::F16)),
715 a_values),
716 beta_values),
717 broadcast_bias_values),
718 act_values))
719{
720 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000721 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100722 {
723 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
724 }
725 else
726 {
727 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
728 framework::ARM_COMPUTE_PRINT_INFO();
729 }
730}
731
732FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<half>, framework::DatasetMode::NIGHTLY,
733 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
734 m_values,
735 n_values),
736 k_values),
737 b_values),
738 m0_values_nightly),
739 n0_values_nightly),
740 k0_values_nightly),
741 h0_values),
742 i_values_rhs),
743 t_values_rhs),
744 framework::dataset::make("export_to_cl_image_rhs", true)),
745 framework::dataset::make("DataType", DataType::F16)),
746 a_values),
747 beta_values),
748 broadcast_bias_values),
749 act_values))
750{
751 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000752 if(validate_result)
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100753 {
754 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
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(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<half>, framework::DatasetMode::PRECOMMIT,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100764 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100765 m_w_values,
766 m_h_values),
767 n_values),
768 k_values),
769 b_values),
770 m0_values_precommit),
771 n0_values_precommit),
772 k0_values_precommit),
773 h0_values),
774 i_values_rhs),
775 t_values_rhs),
776 framework::dataset::make("export_to_cl_image_rhs", true)),
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100777 framework::dataset::make("has_pad_y", {false, true})),
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100778 framework::dataset::make("DataType", DataType::F16)),
779 a_values),
780 beta_values),
781 act_values))
782{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000783 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
784 if(validate_result)
785 {
786 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
787 }
788 else
789 {
790 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
791 framework::ARM_COMPUTE_PRINT_INFO();
792 }
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100793}
794
795FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<half>, framework::DatasetMode::NIGHTLY,
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100796 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100797 m_w_values,
798 m_h_values),
799 n_values),
800 k_values),
801 b_values),
802 m0_values_nightly),
803 n0_values_nightly),
804 k0_values_nightly),
805 h0_values),
806 i_values_rhs),
807 t_values_rhs),
808 framework::dataset::make("export_to_cl_image_rhs", true)),
Gian Marco Iodice9ae06d42020-10-22 16:37:12 +0100809 framework::dataset::make("has_pad_y", {false, true})),
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100810 framework::dataset::make("DataType", DataType::F16)),
811 a_values),
812 beta_values),
813 act_values))
814{
Sheri Zhangcc3e53c2020-11-16 21:17:28 +0000815 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
816 if(validate_result)
817 {
818 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
819 }
820 else
821 {
822 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
823 framework::ARM_COMPUTE_PRINT_INFO();
824 }
Gian Marco Iodice6f931342020-09-15 14:17:41 +0100825}
SiCongLiafa19722021-10-24 19:12:33 +0100826TEST_SUITE(FusedPostOps)
827
828FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSWithPostOpsFixture<half>, framework::DatasetMode::ALL,
829 combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(
830 m_values,
831 n_values),
832 k_values),
833 b_values),
834 m0_values_precommit),
835 n0_values_precommit),
836 k0_values_precommit),
837 framework::dataset::make("H0", {1})),
838 framework::dataset::make("interleave_rhs", { true })),
839 t_values_rhs),
840 framework::dataset::make("export_to_cl_image_rhs", true)),
841 framework::dataset::make("DataType", DataType::F16)),
842 a_values),
843 beta_values),
844 framework::dataset::make("broadcast_bias", { false } )),
845 act_values),
846 post_op_lists)
847 )
848{
849 // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension
850 if(validate_result)
851 {
852 validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
853 }
854 else
855 {
856 ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped");
857 framework::ARM_COMPUTE_PRINT_INFO();
858 }
859}
860
861TEST_SUITE_END() // FusedPostOps
862
Gian Marco Iodice781cba72020-06-19 16:56:57 +0100863TEST_SUITE_END() // FP16
864
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000865TEST_SUITE_END() // Float
866TEST_SUITE_END() // GEMMMatrixMulipltyReshapedOnlyRHS
867TEST_SUITE_END() // CL
868} // namespace validation
869} // namespace test
Georgios Pinitasb0f342e2019-05-21 13:32:43 +0100870} // namespace arm_compute