Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2019-2020 Arm Limited. |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 3 | * |
| 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 | */ |
| 24 | #include "arm_compute/core/CL/kernels/CLGEMMMatrixMultiplyReshapedOnlyRHSKernel.h" |
| 25 | #include "arm_compute/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.h" |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 26 | #include "arm_compute/core/KernelDescriptors.h" |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/Types.h" |
| 28 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
| 29 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 30 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 31 | #include "tests/CL/CLAccessor.h" |
| 32 | #include "tests/CL/Helper.h" |
| 33 | #include "tests/PaddingCalculator.h" |
| 34 | #include "tests/datasets/ShapeDatasets.h" |
| 35 | #include "tests/framework/Asserts.h" |
| 36 | #include "tests/framework/Macros.h" |
| 37 | #include "tests/framework/datasets/Datasets.h" |
| 38 | #include "tests/validation/Validation.h" |
| 39 | #include "tests/validation/fixtures/GEMMFixture.h" |
| 40 | |
| 41 | namespace arm_compute |
| 42 | { |
| 43 | namespace test |
| 44 | { |
| 45 | namespace validation |
| 46 | { |
| 47 | using namespace arm_compute::misc::shape_calculator; |
| 48 | |
| 49 | // Create function for CLGEMMReshapeRHSMatrixKernel |
| 50 | using CLGEMMReshapeRHSMatrix = CLSynthetizeFunction<CLGEMMReshapeRHSMatrixKernel>; |
| 51 | |
| 52 | // Create function for CLGEMMMatrixMultiplyReshapedOnlyRHSKernel |
| 53 | using CLGEMMMatrixMultiplyReshapedOnlyRHS = CLSynthetizeFunction<CLGEMMMatrixMultiplyReshapedOnlyRHSKernel>; |
| 54 | |
| 55 | // Fixture for CLGEMMMatrixMultiplyReshapedOnlyRHS |
| 56 | template <typename T> |
| 57 | using CLGEMMMatrixMultiplyReshapedOnlyRHSFixture = GEMMMatrixMultiplyReshapedOnlyRHSValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>; |
| 58 | |
| 59 | // Fixture for CLGEMMMatrixMultiplyReshapedOnlyRHS3D |
| 60 | template <typename T> |
| 61 | using CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture = GEMMMatrixMultiplyReshapedOnlyRHS3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshapedOnlyRHS>; |
| 62 | |
| 63 | namespace |
| 64 | { |
| 65 | // *INDENT-OFF* |
| 66 | // clang-format off |
| 67 | RelativeTolerance<float> rel_tolerance_f32(0.001f); |
| 68 | constexpr float abs_tolerance_f32(0.0001f); |
| 69 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 70 | RelativeTolerance<float> rel_tolerance_f16(0.001f); |
| 71 | constexpr float abs_tolerance_f16(0.01f); |
| 72 | |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 73 | /** Alpha values to test */ |
| 74 | const auto a_values = framework::dataset::make("alpha", {-0.75f} ); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 75 | |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 76 | /** Beta values to test */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 77 | const auto beta_values = framework::dataset::make("beta", {-0.35f, 0.0f} ); |
Georgios Pinitas | b0f342e | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 78 | |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 79 | /** M values to test */ |
| 80 | const auto m_values = framework::dataset::make("M", 37); |
| 81 | |
| 82 | /** M_W values to test */ |
| 83 | const auto m_w_values = framework::dataset::make("M_W", 5); |
| 84 | |
| 85 | /** M_H values to test */ |
| 86 | const auto m_h_values = framework::dataset::make("M_H", 7); |
| 87 | |
| 88 | /** N values to test */ |
| 89 | const auto n_values = framework::dataset::make("N", 51); |
| 90 | |
| 91 | /** K values to test */ |
| 92 | const auto k_values = framework::dataset::make("K", 23); |
| 93 | |
| 94 | /** Batch size values to test */ |
| 95 | const auto b_values = framework::dataset::make("batch_size", 1, 3); |
| 96 | |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 97 | /** Activation values to test */ |
| 98 | const auto act_values = framework::dataset::make("Activation", |
| 99 | { |
| 100 | ActivationLayerInfo(), |
| 101 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 8.f, 2.f), |
| 102 | }); |
| 103 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 104 | /** M0 values to test - precommit */ |
| 105 | const auto m0_values_precommit = framework::dataset::make("M0", { 4 }); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 106 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 107 | /** N0 values to test - precommit*/ |
| 108 | const auto n0_values_precommit = framework::dataset::make("N0", { 4 }); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 109 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 110 | /** K0 values to test - precommit*/ |
| 111 | const auto k0_values_precommit = framework::dataset::make("K0", { 4 }); |
| 112 | |
| 113 | /** M0 values to test - nightly */ |
| 114 | const auto m0_values_nightly = framework::dataset::make("M0", { 8 }); |
| 115 | |
| 116 | /** N0 values to test - nightly */ |
| 117 | const auto n0_values_nightly = framework::dataset::make("N0", { 16 }); |
| 118 | |
| 119 | /** K0 values to test - nightly */ |
| 120 | const auto k0_values_nightly = framework::dataset::make("K0", { 16 }); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 121 | |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 122 | /** H0 values to test */ |
| 123 | const auto h0_values = framework::dataset::make("H0", 1, 3); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 124 | |
| 125 | /** Interleave values to test with RHS matrix */ |
| 126 | const auto i_values_rhs = framework::dataset::make("interleave_rhs", { true, false }); |
| 127 | |
| 128 | /** Transpose values to test with RHS matrix */ |
Gian Marco Iodice | ba5e096 | 2019-03-11 12:17:44 +0000 | [diff] [blame] | 129 | const auto t_values_rhs = framework::dataset::make("transpose_rhs", { true, false }); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 130 | |
Gian Marco Iodice | e16c890 | 2019-06-14 16:11:10 +0100 | [diff] [blame] | 131 | /** Broadcast bias from vector to matrix */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 132 | const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } ); |
Georgios Pinitas | b0f342e | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 133 | |
SiCong Li | b972ae6 | 2020-08-03 15:39:45 +0100 | [diff] [blame] | 134 | /** Boundary handling cases for testing partial/non-partial (full) block dimensions, resulting from different combinations |
| 135 | * of M, M0, N and N0 values. |
| 136 | * M0 and N0 are kept constant, while the different test cases need to vary M and N. |
| 137 | * |
| 138 | * Eg. M = 64 and N = 33 result in a block dimension that has no partial blocks (all full blocks) in Y dimension and |
| 139 | * parital blocks in X dimension. |
| 140 | */ |
| 141 | const auto boundary_handling_cases = combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 142 | // Large k to force potential out-of-bound reads on input0 |
| 143 | framework::dataset::make("K", 315), |
| 144 | // Batch size == 1 to force potential out-of-bound reads on input0 |
| 145 | framework::dataset::make("batch_size", 1)), |
| 146 | framework::dataset::make("M0", 4)), |
| 147 | framework::dataset::make("N0", 4)), |
| 148 | framework::dataset::make("K0", 4)), |
| 149 | framework::dataset::make("H0", 3)), |
| 150 | i_values_rhs), |
| 151 | t_values_rhs), |
| 152 | framework::dataset::make("export_to_cl_image_rhs", {true, false})), |
| 153 | // Only need to test F32 as F16 shares identical boundary handling logics |
| 154 | framework::dataset::make("DataType", DataType::F32)), |
| 155 | framework::dataset::make("alpha", -0.75f )), |
| 156 | framework::dataset::make("beta", -0.35f )), |
| 157 | broadcast_bias_values), |
| 158 | framework::dataset::make("Activation", ActivationLayerInfo())); |
| 159 | |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 160 | /** Configuration test */ |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 161 | bool validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value, |
| 162 | unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, unsigned int h0_value, |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 163 | 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 Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 164 | DataType dt_input0, DataType dt_input1, DataType dt_input2, DataType dt_output, float alpha, float beta) |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 165 | { |
| 166 | const unsigned int M = m_value; |
| 167 | const unsigned int N = n_value; |
| 168 | const unsigned int K = k_value; |
| 169 | |
| 170 | GEMMLHSMatrixInfo lhs_info; |
| 171 | lhs_info.m0 = m0_value; |
| 172 | lhs_info.k0 = k0_value; |
| 173 | |
| 174 | GEMMRHSMatrixInfo rhs_info; |
| 175 | rhs_info.n0 = n0_value; |
| 176 | rhs_info.k0 = k0_value; |
| 177 | rhs_info.h0 = h0_value; |
| 178 | rhs_info.interleave = i_value_rhs; |
Gian Marco Iodice | ba5e096 | 2019-03-11 12:17:44 +0000 | [diff] [blame] | 179 | rhs_info.transpose = t_value_rhs; |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 180 | rhs_info.export_to_cl_image = export_to_cl_image; |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 181 | |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 182 | GEMMKernelInfo kernel_info; |
| 183 | kernel_info.m = M; |
| 184 | kernel_info.n = N; |
| 185 | kernel_info.k = K; |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 186 | kernel_info.depth_output_gemm3d = depth_output_gemm3d; |
| 187 | kernel_info.reinterpret_input_as_3d = input_as_3d; |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 188 | kernel_info.broadcast_bias = broadcast_bias; |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 189 | kernel_info.activation_info = act_info; |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 190 | |
| 191 | const TensorShape lhs_shape(K, M, b_value); |
| 192 | const TensorShape rhs_shape(N, K, b_value); |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 193 | const TensorShape rhs_shape_reshaped = compute_rhs_reshaped_shape(TensorInfo(rhs_shape, 1, dt_input1), |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 194 | rhs_info); |
| 195 | |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 196 | const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, dt_input0), |
| 197 | TensorInfo(rhs_shape_reshaped, 1, dt_input1), |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 198 | kernel_info); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 199 | |
Gian Marco Iodice | e16c890 | 2019-06-14 16:11:10 +0100 | [diff] [blame] | 200 | const TensorShape bias_shape(N, |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 201 | M, // Correct calculation should be: broadcast_bias? 1 : M, it's wrong here on purpose just for validation test |
Gian Marco Iodice | e16c890 | 2019-06-14 16:11:10 +0100 | [diff] [blame] | 202 | broadcast_bias? 1 : b_value); |
| 203 | |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 204 | // Create tensor info |
| 205 | TensorInfo lhs = TensorInfo(lhs_shape, 1, dt_input0); |
| 206 | TensorInfo rhs_reshaped = TensorInfo(rhs_shape_reshaped, 1, dt_input1); |
| 207 | TensorInfo bias = TensorInfo(bias_shape, 1, dt_input2); |
| 208 | TensorInfo dst = TensorInfo(dst_shape, 1, dt_output); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 209 | |
| 210 | // Create and configure function |
| 211 | CLGEMMMatrixMultiplyReshapedOnlyRHS gemm; |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 212 | return bool(gemm.validate(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info)); |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 213 | } |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 214 | |
| 215 | /** Zero padding test */ |
| 216 | bool validate_zero_padding(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value, |
| 217 | unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, unsigned int h0_value, |
| 218 | 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, |
| 219 | DataType dt_input0, DataType dt_input1, DataType dt_input2, DataType dt_output, float alpha, float beta) |
| 220 | { |
| 221 | const unsigned int M = m_value; |
| 222 | const unsigned int N = n_value; |
| 223 | const unsigned int K = k_value; |
| 224 | |
| 225 | GEMMLHSMatrixInfo lhs_info; |
| 226 | lhs_info.m0 = m0_value; |
| 227 | lhs_info.k0 = k0_value; |
| 228 | |
| 229 | GEMMRHSMatrixInfo rhs_info; |
| 230 | rhs_info.n0 = n0_value; |
| 231 | rhs_info.k0 = k0_value; |
| 232 | rhs_info.h0 = h0_value; |
| 233 | rhs_info.interleave = i_value_rhs; |
| 234 | rhs_info.transpose = t_value_rhs; |
| 235 | rhs_info.export_to_cl_image = export_to_cl_image; |
| 236 | |
| 237 | GEMMKernelInfo kernel_info; |
| 238 | kernel_info.m = M; |
| 239 | kernel_info.n = N; |
| 240 | kernel_info.k = K; |
| 241 | kernel_info.depth_output_gemm3d = depth_output_gemm3d; |
| 242 | kernel_info.reinterpret_input_as_3d = input_as_3d; |
| 243 | kernel_info.broadcast_bias = broadcast_bias; |
| 244 | kernel_info.activation_info = act_info; |
| 245 | |
| 246 | const TensorShape lhs_shape(K, M, b_value); |
| 247 | const TensorShape rhs_shape(N, K, b_value); |
| 248 | const TensorShape rhs_shape_reshaped = compute_rhs_reshaped_shape(TensorInfo(rhs_shape, 1, dt_input1), |
| 249 | rhs_info); |
| 250 | |
| 251 | const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, dt_input0), |
| 252 | TensorInfo(rhs_shape_reshaped, 1, dt_input1), |
| 253 | kernel_info); |
| 254 | |
| 255 | const TensorShape bias_shape(N, |
| 256 | M, // Correct calculation should be: broadcast_bias? 1 : M, it's wrong here on purpose just for validation test |
| 257 | broadcast_bias? 1 : b_value); |
| 258 | |
| 259 | // Create tensors |
| 260 | CLTensor lhs = create_tensor<CLTensor>(lhs_shape, dt_input0); |
| 261 | CLTensor rhs_reshaped = create_tensor<CLTensor>(rhs_shape_reshaped, dt_input1); |
| 262 | CLTensor bias = create_tensor<CLTensor>(bias_shape, dt_input2); |
| 263 | CLTensor dst = create_tensor<CLTensor>(dst_shape, dt_output); |
| 264 | |
| 265 | ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 266 | ARM_COMPUTE_EXPECT(rhs_reshaped.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 267 | ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 268 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 269 | |
| 270 | // Validate zero-padding |
| 271 | CLGEMMMatrixMultiplyReshapedOnlyRHS gemm; |
| 272 | |
| 273 | gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info); |
| 274 | |
SiCong Li | 406a13f | 2020-07-15 12:09:58 +0100 | [diff] [blame] | 275 | // Padding can be added along rhs and bias's X dimension |
| 276 | return dst.info()->padding().empty() && lhs.info()->padding().empty() && bias.info()->padding().bottom == 0 && bias.info()->padding().top == 0; |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 277 | } |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 278 | } // namespace |
| 279 | |
| 280 | TEST_SUITE(CL) |
| 281 | TEST_SUITE(GEMMMatrixMultiplyReshapedOnlyRHS) |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 282 | |
| 283 | /** Validate tests |
| 284 | * |
| 285 | * A series of validation tests on configurations which according to the API specification |
| 286 | * the function should fail against. |
| 287 | * |
| 288 | * Checks performed in order: |
| 289 | * - Mismachting data type: input1, input2 and output need to have same data type as input0. Support data type: F32/F16. |
| 290 | * - Unsupported M0: MO can only be 1,2,3,4,5,6,7,8 |
| 291 | * - Unsupported N0: NO can only be 2,3,4,8,16 |
| 292 | * - Unsupported K0: KO can only be 2,3,4,8,16 |
| 293 | * - Unsupported bias addition: bias broadcast mode is 0 if the input or output has to be reinterpreted as 3D |
| 294 | * - Incorrect bias diemension when bias broadcast mode is 1 and beta is not 0.0f, should be (n, 1), not (n, m) |
| 295 | * - Incorrect input0 dimension when input is reinterpreted as 3D: input0->dimension(1) * input0->dimension(2) != m |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 296 | * - Correct support for creating an OpenCL image object from buffer |
| 297 | * - Incorrect support for creating an OpenCL image object from buffer. N0 is 2 but it can only be 4,8 and 16 |
SiCong Li | 5bdde85 | 2020-08-26 13:55:15 +0100 | [diff] [blame^] | 298 | * - Correct F16 support for creating an OpenCL image object from buffer. |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 299 | */ |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 300 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip(zip( |
| 301 | framework::dataset::make("batch_size", { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1 }), |
| 302 | framework::dataset::make("M0", { 4, 9, 4, 4, 4, 4, 4, 4, 4, 4 })), |
| 303 | framework::dataset::make("N0", { 4, 4, 18, 4, 4, 4, 4, 8, 2, 8 })), |
| 304 | framework::dataset::make("K0", { 4, 4, 4, 1, 4, 4, 4, 4, 4, 4 })), |
| 305 | framework::dataset::make("broadcast_bias", { false, false, false, false, false, true, true, false, false, false })), |
| 306 | framework::dataset::make("input_as_3d", { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0 })), |
| 307 | framework::dataset::make("depth_output_gemm3d", { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 })), |
| 308 | framework::dataset::make("export_to_cl_image", { false, false, false, false, false, false, false, true, true, true })), |
| 309 | framework::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})), |
| 310 | framework::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})), |
| 311 | framework::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})), |
| 312 | framework::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})), |
| 313 | framework::dataset::make("Beta", { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f , 1.0f})), |
SiCong Li | 5bdde85 | 2020-08-26 13:55:15 +0100 | [diff] [blame^] | 314 | framework::dataset::make("Expected", { false, false, false, false, false, false, false, true, false, true })), |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 315 | b_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 Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 316 | { |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 317 | bool expected_value = expected; |
| 318 | |
| 319 | // Change expected to false if the target platform does not support the OpenCL cl_khr_image2d_from_buffer extension |
| 320 | if(!image2d_from_buffer_supported(CLKernelLibrary::get().get_device()) && export_to_cl_image) |
| 321 | { |
| 322 | expected_value = false; |
| 323 | } |
| 324 | |
| 325 | 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); |
| 326 | ARM_COMPUTE_EXPECT(status == expected_value, framework::LogLevel::ERRORS); |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 327 | } |
| 328 | |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 329 | /** Validate zero padding tests |
| 330 | * |
| 331 | * A series of validation tests to check that no padding is added as part of configuration for 4 different scenarios. |
| 332 | * |
| 333 | * Checks performed in order: |
| 334 | * - No partial blocks in both x and y dimensions |
| 335 | * - Partial blocks in x dimension |
| 336 | * - Partial blocks in y dimension |
| 337 | * - Partial blocks in both x and y dimensions |
SiCong Li | 3b64e3e | 2020-07-28 09:01:28 +0100 | [diff] [blame] | 338 | * - Special case: partial_n0 == 9 (vstore1 should be invoked instead of vstore_partial_1) |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 339 | */ |
| 340 | DATA_TEST_CASE(ValidateZeroPadding, framework::DatasetMode::ALL, zip(zip(zip(zip( |
SiCong Li | 3b64e3e | 2020-07-28 09:01:28 +0100 | [diff] [blame] | 341 | framework::dataset::make("M", { 24, 64, 101, 1, 100 }), |
| 342 | framework::dataset::make("N", { 48, 29, 16, 122, 41 })), |
| 343 | framework::dataset::make("M0", { 4, 8, 7, 2, 1 })), |
| 344 | framework::dataset::make("N0", { 4, 4, 16, 3, 16 })), |
| 345 | framework::dataset::make("export_to_cl_image", { false, true, true, false, false })), |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 346 | m_value, n_value, m0_value, n0_value, export_to_cl_image) |
| 347 | { |
| 348 | constexpr DataType dt = DataType::F32; |
| 349 | // Disable export_to_cl_image if the target platform does not support the OpenCL cl_khr_image2d_from_buffer extension |
| 350 | bool actual_export_to_cl_image = image2d_from_buffer_supported(CLKernelLibrary::get().get_device()) && export_to_cl_image; |
| 351 | |
| 352 | bool status = validate_zero_padding(m_value, n_value, 23, 1, m0_value, n0_value, 4, 1, false, false, actual_export_to_cl_image, false, 0, 0, ActivationLayerInfo(), dt, dt, dt, dt, 1.0f, 1.0f); |
| 353 | ARM_COMPUTE_EXPECT(status, framework::LogLevel::ERRORS); |
| 354 | } |
| 355 | |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 356 | TEST_SUITE(Float) |
| 357 | TEST_SUITE(FP32) |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 358 | |
SiCong Li | b972ae6 | 2020-08-03 15:39:45 +0100 | [diff] [blame] | 359 | FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingPartialInXPartialInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 360 | combine(combine( |
| 361 | framework::dataset::make("M", 3), |
| 362 | framework::dataset::make("N", 1)), |
| 363 | boundary_handling_cases)) |
| 364 | { |
| 365 | // Validate output |
| 366 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 367 | } |
| 368 | |
| 369 | FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingPartialInXFullInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 370 | combine(combine( |
| 371 | framework::dataset::make("M", 64), |
| 372 | framework::dataset::make("N", 43)), |
| 373 | boundary_handling_cases)) |
| 374 | { |
| 375 | // Validate output |
| 376 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 377 | } |
| 378 | |
| 379 | FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingFullInXFullInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 380 | combine(combine( |
| 381 | framework::dataset::make("M", 64), |
| 382 | framework::dataset::make("N", 32)), |
| 383 | boundary_handling_cases)) |
| 384 | { |
| 385 | // Validate output |
| 386 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 387 | } |
| 388 | |
| 389 | FIXTURE_DATA_TEST_CASE(RunPrecommitBoundaryHandlingFullInXPartialInY, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 390 | combine(combine( |
| 391 | framework::dataset::make("M", 37), |
| 392 | framework::dataset::make("N", 32)), |
| 393 | boundary_handling_cases)) |
| 394 | { |
| 395 | // Validate output |
| 396 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 397 | } |
| 398 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 399 | FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 400 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 401 | m_values, |
| 402 | n_values), |
| 403 | k_values), |
| 404 | b_values), |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 405 | m0_values_precommit), |
| 406 | n0_values_precommit), |
| 407 | k0_values_precommit), |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 408 | h0_values), |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 409 | i_values_rhs), |
| 410 | t_values_rhs), |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 411 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 412 | framework::dataset::make("DataType", DataType::F32)), |
Georgios Pinitas | b0f342e | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 413 | a_values), |
| 414 | beta_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 415 | broadcast_bias_values), |
| 416 | act_values)) |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 417 | { |
| 418 | // Validate output |
| 419 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 420 | } |
| 421 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 422 | FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::NIGHTLY, |
| 423 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 424 | m_values, |
| 425 | n_values), |
| 426 | k_values), |
| 427 | b_values), |
| 428 | m0_values_nightly), |
| 429 | n0_values_nightly), |
| 430 | k0_values_nightly), |
| 431 | h0_values), |
| 432 | i_values_rhs), |
| 433 | t_values_rhs), |
| 434 | framework::dataset::make("export_to_cl_image_rhs", false)), |
| 435 | framework::dataset::make("DataType", DataType::F32)), |
| 436 | a_values), |
| 437 | beta_values), |
| 438 | broadcast_bias_values), |
| 439 | act_values)) |
| 440 | { |
| 441 | // Validate output |
| 442 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 443 | } |
| 444 | |
| 445 | FIXTURE_DATA_TEST_CASE(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 446 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 447 | m_w_values, |
| 448 | m_h_values), |
| 449 | n_values), |
| 450 | k_values), |
| 451 | b_values), |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 452 | m0_values_precommit), |
| 453 | n0_values_precommit), |
| 454 | k0_values_precommit), |
Sheri Zhang | 1a37810 | 2020-04-30 12:59:39 +0100 | [diff] [blame] | 455 | h0_values), |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 456 | i_values_rhs), |
| 457 | t_values_rhs), |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 458 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 459 | framework::dataset::make("DataType", DataType::F32)), |
Georgios Pinitas | b0f342e | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 460 | a_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 461 | beta_values), |
| 462 | act_values)) |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 463 | { |
| 464 | // Validate output |
| 465 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 466 | } |
| 467 | |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 468 | FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::NIGHTLY, |
| 469 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 470 | m_w_values, |
| 471 | m_h_values), |
| 472 | n_values), |
| 473 | k_values), |
| 474 | b_values), |
| 475 | m0_values_nightly), |
| 476 | n0_values_nightly), |
| 477 | k0_values_nightly), |
| 478 | h0_values), |
| 479 | i_values_rhs), |
| 480 | t_values_rhs), |
| 481 | framework::dataset::make("export_to_cl_image_rhs", false)), |
| 482 | framework::dataset::make("DataType", DataType::F32)), |
| 483 | a_values), |
| 484 | beta_values), |
| 485 | act_values)) |
| 486 | { |
| 487 | // Validate output |
| 488 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 489 | } |
| 490 | |
| 491 | TEST_SUITE(ExportToCLImage) |
| 492 | FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 493 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 494 | m_values, |
| 495 | n_values), |
| 496 | k_values), |
| 497 | b_values), |
| 498 | m0_values_precommit), |
| 499 | n0_values_precommit), |
| 500 | k0_values_precommit), |
| 501 | h0_values), |
| 502 | i_values_rhs), |
| 503 | t_values_rhs), |
| 504 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 505 | framework::dataset::make("DataType", DataType::F32)), |
| 506 | a_values), |
| 507 | beta_values), |
| 508 | broadcast_bias_values), |
| 509 | act_values)) |
| 510 | { |
| 511 | // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension |
| 512 | if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device())) |
| 513 | { |
| 514 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 515 | } |
| 516 | else |
| 517 | { |
| 518 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 519 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<float>, framework::DatasetMode::NIGHTLY, |
| 524 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 525 | m_values, |
| 526 | n_values), |
| 527 | k_values), |
| 528 | b_values), |
| 529 | m0_values_nightly), |
| 530 | n0_values_nightly), |
| 531 | k0_values_nightly), |
| 532 | h0_values), |
| 533 | i_values_rhs), |
| 534 | t_values_rhs), |
| 535 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 536 | framework::dataset::make("DataType", DataType::F32)), |
| 537 | a_values), |
| 538 | beta_values), |
| 539 | broadcast_bias_values), |
| 540 | act_values)) |
| 541 | { |
| 542 | // Validate output only if the target platform supports the OpenCL cl_khr_image2d_from_buffer extension |
| 543 | if(image2d_from_buffer_supported(CLKernelLibrary::get().get_device())) |
| 544 | { |
| 545 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 546 | } |
| 547 | else |
| 548 | { |
| 549 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 550 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | FIXTURE_DATA_TEST_CASE(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 555 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 556 | m_w_values, |
| 557 | m_h_values), |
| 558 | n_values), |
| 559 | k_values), |
| 560 | b_values), |
| 561 | m0_values_precommit), |
| 562 | n0_values_precommit), |
| 563 | k0_values_precommit), |
| 564 | h0_values), |
| 565 | i_values_rhs), |
| 566 | t_values_rhs), |
| 567 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 568 | framework::dataset::make("DataType", DataType::F32)), |
| 569 | a_values), |
| 570 | beta_values), |
| 571 | act_values)) |
| 572 | { |
| 573 | // Validate output |
| 574 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 575 | } |
| 576 | |
| 577 | FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<float>, framework::DatasetMode::NIGHTLY, |
| 578 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 579 | m_w_values, |
| 580 | m_h_values), |
| 581 | n_values), |
| 582 | k_values), |
| 583 | b_values), |
| 584 | m0_values_nightly), |
| 585 | n0_values_nightly), |
| 586 | k0_values_nightly), |
| 587 | h0_values), |
| 588 | i_values_rhs), |
| 589 | t_values_rhs), |
| 590 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 591 | framework::dataset::make("DataType", DataType::F32)), |
| 592 | a_values), |
| 593 | beta_values), |
| 594 | act_values)) |
| 595 | { |
| 596 | // Validate output |
| 597 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 598 | } |
| 599 | TEST_SUITE_END() // ExportToCLImage |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 600 | TEST_SUITE_END() // FP32 |
Gian Marco Iodice | 781cba7 | 2020-06-19 16:56:57 +0100 | [diff] [blame] | 601 | |
| 602 | TEST_SUITE(FP16) |
| 603 | FIXTURE_DATA_TEST_CASE(RunPrecommit, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<half>, framework::DatasetMode::PRECOMMIT, |
| 604 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 605 | m_values, |
| 606 | n_values), |
| 607 | k_values), |
| 608 | b_values), |
| 609 | m0_values_precommit), |
| 610 | n0_values_precommit), |
| 611 | k0_values_precommit), |
| 612 | h0_values), |
| 613 | i_values_rhs), |
| 614 | t_values_rhs), |
| 615 | framework::dataset::make("export_to_cl_image_rhs", false)), |
| 616 | framework::dataset::make("DataType", DataType::F16)), |
| 617 | a_values), |
| 618 | beta_values), |
| 619 | broadcast_bias_values), |
| 620 | act_values)) |
| 621 | { |
| 622 | // Validate output |
| 623 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 624 | } |
| 625 | |
| 626 | FIXTURE_DATA_TEST_CASE(RunNightly, CLGEMMMatrixMultiplyReshapedOnlyRHSFixture<half>, framework::DatasetMode::NIGHTLY, |
| 627 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 628 | m_values, |
| 629 | n_values), |
| 630 | k_values), |
| 631 | b_values), |
| 632 | m0_values_nightly), |
| 633 | n0_values_nightly), |
| 634 | k0_values_nightly), |
| 635 | h0_values), |
| 636 | i_values_rhs), |
| 637 | t_values_rhs), |
| 638 | framework::dataset::make("export_to_cl_image_rhs", false)), |
| 639 | framework::dataset::make("DataType", DataType::F16)), |
| 640 | a_values), |
| 641 | beta_values), |
| 642 | broadcast_bias_values), |
| 643 | act_values)) |
| 644 | { |
| 645 | // Validate output |
| 646 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 647 | } |
| 648 | |
| 649 | FIXTURE_DATA_TEST_CASE(RunPrecommit3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<half>, framework::DatasetMode::PRECOMMIT, |
| 650 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 651 | m_w_values, |
| 652 | m_h_values), |
| 653 | n_values), |
| 654 | k_values), |
| 655 | b_values), |
| 656 | m0_values_precommit), |
| 657 | n0_values_precommit), |
| 658 | k0_values_precommit), |
| 659 | h0_values), |
| 660 | i_values_rhs), |
| 661 | t_values_rhs), |
| 662 | framework::dataset::make("export_to_cl_image_rhs", false)), |
| 663 | framework::dataset::make("DataType", DataType::F16)), |
| 664 | a_values), |
| 665 | beta_values), |
| 666 | act_values)) |
| 667 | { |
| 668 | // Validate output |
| 669 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 670 | } |
| 671 | |
| 672 | FIXTURE_DATA_TEST_CASE(RunNightly3D, CLGEMMMatrixMultiplyReshapedOnlyRHS3DFixture<half>, framework::DatasetMode::NIGHTLY, |
| 673 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 674 | m_w_values, |
| 675 | m_h_values), |
| 676 | n_values), |
| 677 | k_values), |
| 678 | b_values), |
| 679 | m0_values_nightly), |
| 680 | n0_values_nightly), |
| 681 | k0_values_nightly), |
| 682 | h0_values), |
| 683 | i_values_rhs), |
| 684 | t_values_rhs), |
| 685 | framework::dataset::make("export_to_cl_image_rhs", false)), |
| 686 | framework::dataset::make("DataType", DataType::F16)), |
| 687 | a_values), |
| 688 | beta_values), |
| 689 | act_values)) |
| 690 | { |
| 691 | // Validate output |
| 692 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 693 | } |
| 694 | |
| 695 | TEST_SUITE_END() // FP16 |
| 696 | |
Gian Marco Iodice | adc5395 | 2019-02-15 11:10:31 +0000 | [diff] [blame] | 697 | TEST_SUITE_END() // Float |
| 698 | TEST_SUITE_END() // GEMMMatrixMulipltyReshapedOnlyRHS |
| 699 | TEST_SUITE_END() // CL |
| 700 | } // namespace validation |
| 701 | } // namespace test |
Georgios Pinitas | b0f342e | 2019-05-21 13:32:43 +0100 | [diff] [blame] | 702 | } // namespace arm_compute |