giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 1 | /* |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 2 | * Copyright (c) 2019-2020 Arm Limited. |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [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/CLGEMMMatrixMultiplyNativeKernel.h" |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 25 | #include "arm_compute/core/KernelDescriptors.h" |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 26 | #include "arm_compute/core/Types.h" |
| 27 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
| 28 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 29 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 30 | #include "tests/CL/CLAccessor.h" |
| 31 | #include "tests/CL/Helper.h" |
| 32 | #include "tests/PaddingCalculator.h" |
| 33 | #include "tests/datasets/ShapeDatasets.h" |
| 34 | #include "tests/framework/Asserts.h" |
| 35 | #include "tests/framework/Macros.h" |
| 36 | #include "tests/framework/datasets/Datasets.h" |
| 37 | #include "tests/validation/Validation.h" |
| 38 | #include "tests/validation/fixtures/GEMMFixture.h" |
| 39 | |
| 40 | namespace arm_compute |
| 41 | { |
| 42 | namespace test |
| 43 | { |
| 44 | namespace validation |
| 45 | { |
| 46 | using namespace arm_compute::misc::shape_calculator; |
| 47 | |
| 48 | // Create function for CLGEMMMatrixMultiplyNativeKernel |
| 49 | using CLGEMMMatrixMultiplyNative = CLSynthetizeFunction<CLGEMMMatrixMultiplyNativeKernel>; |
| 50 | |
| 51 | // Fixture for CLGEMMMatrixMultiplyNative |
| 52 | template <typename T> |
| 53 | using CLGEMMMatrixMultiplyNativeFixture = GEMMMatrixMultiplyNativeValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>; |
| 54 | |
| 55 | // Fixture for CLGEMMMatrixMultiplyNative3D |
| 56 | template <typename T> |
| 57 | using CLGEMMMatrixMultiplyNative3DFixture = GEMMMatrixMultiplyNative3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMMatrixMultiplyNative>; |
| 58 | |
| 59 | namespace |
| 60 | { |
| 61 | // *INDENT-OFF* |
| 62 | // clang-format off |
| 63 | RelativeTolerance<float> rel_tolerance_f32(0.001f); |
| 64 | constexpr float abs_tolerance_f32(0.0001f); |
| 65 | |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 66 | /** Alpha values to test - Precommit */ |
| 67 | const auto a_values = framework::dataset::make("alpha", {1.0f, -0.75f} ); |
| 68 | |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 69 | /** Beta values to test - Precommit */ |
| 70 | const auto beta_values = framework::dataset::make("beta", {-0.75f, 0.0f} ); |
| 71 | |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 72 | /** M values to test */ |
| 73 | const auto m_values = framework::dataset::make("M", 37); |
| 74 | |
| 75 | /** M_W values to test */ |
| 76 | const auto m_w_values = framework::dataset::make("M_W", 5); |
| 77 | |
| 78 | /** M_H values to test */ |
| 79 | const auto m_h_values = framework::dataset::make("M_H", 7); |
| 80 | |
| 81 | /** N values to test */ |
| 82 | const auto n_values = framework::dataset::make("N", 51); |
| 83 | |
| 84 | /** K values to test */ |
| 85 | const auto k_values = framework::dataset::make("K", 23); |
| 86 | |
| 87 | /** Batch size values to test */ |
| 88 | const auto b_values = framework::dataset::make("batch_size", 1, 3); |
| 89 | |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 90 | /** Activation values to test */ |
| 91 | const auto act_values = framework::dataset::make("Activation", |
| 92 | { |
| 93 | ActivationLayerInfo(), |
| 94 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 8.f, 2.f), |
| 95 | }); |
| 96 | |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 97 | /** M0 values to test - Precommit */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 98 | const auto m0_values_precommit = framework::dataset::make("M0", { 4, 6 }); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 99 | |
| 100 | /** N0 values to test - Precommit */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 101 | const auto n0_values_precommit = framework::dataset::make("N0", { 4 }); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 102 | |
| 103 | /** K0 values to test - Precommit */ |
| 104 | const auto k0_values_precommit = framework::dataset::make("K0", { 4 }); |
| 105 | |
| 106 | /** H0 values to test - Precommit */ |
| 107 | const auto h0_values_precommit = framework::dataset::make("H0", 1, 3); |
| 108 | |
| 109 | /** M0 values to test - Nightly */ |
| 110 | const auto m0_values_nightly = framework::dataset::make("M0", 1, 8); |
| 111 | |
| 112 | /** N0 values to test - Nightly */ |
| 113 | const auto n0_values_nightly = framework::dataset::make("N0", { 2, 3, 4, 8 }); |
| 114 | |
| 115 | /** K0 values to test - Nightly */ |
| 116 | const auto k0_values_nightly = framework::dataset::make("K0", { 2, 3, 4, 8 }); |
| 117 | |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 118 | /** Broadcast bias from vector to matrix */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 119 | const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } ); |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 120 | |
SiCong Li | b972ae6 | 2020-08-03 15:39:45 +0100 | [diff] [blame^] | 121 | /** Boundary handling cases for testing partial/non-partial (full) block dimensions, resulting from different combinations |
| 122 | * of M, M0, N and N0 values. |
| 123 | * M0 and N0 are kept constant, while the different test cases need to vary M and N. |
| 124 | * |
| 125 | * Eg. M = 64 and N = 33 result in a block dimension that has no partial blocks (all full blocks) in Y dimension and |
| 126 | * parital blocks in X dimension. |
| 127 | */ |
| 128 | const auto boundary_handling_cases = combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 129 | // Large k to force potential out-of-bound reads on input0 |
| 130 | framework::dataset::make("K", 315), |
| 131 | // Batch size == 1 to force potential out-of-bound reads on input0 |
| 132 | framework::dataset::make("batch_size", 1)), |
| 133 | framework::dataset::make("M0", 4)), |
| 134 | framework::dataset::make("N0", 4)), |
| 135 | framework::dataset::make("K0", 4)), |
| 136 | // Only need to test F32 as F16 shares identical boundary handling logics |
| 137 | framework::dataset::make("DataType", DataType::F32)), |
| 138 | framework::dataset::make("alpha", -0.75f )), |
| 139 | framework::dataset::make("beta", -0.35f )), |
| 140 | broadcast_bias_values), |
| 141 | framework::dataset::make("Activation", ActivationLayerInfo())); |
| 142 | |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 143 | /** Configuration test */ |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 144 | void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value, unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, bool broadcast_bias, DataType data_type, const ActivationLayerInfo &act_info) |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 145 | { |
| 146 | const unsigned int M = m_value; |
| 147 | const unsigned int N = n_value; |
| 148 | const unsigned int K = k_value; |
| 149 | |
| 150 | GEMMLHSMatrixInfo lhs_info; |
| 151 | lhs_info.m0 = m0_value; |
| 152 | lhs_info.k0 = k0_value; |
| 153 | |
| 154 | GEMMRHSMatrixInfo rhs_info; |
| 155 | rhs_info.n0 = n0_value; |
| 156 | rhs_info.k0 = k0_value; |
| 157 | |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 158 | GEMMKernelInfo kernel_info; |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 159 | kernel_info.m = M; |
| 160 | kernel_info.n = N; |
| 161 | kernel_info.k = K; |
| 162 | kernel_info.broadcast_bias = broadcast_bias; |
| 163 | kernel_info.activation_info = act_info; |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 164 | |
| 165 | const TensorShape lhs_shape(K, M, b_value); |
| 166 | const TensorShape rhs_shape(N, K, b_value); |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 167 | const TensorShape bias_shape(N, |
| 168 | broadcast_bias? 1 : M, |
| 169 | broadcast_bias? 1 : b_value); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 170 | const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, data_type), |
| 171 | TensorInfo(rhs_shape, 1, data_type), |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 172 | kernel_info); |
| 173 | |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 174 | // Create tensors |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 175 | CLTensor lhs = create_tensor<CLTensor>(lhs_shape, data_type); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 176 | CLTensor rhs = create_tensor<CLTensor>(rhs_shape, data_type); |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 177 | CLTensor bias = create_tensor<CLTensor>(bias_shape, data_type); |
| 178 | CLTensor dst = create_tensor<CLTensor>(dst_shape, data_type); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 179 | |
| 180 | ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 181 | ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS); |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 182 | ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 183 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 184 | |
| 185 | // Create and configure function |
| 186 | CLGEMMMatrixMultiplyNative gemm; |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 187 | gemm.configure(&lhs, &rhs, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, kernel_info); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 188 | } |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 189 | /** Zero padding test */ |
| 190 | bool validate_zero_padding(unsigned int m_value, unsigned int n_value, unsigned int k_value, unsigned int b_value, unsigned int m0_value, unsigned int n0_value, unsigned int k0_value, bool broadcast_bias, DataType data_type, const ActivationLayerInfo &act_info) |
| 191 | { |
| 192 | const unsigned int M = m_value; |
| 193 | const unsigned int N = n_value; |
| 194 | const unsigned int K = k_value; |
| 195 | |
| 196 | GEMMLHSMatrixInfo lhs_info; |
| 197 | lhs_info.m0 = m0_value; |
| 198 | lhs_info.k0 = k0_value; |
| 199 | |
| 200 | GEMMRHSMatrixInfo rhs_info; |
| 201 | rhs_info.n0 = n0_value; |
| 202 | rhs_info.k0 = k0_value; |
| 203 | |
| 204 | GEMMKernelInfo kernel_info; |
| 205 | kernel_info.m = M; |
| 206 | kernel_info.n = N; |
| 207 | kernel_info.k = K; |
| 208 | kernel_info.broadcast_bias = broadcast_bias; |
| 209 | kernel_info.activation_info = act_info; |
| 210 | |
| 211 | const TensorShape lhs_shape(K, M, b_value); |
| 212 | const TensorShape rhs_shape(N, K, b_value); |
| 213 | const TensorShape bias_shape(N, |
| 214 | broadcast_bias? 1 : M, |
| 215 | broadcast_bias? 1 : b_value); |
| 216 | const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, data_type), |
| 217 | TensorInfo(rhs_shape, 1, data_type), |
| 218 | kernel_info); |
| 219 | |
| 220 | // Create tensors |
| 221 | CLTensor lhs = create_tensor<CLTensor>(lhs_shape, data_type); |
| 222 | CLTensor rhs = create_tensor<CLTensor>(rhs_shape, data_type); |
| 223 | CLTensor bias = create_tensor<CLTensor>(bias_shape, data_type); |
| 224 | CLTensor dst = create_tensor<CLTensor>(dst_shape, data_type); |
| 225 | |
| 226 | ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 227 | ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 228 | ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 229 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 230 | |
| 231 | // Create and configure function |
| 232 | CLGEMMMatrixMultiplyNative gemm; |
| 233 | gemm.configure(&lhs, &rhs, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, kernel_info); |
| 234 | |
SiCong Li | 406a13f | 2020-07-15 12:09:58 +0100 | [diff] [blame] | 235 | // Padding can be added along rhs and bias's X dimension |
| 236 | 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] | 237 | } |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 238 | } // namespace |
| 239 | |
| 240 | TEST_SUITE(CL) |
| 241 | TEST_SUITE(GEMMMatrixMultiplyNative) |
| 242 | TEST_SUITE(Float) |
| 243 | TEST_SUITE(FP32) |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 244 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(combine(combine( |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 245 | m_values, |
| 246 | n_values), |
| 247 | k_values), |
| 248 | framework::dataset::make("batch_size", 1)), |
| 249 | m0_values_precommit), |
| 250 | n0_values_precommit), |
| 251 | k0_values_precommit), |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 252 | broadcast_bias_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 253 | act_values), |
| 254 | m_value, n_value, k_value, b_value, m0_value, n0_value, k0_value, broadcast_bias, act_value) |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 255 | { |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 256 | validate_configuration(m_value, n_value, k_value, b_value, m0_value, n0_value, k0_value, broadcast_bias, DataType::F32, act_value); |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 257 | } |
| 258 | |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 259 | /** Validate zero padding tests |
| 260 | * |
| 261 | * A series of validation tests to check that no padding is added as part of configuration for 4 different scenarios. |
| 262 | * |
| 263 | * Checks performed in order: |
| 264 | * - No partial blocks in both x and y dimensions |
| 265 | * - Partial blocks in x dimension |
| 266 | * - Partial blocks in y dimension |
| 267 | * - Partial blocks in both x and y dimensions |
| 268 | * - No blocks in both x and y dimensions, scalar store (N0==1) |
SiCong Li | 3b64e3e | 2020-07-28 09:01:28 +0100 | [diff] [blame] | 269 | * - Special case: partial_n0 == 5 (vstore1 should be invoked instead of vstore_partial_1) |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 270 | */ |
| 271 | DATA_TEST_CASE(ValidateZeroPadding, framework::DatasetMode::ALL, zip(zip(zip( |
SiCong Li | 3b64e3e | 2020-07-28 09:01:28 +0100 | [diff] [blame] | 272 | framework::dataset::make("M", { 24, 64, 101, 1, 50, 256, }), |
| 273 | framework::dataset::make("N", { 48, 29, 16, 122, 20, 21, })), |
| 274 | framework::dataset::make("M0", { 4, 8, 7, 2, 1, 8, })), |
| 275 | framework::dataset::make("N0", { 4, 4, 16, 3, 1, 8, })), |
SiCong Li | 3a50166 | 2020-06-26 10:02:06 +0100 | [diff] [blame] | 276 | m_value, n_value, m0_value, n0_value) |
| 277 | { |
| 278 | bool status = validate_zero_padding(m_value, n_value, 23, 1, m0_value, n0_value, 4, false, DataType::F32, ActivationLayerInfo()); |
| 279 | ARM_COMPUTE_EXPECT(status, framework::LogLevel::ERRORS); |
| 280 | } |
| 281 | |
SiCong Li | b972ae6 | 2020-08-03 15:39:45 +0100 | [diff] [blame^] | 282 | FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingPartialInXPartialInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL, |
| 283 | combine(combine( |
| 284 | framework::dataset::make("M", 3), |
| 285 | framework::dataset::make("N", 1)), |
| 286 | boundary_handling_cases)) |
| 287 | { |
| 288 | // Validate output |
| 289 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 290 | } |
| 291 | |
| 292 | FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingPartialInXFullInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL, |
| 293 | combine(combine( |
| 294 | framework::dataset::make("M", 64), |
| 295 | framework::dataset::make("N", 51)), |
| 296 | boundary_handling_cases)) |
| 297 | { |
| 298 | // Validate output |
| 299 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 300 | } |
| 301 | |
| 302 | FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingFullInXFullInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL, |
| 303 | combine(combine( |
| 304 | framework::dataset::make("M", 64), |
| 305 | framework::dataset::make("N", 32)), |
| 306 | boundary_handling_cases)) |
| 307 | { |
| 308 | // Validate output |
| 309 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 310 | } |
| 311 | |
| 312 | FIXTURE_DATA_TEST_CASE(RunSmallBoundaryHandlingFullInXPartialInY, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL, |
| 313 | combine(combine( |
| 314 | framework::dataset::make("M", 37), |
| 315 | framework::dataset::make("N", 32)), |
| 316 | boundary_handling_cases)) |
| 317 | { |
| 318 | // Validate output |
| 319 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 320 | } |
| 321 | |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 322 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::ALL, |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 323 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 324 | m_values, |
| 325 | n_values), |
| 326 | k_values), |
| 327 | b_values), |
| 328 | m0_values_precommit), |
| 329 | n0_values_precommit), |
| 330 | k0_values_precommit), |
| 331 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 332 | a_values), |
| 333 | beta_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 334 | broadcast_bias_values), |
| 335 | act_values)) |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 336 | { |
| 337 | // Validate output |
| 338 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 339 | } |
| 340 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 341 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyNativeFixture<float>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 342 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 343 | m_values, |
| 344 | n_values), |
| 345 | k_values), |
| 346 | b_values), |
| 347 | m0_values_nightly), |
| 348 | n0_values_nightly), |
| 349 | k0_values_nightly), |
| 350 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 351 | a_values), |
| 352 | beta_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 353 | broadcast_bias_values), |
| 354 | act_values)) |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 355 | { |
| 356 | // Validate output |
| 357 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 358 | } |
| 359 | |
| 360 | FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyNative3DFixture<float>, framework::DatasetMode::ALL, |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 361 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 362 | m_w_values, |
| 363 | m_h_values), |
| 364 | n_values), |
| 365 | k_values), |
| 366 | b_values), |
| 367 | m0_values_precommit), |
| 368 | n0_values_precommit), |
| 369 | k0_values_precommit), |
| 370 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 371 | a_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 372 | beta_values), |
| 373 | act_values)) |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 374 | { |
| 375 | // Validate output |
| 376 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 377 | } |
| 378 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 379 | FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyNative3DFixture<float>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 380 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 381 | m_w_values, |
| 382 | m_h_values), |
| 383 | n_values), |
| 384 | k_values), |
| 385 | b_values), |
| 386 | m0_values_nightly), |
| 387 | n0_values_nightly), |
| 388 | k0_values_nightly), |
| 389 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 944170e | 2019-06-24 14:40:30 +0100 | [diff] [blame] | 390 | a_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 391 | beta_values), |
| 392 | act_values)) |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 393 | { |
| 394 | // Validate output |
| 395 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 396 | } |
| 397 | TEST_SUITE_END() // FP32 |
giuros01 | b3204e7 | 2019-04-01 13:50:22 +0100 | [diff] [blame] | 398 | TEST_SUITE_END() // Float |
| 399 | TEST_SUITE_END() // GEMMMatrixMulipltyNative |
| 400 | TEST_SUITE_END() // CL |
| 401 | } // namespace validation |
| 402 | } // namespace test |
| 403 | } // namespace arm_compute |