Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 1 | /* |
Jakub Sujak | 0d27b2e | 2023-08-24 14:01:20 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2023 Arm Limited. |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +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 | */ |
Gian Marco Iodice | 7026b30 | 2019-06-26 17:18:11 +0100 | [diff] [blame] | 24 | #include "arm_compute/core/KernelDescriptors.h" |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 25 | #include "arm_compute/core/Types.h" |
| 26 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
| 27 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 28 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
Georgios Pinitas | 7891a73 | 2021-08-20 21:39:25 +0100 | [diff] [blame] | 29 | #include "src/gpu/cl/kernels/ClGemmMatrixMultiplyReshapedKernel.h" |
| 30 | #include "src/gpu/cl/kernels/ClGemmReshapeLhsMatrixKernel.h" |
| 31 | #include "src/gpu/cl/kernels/ClGemmReshapeRhsMatrixKernel.h" |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 32 | #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 | |
| 42 | namespace arm_compute |
| 43 | { |
| 44 | namespace test |
| 45 | { |
| 46 | namespace validation |
| 47 | { |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 48 | using namespace arm_compute::misc::shape_calculator; |
Georgios Pinitas | 856f66e | 2021-04-22 21:13:21 +0100 | [diff] [blame] | 49 | using namespace arm_compute::opencl::kernels; |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 50 | |
Georgios Pinitas | 856f66e | 2021-04-22 21:13:21 +0100 | [diff] [blame] | 51 | // Create function for ClGemmReshapeLhsMatrixKernel |
| 52 | using CLGEMMReshapeLHSMatrix = CLSynthetizeOperator<ClGemmReshapeLhsMatrixKernel>; |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 53 | |
Georgios Pinitas | 856f66e | 2021-04-22 21:13:21 +0100 | [diff] [blame] | 54 | // Create function for ClGemmReshapeRhsMatrixKernel |
| 55 | using CLGEMMReshapeRHSMatrix = CLSynthetizeOperator<ClGemmReshapeRhsMatrixKernel>; |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 56 | |
Georgios Pinitas | 856f66e | 2021-04-22 21:13:21 +0100 | [diff] [blame] | 57 | // Create function for ClGemmMatrixMultiplyReshapedKernel |
| 58 | using CLGEMMMatrixMultiplyReshaped = CLSynthetizeOperator<ClGemmMatrixMultiplyReshapedKernel>; |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 59 | |
| 60 | // Fixture for CLGEMMMatrixMultiplyReshaped |
| 61 | template <typename T> |
| 62 | using CLGEMMMatrixMultiplyReshapedFixture = GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>; |
| 63 | |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 64 | // Fixture for CLGEMMMatrixMultiplyReshaped mixed precision |
| 65 | template <typename T> |
| 66 | using CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture = |
| 67 | GEMMMatrixMultiplyReshapedValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>; |
| 68 | |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 69 | // Fixture for CLGEMMMatrixMultiplyReshaped3D |
| 70 | template <typename T> |
| 71 | using CLGEMMMatrixMultiplyReshaped3DFixture = GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped>; |
| 72 | |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 73 | // Fixture for CLGEMMMatrixMultiplyReshaped3D mixed precision |
| 74 | template <typename T> |
| 75 | using CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture = |
| 76 | GEMMMatrixMultiplyReshaped3DValidationFixture<CLTensor, CLAccessor, T, CLGEMMReshapeLHSMatrix, CLGEMMReshapeRHSMatrix, CLGEMMMatrixMultiplyReshaped, true>; |
| 77 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 78 | namespace |
| 79 | { |
| 80 | // *INDENT-OFF* |
| 81 | // clang-format off |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 82 | RelativeTolerance<float> rel_tolerance_f32(0.001f); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 83 | constexpr float abs_tolerance_f32(0.0001f); |
| 84 | |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 85 | RelativeTolerance<float> rel_tolerance_f16_mixed_precision(0.001f); |
| 86 | constexpr float abs_tolerance_f16_mixed_precision(0.01f); |
| 87 | |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 88 | RelativeTolerance<float> rel_tolerance_f16(0.001f); |
| 89 | constexpr float abs_tolerance_f16(0.01f); |
| 90 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 91 | /** M values to test */ |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 92 | const auto m_values = framework::dataset::make("M", 17); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 93 | |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 94 | /** M_W values to test */ |
| 95 | const auto m_w_values = framework::dataset::make("M_W", 5); |
| 96 | |
| 97 | /** M_H values to test */ |
| 98 | const auto m_h_values = framework::dataset::make("M_H", 7); |
| 99 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 100 | /** N values to test */ |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 101 | const auto n_values = framework::dataset::make("N", 21); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 102 | |
| 103 | /** K values to test */ |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 104 | const auto k_values = framework::dataset::make("K", 13); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 105 | |
| 106 | /** Batch size values to test */ |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 107 | const auto b_values = framework::dataset::make("batch_size", 2, 3); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 108 | |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 109 | /** Activation values to test */ |
| 110 | const auto act_values = framework::dataset::make("Activation", |
| 111 | { |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 112 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 8.f, 2.f), |
Gian Marco Iodice | 635013a | 2022-11-03 09:30:56 +0000 | [diff] [blame] | 113 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::ELU), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 114 | }); |
| 115 | |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 116 | /** Alpha values to test - Precommit */ |
| 117 | const auto a_values_precommit = framework::dataset::make("alpha", {-0.75f} ); |
| 118 | |
| 119 | /** Beta values to test - Precommit */ |
| 120 | const auto beta_values_precommit = framework::dataset::make("beta", {-0.35f} ); |
| 121 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 122 | /** M0 values to test - Precommit */ |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 123 | const auto m0_values_precommit = framework::dataset::make("M0", { 4 }); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 124 | |
| 125 | /** N0 values to test - Precommit */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 126 | const auto n0_values_precommit = framework::dataset::make("N0", { 4 }); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 127 | |
| 128 | /** K0 values to test - Precommit */ |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 129 | const auto k0_values_precommit = framework::dataset::make("K0", { 4 }); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 130 | |
| 131 | /** V0 values to test - Precommit */ |
| 132 | const auto v0_values_precommit = framework::dataset::make("V0", 1, 3); |
| 133 | |
| 134 | /** H0 values to test - Precommit */ |
| 135 | const auto h0_values_precommit = framework::dataset::make("H0", 1, 3); |
| 136 | |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 137 | /** Alpha values to test - Nightly */ |
| 138 | const auto a_values_nightly = framework::dataset::make("alpha", {1.0f} ); |
| 139 | |
| 140 | /** Beta values to test - Nightly */ |
| 141 | const auto beta_values_nightly = framework::dataset::make("beta", {1.0f} ); |
| 142 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 143 | /** M0 values to test - Nightly */ |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 144 | const auto m0_values_nightly = framework::dataset::make("M0", { 8 }); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 145 | |
| 146 | /** N0 values to test - Nightly */ |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 147 | const auto n0_values_nightly = framework::dataset::make("N0", { 8 }); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 148 | |
| 149 | /** K0 values to test - Nightly */ |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 150 | const auto k0_values_nightly = framework::dataset::make("K0", { 4 }); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 151 | |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 152 | /** N0 values to test with export to OpenCL image object - Nightly */ |
| 153 | const auto n0_export_to_cl_image_values_nightly = framework::dataset::make("N0", { 4, 8, 16 }); |
| 154 | |
| 155 | /** K0 values to test with export to OpenCL image object - Nightly */ |
| 156 | const auto k0_export_to_cl_image_values_nightly = framework::dataset::make("K0", { 4, 8, 16 }); |
| 157 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 158 | /** V0 values to test - Nightly */ |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 159 | const auto v0_values_nightly = framework::dataset::make("V0", 1, 3); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 160 | |
| 161 | /** H0 values to test - Nightly */ |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 162 | const auto h0_values_nightly = framework::dataset::make("H0", 1, 3); |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 163 | |
| 164 | /** Interleave values to test with LHS matrix */ |
| 165 | const auto i_values_lhs = framework::dataset::make("interleave_lhs", { true, false }); |
| 166 | |
| 167 | /** Interleave values to test with RHS matrix */ |
| 168 | const auto i_values_rhs = framework::dataset::make("interleave_rhs", { true, false }); |
| 169 | |
Gian Marco Iodice | e16c890 | 2019-06-14 16:11:10 +0100 | [diff] [blame] | 170 | /** Broadcast bias from vector to matrix */ |
Gian Marco Iodice | d820db6 | 2019-08-05 14:23:23 +0100 | [diff] [blame] | 171 | const auto broadcast_bias_values = framework::dataset::make("broadcast_bias", { false, true } ); |
Gian Marco Iodice | e16c890 | 2019-06-14 16:11:10 +0100 | [diff] [blame] | 172 | |
Giorgio Arena | ae99b6e | 2019-08-01 14:22:12 +0100 | [diff] [blame] | 173 | /** LHS transposed values */ |
| 174 | const auto lhs_transpose_values = framework::dataset::make("lhs_transpose", { false, true } ); |
Gian Marco Iodice | 088d63a | 2020-08-11 14:14:06 +0100 | [diff] [blame] | 175 | |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 176 | } // namespace |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 177 | |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 178 | TEST_SUITE(CL) |
| 179 | TEST_SUITE(GEMMMatrixMultiplyReshaped) |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 180 | |
| 181 | // *INDENT-OFF* |
| 182 | // clang-format off |
| 183 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( |
| 184 | framework::dataset::make("Input0Info", { TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // OK |
| 185 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK |
| 186 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8), // Data type not supported |
| 187 | TensorInfo(TensorShape(10U, 5U, 2U), 1, DataType::F32), // Incorrect dimension bias |
| 188 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F32), // Mismatching shapes |
| 189 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, do not broadcast bias |
| 190 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, wider accummulation |
| 191 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::F16), // OK, RHS 4,4,2 |
| 192 | |
| 193 | }), |
| 194 | framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32), |
| 195 | TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16), |
| 196 | TensorInfo(TensorShape(64U, 5U, 2U), 1, DataType::QASYMM8), |
| 197 | TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F32), |
| 198 | TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), |
| 199 | TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16), |
| 200 | TensorInfo(TensorShape(64U, 6U, 2U), 1, DataType::F16), |
| 201 | TensorInfo(TensorShape(128U, 3U, 2U), 1, DataType::F16), |
| 202 | |
| 203 | })), |
| 204 | framework::dataset::make("Input2Info", { TensorInfo(TensorShape(21U), 1, DataType::F32), |
| 205 | TensorInfo(TensorShape(21U), 1, DataType::F16), |
| 206 | TensorInfo(TensorShape(21U), 1, DataType::QASYMM8), |
| 207 | TensorInfo(TensorShape(21U), 1, DataType::F32), |
| 208 | TensorInfo(TensorShape(21U), 1, DataType::F32), |
| 209 | TensorInfo(TensorShape(21U,17U), 1, DataType::F16), |
| 210 | TensorInfo(TensorShape(21U,17U), 1, DataType::F16), |
| 211 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16), |
| 212 | |
| 213 | })), |
| 214 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32), |
| 215 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16), |
| 216 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::QASYMM8), |
| 217 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32), |
| 218 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F32), |
| 219 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16), |
| 220 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16), |
| 221 | TensorInfo(TensorShape(21U,17U,2U), 1, DataType::F16), |
| 222 | |
| 223 | })), |
| 224 | framework::dataset::make("LHSMInfo",{ |
| 225 | GEMMLHSMatrixInfo(4,4,1,false,true), |
| 226 | GEMMLHSMatrixInfo(4,4,1,false,true), |
| 227 | GEMMLHSMatrixInfo(4,4,1,false,true), |
| 228 | GEMMLHSMatrixInfo(4,2,4,false,false), |
| 229 | GEMMLHSMatrixInfo(4,2,4,false,false), |
| 230 | GEMMLHSMatrixInfo(4,4,1,false,true), |
| 231 | GEMMLHSMatrixInfo(4,4,1,false,true), |
| 232 | GEMMLHSMatrixInfo(4,4,1,false,true), |
| 233 | |
| 234 | })), |
| 235 | framework::dataset::make("RHSMInfo",{ |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 236 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
| 237 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
| 238 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
| 239 | GEMMRHSMatrixInfo(2,2,1,true,false,false), |
| 240 | GEMMRHSMatrixInfo(2,2,1,true,false,false), |
| 241 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
| 242 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
| 243 | GEMMRHSMatrixInfo(4,4,2,true,false,false), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 244 | |
| 245 | |
| 246 | })), |
| 247 | |
| 248 | |
| 249 | framework::dataset::make("GEMMInfo",{ |
| 250 | GEMMKernelInfo( 17 /**<M Number of LHS rows*/, |
| 251 | 21 /**<N Number of RHS columns*/, |
| 252 | 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 253 | false /**< reinterpret the input as 3D */, |
| 254 | true /**< Flag used to broadcast the bias addition */, |
| 255 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 256 | false /**< has pad y */, |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 257 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 258 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 259 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 260 | GEMMLHSMatrixInfo(4,4,1,false,true), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 261 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 262 | 0 /**< Offset to be added to each element of the matrix A */, |
| 263 | 0 /**< Offset to be added to each element of the matrix B */), |
| 264 | |
| 265 | GEMMKernelInfo( 17 /**<M Number of LHS rows*/, |
| 266 | 21 /**<N Number of RHS columns*/, |
| 267 | 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 268 | false /**< reinterpret the input as 3D */, |
| 269 | true /**< Flag used to broadcast the bias addition */, |
| 270 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 271 | false /**< has pad y */, |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 272 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 273 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 274 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 275 | GEMMLHSMatrixInfo(4,4,1,false,true), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 276 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 277 | 0 /**< Offset to be added to each element of the matrix A */, |
| 278 | 0 /**< Offset to be added to each element of the matrix B */), |
| 279 | GEMMKernelInfo(), |
| 280 | GEMMKernelInfo(), |
| 281 | GEMMKernelInfo(), |
| 282 | |
| 283 | GEMMKernelInfo( 17 /**<M Number of LHS rows*/, |
| 284 | 21 /**<N Number of RHS columns*/, |
| 285 | 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 286 | false /**< reinterpret the input as 3D */, |
| 287 | false /**< Flag used to broadcast the bias addition */, |
| 288 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 289 | false /**< has pad y */, |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 290 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 291 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 292 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 293 | GEMMLHSMatrixInfo(4,4,1,false,true), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 294 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 295 | 0 /**< Offset to be added to each element of the matrix A */, |
| 296 | 0 /**< Offset to be added to each element of the matrix B */), |
| 297 | |
| 298 | |
| 299 | GEMMKernelInfo( 17 /**<M Number of LHS rows*/, |
| 300 | 21 /**<N Number of RHS columns*/, |
| 301 | 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 302 | false /**< reinterpret the input as 3D */, |
| 303 | false /**< Flag used to broadcast the bias addition */, |
| 304 | true /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 305 | true /**< has pad y */, |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 306 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 307 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 308 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 309 | GEMMLHSMatrixInfo(4,4,1,false,true), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 310 | GEMMRHSMatrixInfo(4,4,1,true,true,false), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 311 | 0 /**< Offset to be added to each element of the matrix A */, |
| 312 | 0 /**< Offset to be added to each element of the matrix B */), |
| 313 | |
| 314 | GEMMKernelInfo( 17 /**<M Number of LHS rows*/, |
| 315 | 21 /**<N Number of RHS columns*/, |
| 316 | 13 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 317 | false /**< reinterpret the input as 3D */, |
| 318 | false /**< Flag used to broadcast the bias addition */, |
| 319 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 320 | false /**< has pad y */, |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 321 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 322 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 323 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 324 | GEMMLHSMatrixInfo(4,4,1,false,true), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 325 | GEMMRHSMatrixInfo(4,4,2,true,false,false), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 326 | 0 /**< Offset to be added to each element of the matrix A */, |
| 327 | 0 /**< Offset to be added to each element of the matrix B */), |
| 328 | })), |
| 329 | framework::dataset::make("Expected", { true, true, false, false, false, true, true,true})), |
| 330 | input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected) |
| 331 | { |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 332 | ARM_COMPUTE_EXPECT(bool(ClGemmMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true), |
morgolock | aba2f91 | 2020-05-05 16:28:19 +0100 | [diff] [blame] | 333 | &input1_info.clone()->set_is_resizable(true), |
| 334 | &input2_info.clone()->set_is_resizable(true), |
| 335 | &output_info.clone()->set_is_resizable(true),1.f,1.f, |
| 336 | lhs_info, |
| 337 | rhs_info, |
| 338 | gemm_info)) == expected, framework::LogLevel::ERRORS); |
| 339 | } |
SiCongLi | eb8bd81 | 2021-10-29 15:05:49 +0100 | [diff] [blame] | 340 | |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 341 | TEST_SUITE(Float) |
| 342 | TEST_SUITE(FP32) |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 343 | |
| 344 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 345 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 346 | m_values, |
| 347 | n_values), |
| 348 | k_values), |
| 349 | b_values), |
| 350 | m0_values_precommit), |
| 351 | n0_values_precommit), |
| 352 | k0_values_precommit), |
| 353 | v0_values_precommit), |
| 354 | h0_values_precommit), |
| 355 | i_values_lhs), |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 356 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 357 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 358 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 359 | a_values_precommit), |
| 360 | beta_values_precommit), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 361 | broadcast_bias_values), |
Giorgio Arena | ae99b6e | 2019-08-01 14:22:12 +0100 | [diff] [blame] | 362 | lhs_transpose_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 363 | act_values)) |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 364 | { |
| 365 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 366 | if(validate_result) |
| 367 | { |
| 368 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 369 | } |
| 370 | else |
| 371 | { |
| 372 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 373 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 374 | } |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 375 | } |
| 376 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 377 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 378 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 379 | m_values, |
| 380 | n_values), |
| 381 | k_values), |
| 382 | b_values), |
| 383 | m0_values_nightly), |
| 384 | n0_values_nightly), |
| 385 | k0_values_nightly), |
| 386 | v0_values_nightly), |
| 387 | h0_values_nightly), |
| 388 | i_values_lhs), |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 389 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 390 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 391 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 392 | a_values_nightly), |
| 393 | beta_values_nightly), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 394 | broadcast_bias_values), |
Giorgio Arena | ae99b6e | 2019-08-01 14:22:12 +0100 | [diff] [blame] | 395 | lhs_transpose_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 396 | act_values)) |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 397 | { |
| 398 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 399 | if(validate_result) |
| 400 | { |
| 401 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 402 | } |
| 403 | else |
| 404 | { |
| 405 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 406 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 407 | } |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 408 | } |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 409 | |
| 410 | FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 411 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 412 | m_w_values, |
| 413 | m_h_values), |
| 414 | n_values), |
| 415 | k_values), |
| 416 | b_values), |
| 417 | m0_values_precommit), |
| 418 | n0_values_precommit), |
| 419 | k0_values_precommit), |
| 420 | v0_values_precommit), |
| 421 | h0_values_precommit), |
| 422 | i_values_lhs), |
| 423 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 424 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 425 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 426 | a_values_precommit), |
| 427 | beta_values_precommit), |
Giorgio Arena | ae99b6e | 2019-08-01 14:22:12 +0100 | [diff] [blame] | 428 | lhs_transpose_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 429 | act_values)) |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 430 | { |
| 431 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 432 | if(validate_result) |
| 433 | { |
| 434 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 435 | } |
| 436 | else |
| 437 | { |
| 438 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 439 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 440 | } |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 441 | } |
| 442 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 443 | FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 444 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 445 | m_w_values, |
| 446 | m_h_values), |
| 447 | n_values), |
| 448 | k_values), |
| 449 | b_values), |
| 450 | m0_values_nightly), |
| 451 | n0_values_nightly), |
| 452 | k0_values_nightly), |
| 453 | v0_values_nightly), |
| 454 | h0_values_nightly), |
| 455 | i_values_lhs), |
| 456 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 457 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 458 | framework::dataset::make("DataType", DataType::F32)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 459 | a_values_nightly), |
| 460 | beta_values_nightly), |
Giorgio Arena | ae99b6e | 2019-08-01 14:22:12 +0100 | [diff] [blame] | 461 | lhs_transpose_values), |
Gian Marco Iodice | ca1f460 | 2019-07-16 15:46:48 +0100 | [diff] [blame] | 462 | act_values)) |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 463 | { |
| 464 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 465 | if(validate_result) |
| 466 | { |
| 467 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 468 | } |
| 469 | else |
| 470 | { |
| 471 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 472 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 473 | } |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 474 | } |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 475 | |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 476 | TEST_SUITE(ExportToCLImage) |
| 477 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( |
| 478 | framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported |
| 479 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported |
| 480 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // OK or incorrect if cl_khr_image2d_from_buffer not supported |
| 481 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect k0 |
| 482 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), // Incorrect n0 |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 483 | |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 484 | }), |
| 485 | framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), |
| 486 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), |
| 487 | TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F32), |
| 488 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F32), |
| 489 | TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F32), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 490 | |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 491 | })), |
| 492 | framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F32), |
| 493 | TensorInfo(TensorShape(64U), 1, DataType::F32), |
| 494 | TensorInfo(TensorShape(64U), 1, DataType::F32), |
| 495 | TensorInfo(TensorShape(64U), 1, DataType::F32), |
| 496 | TensorInfo(TensorShape(64U), 1, DataType::F32), |
| 497 | |
| 498 | })), |
| 499 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32), |
| 500 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32), |
| 501 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32), |
| 502 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32), |
| 503 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32), |
| 504 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F32), |
| 505 | |
| 506 | })), |
| 507 | framework::dataset::make("LHSMInfo",{ |
| 508 | GEMMLHSMatrixInfo(4, 4, 1, false, true), |
| 509 | GEMMLHSMatrixInfo(4, 8, 1, false, true), |
| 510 | GEMMLHSMatrixInfo(4, 4, 1, false, true), |
| 511 | GEMMLHSMatrixInfo(4, 2, 1, false, false), |
| 512 | GEMMLHSMatrixInfo(4, 4, 1, false, false), |
| 513 | |
| 514 | })), |
| 515 | framework::dataset::make("RHSMInfo",{ |
| 516 | GEMMRHSMatrixInfo(4, 4, 1, true, true, true), |
| 517 | GEMMRHSMatrixInfo(4, 8, 1, true, true, true), |
| 518 | GEMMRHSMatrixInfo(8, 4, 1, true, true, true), |
| 519 | GEMMRHSMatrixInfo(4, 2, 1, true, false, true), |
| 520 | GEMMRHSMatrixInfo(2, 4, 1, true, false, true), |
| 521 | })), |
| 522 | framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 523 | 64 /**<N Number of RHS columns*/, |
| 524 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 525 | false /**< reinterpret the input as 3D */, |
| 526 | true /**< Flag used to broadcast the bias addition */, |
| 527 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 528 | false /**< has pad y */, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 529 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 530 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 531 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 532 | GEMMLHSMatrixInfo(), |
| 533 | GEMMRHSMatrixInfo(), |
| 534 | 0 /**< Offset to be added to each element of the matrix A */, |
| 535 | 0 /**< Offset to be added to each element of the matrix B */), |
| 536 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 537 | 64 /**<N Number of RHS columns*/, |
| 538 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 539 | false /**< reinterpret the input as 3D */, |
| 540 | true /**< Flag used to broadcast the bias addition */, |
| 541 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 542 | false /**< has pad y */, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 543 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 544 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 545 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 546 | GEMMLHSMatrixInfo(), |
| 547 | GEMMRHSMatrixInfo(), |
| 548 | 0 /**< Offset to be added to each element of the matrix A */, |
| 549 | 0 /**< Offset to be added to each element of the matrix B */), |
| 550 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 551 | 64 /**<N Number of RHS columns*/, |
| 552 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 553 | false /**< reinterpret the input as 3D */, |
| 554 | true /**< Flag used to broadcast the bias addition */, |
| 555 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 556 | false /**< has pad y */, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 557 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 558 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 559 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 560 | GEMMLHSMatrixInfo(), |
| 561 | GEMMRHSMatrixInfo(), |
| 562 | 0 /**< Offset to be added to each element of the matrix A */, |
| 563 | 0 /**< Offset to be added to each element of the matrix B */), |
| 564 | |
| 565 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 566 | 64 /**<N Number of RHS columns*/, |
| 567 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 568 | false /**< reinterpret the input as 3D */, |
| 569 | true /**< Flag used to broadcast the bias addition */, |
| 570 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 571 | false /**< has pad y */, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 572 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 573 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 574 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 575 | GEMMLHSMatrixInfo(), |
| 576 | GEMMRHSMatrixInfo(), |
| 577 | 0 /**< Offset to be added to each element of the matrix A */, |
| 578 | 0 /**< Offset to be added to each element of the matrix B */), |
| 579 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 580 | 64 /**<N Number of RHS columns*/, |
| 581 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 582 | false /**< reinterpret the input as 3D */, |
| 583 | true /**< Flag used to broadcast the bias addition */, |
| 584 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 585 | false /**< has pad y */, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 586 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 587 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 588 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 589 | GEMMLHSMatrixInfo(), |
| 590 | GEMMRHSMatrixInfo(), |
| 591 | 0 /**< Offset to be added to each element of the matrix A */, |
| 592 | 0 /**< Offset to be added to each element of the matrix B */) |
| 593 | })), |
| 594 | framework::dataset::make("Expected", { true, |
| 595 | true, |
| 596 | true, |
| 597 | false, |
Gian Marco Iodice | 047e5d0 | 2022-08-25 15:14:23 +0100 | [diff] [blame] | 598 | true})), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 599 | input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected) |
| 600 | { |
Georgios Pinitas | 856f66e | 2021-04-22 21:13:21 +0100 | [diff] [blame] | 601 | ARM_COMPUTE_EXPECT(bool(ClGemmMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 602 | &input1_info.clone()->set_is_resizable(true), |
| 603 | &input2_info.clone()->set_is_resizable(true), |
| 604 | &output_info.clone()->set_is_resizable(true),1.f,1.f, |
| 605 | lhs_info, |
| 606 | rhs_info, |
| 607 | gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS); |
| 608 | } |
| 609 | |
| 610 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::ALL, |
| 611 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 612 | m_values, |
| 613 | n_values), |
| 614 | k_values), |
| 615 | b_values), |
| 616 | m0_values_precommit), |
| 617 | n0_values_precommit), |
| 618 | k0_values_precommit), |
| 619 | v0_values_precommit), |
| 620 | h0_values_precommit), |
| 621 | i_values_lhs), |
| 622 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 623 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 624 | framework::dataset::make("DataType", DataType::F32)), |
| 625 | a_values_precommit), |
| 626 | beta_values_precommit), |
| 627 | broadcast_bias_values), |
| 628 | lhs_transpose_values), |
| 629 | act_values)) |
| 630 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 631 | // Validate output only if validate() is successful |
| 632 | if(validate_result) |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 633 | { |
| 634 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 635 | } |
| 636 | else |
| 637 | { |
| 638 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 639 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 640 | } |
| 641 | |
| 642 | } |
| 643 | |
| 644 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<float>, framework::DatasetMode::NIGHTLY, |
| 645 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 646 | m_values, |
| 647 | n_values), |
| 648 | k_values), |
| 649 | b_values), |
| 650 | m0_values_nightly), |
| 651 | n0_export_to_cl_image_values_nightly), |
| 652 | k0_export_to_cl_image_values_nightly), |
| 653 | v0_values_nightly), |
| 654 | h0_values_nightly), |
| 655 | i_values_lhs), |
| 656 | i_values_rhs), |
| 657 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 658 | framework::dataset::make("DataType", DataType::F32)), |
| 659 | a_values_nightly), |
| 660 | beta_values_nightly), |
| 661 | broadcast_bias_values), |
| 662 | lhs_transpose_values), |
| 663 | act_values)) |
| 664 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 665 | // Validate output only if validate() is successful |
| 666 | if(validate_result) |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 667 | { |
| 668 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 669 | } |
| 670 | else |
| 671 | { |
| 672 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 673 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::ALL, |
| 678 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 679 | m_w_values, |
| 680 | m_h_values), |
| 681 | n_values), |
| 682 | k_values), |
| 683 | b_values), |
| 684 | m0_values_precommit), |
| 685 | n0_values_precommit), |
| 686 | k0_values_precommit), |
| 687 | v0_values_precommit), |
| 688 | h0_values_precommit), |
| 689 | i_values_lhs), |
| 690 | i_values_rhs), |
| 691 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 692 | framework::dataset::make("DataType", DataType::F32)), |
| 693 | a_values_precommit), |
| 694 | beta_values_precommit), |
| 695 | lhs_transpose_values), |
| 696 | act_values)) |
| 697 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 698 | // Validate output only if validate() is successful |
| 699 | if(validate_result) |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 700 | { |
| 701 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 702 | } |
| 703 | else |
| 704 | { |
| 705 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 706 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<float>, framework::DatasetMode::NIGHTLY, |
| 711 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 712 | m_w_values, |
| 713 | m_h_values), |
| 714 | n_values), |
| 715 | k_values), |
| 716 | b_values), |
| 717 | m0_values_nightly), |
| 718 | n0_export_to_cl_image_values_nightly), |
| 719 | k0_export_to_cl_image_values_nightly), |
| 720 | v0_values_nightly), |
| 721 | h0_values_nightly), |
| 722 | i_values_lhs), |
| 723 | i_values_rhs), |
| 724 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 725 | framework::dataset::make("DataType", DataType::F32)), |
| 726 | a_values_nightly), |
| 727 | beta_values_nightly), |
| 728 | lhs_transpose_values), |
| 729 | act_values)) |
| 730 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 731 | // Validate output only if validate() is successful |
| 732 | if(validate_result) |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 733 | { |
| 734 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 735 | } |
| 736 | else |
| 737 | { |
| 738 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 739 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 740 | } |
| 741 | } |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 742 | |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 743 | TEST_SUITE_END() // ExportToCLImage |
| 744 | TEST_SUITE_END() // FP32 |
| 745 | |
| 746 | TEST_SUITE(FP16) |
| 747 | |
| 748 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL, |
| 749 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 750 | m_values, |
| 751 | n_values), |
| 752 | k_values), |
| 753 | b_values), |
| 754 | m0_values_precommit), |
| 755 | n0_values_precommit), |
| 756 | k0_values_precommit), |
| 757 | v0_values_precommit), |
| 758 | h0_values_precommit), |
| 759 | i_values_lhs), |
| 760 | i_values_rhs), |
| 761 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 762 | framework::dataset::make("DataType", DataType::F16)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 763 | a_values_precommit), |
| 764 | beta_values_precommit), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 765 | broadcast_bias_values), |
| 766 | lhs_transpose_values), |
| 767 | act_values)) |
| 768 | { |
| 769 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 770 | if(validate_result) |
| 771 | { |
| 772 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 773 | } |
| 774 | else |
| 775 | { |
| 776 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 777 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 778 | } |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 779 | } |
| 780 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 781 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 782 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 783 | m_values, |
| 784 | n_values), |
| 785 | k_values), |
| 786 | b_values), |
| 787 | m0_values_nightly), |
| 788 | n0_values_nightly), |
| 789 | k0_values_nightly), |
| 790 | v0_values_nightly), |
| 791 | h0_values_nightly), |
| 792 | i_values_lhs), |
| 793 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 794 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 795 | framework::dataset::make("DataType", DataType::F16)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 796 | a_values_nightly), |
| 797 | beta_values_nightly), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 798 | broadcast_bias_values), |
| 799 | lhs_transpose_values), |
| 800 | act_values)) |
| 801 | { |
| 802 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 803 | if(validate_result) |
| 804 | { |
| 805 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 806 | } |
| 807 | else |
| 808 | { |
| 809 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 810 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 811 | } |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 812 | } |
| 813 | |
| 814 | FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 815 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 816 | m_w_values, |
| 817 | m_h_values), |
| 818 | n_values), |
| 819 | k_values), |
| 820 | b_values), |
| 821 | m0_values_precommit), |
| 822 | n0_values_precommit), |
| 823 | k0_values_precommit), |
| 824 | v0_values_precommit), |
| 825 | h0_values_precommit), |
| 826 | i_values_lhs), |
| 827 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 828 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 829 | framework::dataset::make("DataType", DataType::F16)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 830 | a_values_precommit), |
| 831 | beta_values_precommit), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 832 | lhs_transpose_values), |
| 833 | act_values)) |
| 834 | { |
| 835 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 836 | if(validate_result) |
| 837 | { |
| 838 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 839 | } |
| 840 | else |
| 841 | { |
| 842 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 843 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 844 | } |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 845 | } |
| 846 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 847 | FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 848 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 849 | m_w_values, |
| 850 | m_h_values), |
| 851 | n_values), |
| 852 | k_values), |
| 853 | b_values), |
| 854 | m0_values_nightly), |
| 855 | n0_values_nightly), |
| 856 | k0_values_nightly), |
| 857 | v0_values_nightly), |
| 858 | h0_values_nightly), |
| 859 | i_values_lhs), |
| 860 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 861 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 862 | framework::dataset::make("DataType", DataType::F16)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 863 | a_values_nightly), |
| 864 | beta_values_nightly), |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 865 | lhs_transpose_values), |
| 866 | act_values)) |
| 867 | { |
| 868 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 869 | if(validate_result) |
| 870 | { |
| 871 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 872 | } |
| 873 | else |
| 874 | { |
| 875 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 876 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 877 | } |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 878 | } |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 879 | |
| 880 | TEST_SUITE(ExportToCLImage) |
| 881 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( |
| 882 | framework::dataset::make("Input0Info", { TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported |
| 883 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported |
| 884 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // OK or incorrect if cl_khr_image2d_from_buffer not supported |
| 885 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // Incorrect k0 |
| 886 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), // Incorrect n0 |
| 887 | |
| 888 | }), |
| 889 | framework::dataset::make("Input1Info",{ TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), |
| 890 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), |
| 891 | TensorInfo(TensorShape(512U, 8U, 2U), 1, DataType::F16), |
| 892 | TensorInfo(TensorShape(256U, 16U, 2U), 1, DataType::F16), |
| 893 | TensorInfo(TensorShape(128U, 32U, 2U), 1, DataType::F16), |
| 894 | |
| 895 | })), |
| 896 | framework::dataset::make("Input2Info", { TensorInfo(TensorShape(64U), 1, DataType::F16), |
| 897 | TensorInfo(TensorShape(64U), 1, DataType::F16), |
| 898 | TensorInfo(TensorShape(64U), 1, DataType::F16), |
| 899 | TensorInfo(TensorShape(64U), 1, DataType::F16), |
| 900 | TensorInfo(TensorShape(64U), 1, DataType::F16), |
| 901 | |
| 902 | })), |
| 903 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16), |
| 904 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16), |
| 905 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16), |
| 906 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16), |
| 907 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16), |
| 908 | TensorInfo(TensorShape(64U, 64U, 2U), 1, DataType::F16), |
| 909 | |
| 910 | })), |
| 911 | framework::dataset::make("LHSMInfo",{ |
| 912 | GEMMLHSMatrixInfo(4, 4, 1, false, true), |
| 913 | GEMMLHSMatrixInfo(4, 8, 1, false, true), |
| 914 | GEMMLHSMatrixInfo(4, 4, 1, false, true), |
| 915 | GEMMLHSMatrixInfo(4, 2, 1, false, false), |
| 916 | GEMMLHSMatrixInfo(4, 4, 1, false, false), |
| 917 | |
| 918 | })), |
| 919 | framework::dataset::make("RHSMInfo",{ |
| 920 | GEMMRHSMatrixInfo(4, 4, 1, true, true, true), |
| 921 | GEMMRHSMatrixInfo(4, 8, 1, true, true, true), |
| 922 | GEMMRHSMatrixInfo(8, 4, 1, true, true, true), |
| 923 | GEMMRHSMatrixInfo(4, 2, 1, true, false, true), |
| 924 | GEMMRHSMatrixInfo(2, 4, 1, true, false, true), |
| 925 | })), |
| 926 | framework::dataset::make("GEMMInfo",{GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 927 | 64 /**<N Number of RHS columns*/, |
| 928 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 929 | false /**< reinterpret the input as 3D */, |
| 930 | true /**< Flag used to broadcast the bias addition */, |
| 931 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 932 | false /**< has pad y */, |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 933 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 934 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 935 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 936 | GEMMLHSMatrixInfo(), |
| 937 | GEMMRHSMatrixInfo(), |
| 938 | 0 /**< Offset to be added to each element of the matrix A */, |
| 939 | 0 /**< Offset to be added to each element of the matrix B */), |
| 940 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 941 | 64 /**<N Number of RHS columns*/, |
| 942 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 943 | false /**< reinterpret the input as 3D */, |
| 944 | true /**< Flag used to broadcast the bias addition */, |
| 945 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 946 | false /**< has pad y */, |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 947 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 948 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 949 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 950 | GEMMLHSMatrixInfo(), |
| 951 | GEMMRHSMatrixInfo(), |
| 952 | 0 /**< Offset to be added to each element of the matrix A */, |
| 953 | 0 /**< Offset to be added to each element of the matrix B */), |
| 954 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 955 | 64 /**<N Number of RHS columns*/, |
| 956 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 957 | false /**< reinterpret the input as 3D */, |
| 958 | true /**< Flag used to broadcast the bias addition */, |
| 959 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 960 | false /**< has pad y */, |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 961 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 962 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 963 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 964 | GEMMLHSMatrixInfo(), |
| 965 | GEMMRHSMatrixInfo(), |
| 966 | 0 /**< Offset to be added to each element of the matrix A */, |
| 967 | 0 /**< Offset to be added to each element of the matrix B */), |
| 968 | |
| 969 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 970 | 64 /**<N Number of RHS columns*/, |
| 971 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 972 | false /**< reinterpret the input as 3D */, |
| 973 | true /**< Flag used to broadcast the bias addition */, |
| 974 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 975 | false /**< has pad y */, |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 976 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 977 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 978 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 979 | GEMMLHSMatrixInfo(), |
| 980 | GEMMRHSMatrixInfo(), |
| 981 | 0 /**< Offset to be added to each element of the matrix A */, |
| 982 | 0 /**< Offset to be added to each element of the matrix B */), |
| 983 | GEMMKernelInfo( 64 /**<M Number of LHS rows*/, |
| 984 | 64 /**<N Number of RHS columns*/, |
| 985 | 64 /**<K Number of LHS columns or RHS rows */, 0 /**< Depth of the output tensor in case is reinterpreted as 3D */, |
| 986 | false /**< reinterpret the input as 3D */, |
| 987 | true /**< Flag used to broadcast the bias addition */, |
| 988 | false /**< wider accumm */, |
Gian Marco Iodice | 9ae06d4 | 2020-10-22 16:37:12 +0100 | [diff] [blame] | 989 | false /**< has pad y */, |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 990 | ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, |
| 991 | 1 /**< Multiplication factor for the width of the 1xW transposed block */, |
| 992 | 1 /**< Multiplication factor for the height of the 4x4 interleaved block */, |
| 993 | GEMMLHSMatrixInfo(), |
| 994 | GEMMRHSMatrixInfo(), |
| 995 | 0 /**< Offset to be added to each element of the matrix A */, |
| 996 | 0 /**< Offset to be added to each element of the matrix B */) |
| 997 | })), |
| 998 | framework::dataset::make("Expected", { true, |
| 999 | true, |
| 1000 | true, |
| 1001 | false, |
Gian Marco Iodice | 047e5d0 | 2022-08-25 15:14:23 +0100 | [diff] [blame] | 1002 | true})), |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1003 | input0_info ,input1_info, input2_info, output_info, lhs_info, rhs_info, gemm_info, expected) |
| 1004 | { |
Georgios Pinitas | 856f66e | 2021-04-22 21:13:21 +0100 | [diff] [blame] | 1005 | ARM_COMPUTE_EXPECT(bool(ClGemmMatrixMultiplyReshapedKernel::validate(&input0_info.clone()->set_is_resizable(true), |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1006 | &input1_info.clone()->set_is_resizable(true), |
| 1007 | &input2_info.clone()->set_is_resizable(true), |
| 1008 | &output_info.clone()->set_is_resizable(true),1.f,1.f, |
| 1009 | lhs_info, |
| 1010 | rhs_info, |
| 1011 | gemm_info)) == (expected && image2d_from_buffer_supported(CLKernelLibrary::get().get_device())), framework::LogLevel::ERRORS); |
| 1012 | } |
| 1013 | |
| 1014 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::ALL, |
| 1015 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 1016 | m_values, |
| 1017 | n_values), |
| 1018 | k_values), |
| 1019 | b_values), |
| 1020 | m0_values_precommit), |
| 1021 | n0_values_precommit), |
| 1022 | k0_values_precommit), |
| 1023 | v0_values_precommit), |
| 1024 | h0_values_precommit), |
| 1025 | i_values_lhs), |
| 1026 | i_values_rhs), |
| 1027 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 1028 | framework::dataset::make("DataType", DataType::F16)), |
| 1029 | a_values_precommit), |
| 1030 | beta_values_precommit), |
| 1031 | broadcast_bias_values), |
| 1032 | lhs_transpose_values), |
| 1033 | act_values)) |
| 1034 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 1035 | // Validate output only if validate() is successful |
| 1036 | if(validate_result) |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1037 | { |
| 1038 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 1039 | } |
| 1040 | else |
| 1041 | { |
| 1042 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1043 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1044 | } |
| 1045 | |
| 1046 | } |
| 1047 | |
| 1048 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedFixture<half>, framework::DatasetMode::NIGHTLY, |
| 1049 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 1050 | m_values, |
| 1051 | n_values), |
| 1052 | k_values), |
| 1053 | b_values), |
| 1054 | m0_values_nightly), |
| 1055 | n0_export_to_cl_image_values_nightly), |
| 1056 | k0_export_to_cl_image_values_nightly), |
| 1057 | v0_values_nightly), |
| 1058 | h0_values_nightly), |
| 1059 | i_values_lhs), |
| 1060 | i_values_rhs), |
| 1061 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 1062 | framework::dataset::make("DataType", DataType::F16)), |
| 1063 | a_values_nightly), |
| 1064 | beta_values_nightly), |
| 1065 | broadcast_bias_values), |
| 1066 | lhs_transpose_values), |
| 1067 | act_values)) |
| 1068 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 1069 | // Validate output only if validate() is successful |
| 1070 | if(validate_result) |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1071 | { |
| 1072 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 1073 | } |
| 1074 | else |
| 1075 | { |
| 1076 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1077 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1078 | } |
| 1079 | } |
| 1080 | |
| 1081 | FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::ALL, |
| 1082 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 1083 | m_w_values, |
| 1084 | m_h_values), |
| 1085 | n_values), |
| 1086 | k_values), |
| 1087 | b_values), |
| 1088 | m0_values_precommit), |
| 1089 | n0_values_precommit), |
| 1090 | k0_values_precommit), |
| 1091 | v0_values_precommit), |
| 1092 | h0_values_precommit), |
| 1093 | i_values_lhs), |
| 1094 | i_values_rhs), |
| 1095 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 1096 | framework::dataset::make("DataType", DataType::F16)), |
| 1097 | a_values_precommit), |
| 1098 | beta_values_precommit), |
| 1099 | lhs_transpose_values), |
| 1100 | act_values)) |
| 1101 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 1102 | // Validate output only if validate() is successful |
| 1103 | if(validate_result) |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1104 | { |
| 1105 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 1106 | } |
| 1107 | else |
| 1108 | { |
| 1109 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1110 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DFixture<half>, framework::DatasetMode::NIGHTLY, |
| 1115 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 1116 | m_w_values, |
| 1117 | m_h_values), |
| 1118 | n_values), |
| 1119 | k_values), |
| 1120 | b_values), |
| 1121 | m0_values_nightly), |
| 1122 | n0_export_to_cl_image_values_nightly), |
| 1123 | k0_export_to_cl_image_values_nightly), |
| 1124 | v0_values_nightly), |
| 1125 | h0_values_nightly), |
| 1126 | i_values_lhs), |
| 1127 | i_values_rhs), |
| 1128 | framework::dataset::make("export_to_cl_image_rhs", true)), |
| 1129 | framework::dataset::make("DataType", DataType::F16)), |
| 1130 | a_values_nightly), |
| 1131 | beta_values_nightly), |
| 1132 | lhs_transpose_values), |
| 1133 | act_values)) |
| 1134 | { |
Sheri Zhang | cc3e53c | 2020-11-16 21:17:28 +0000 | [diff] [blame] | 1135 | // Validate output only if validate() is successful |
| 1136 | if(validate_result) |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1137 | { |
| 1138 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 1139 | } |
| 1140 | else |
| 1141 | { |
| 1142 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1143 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1144 | } |
| 1145 | } |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 1146 | |
Gian Marco Iodice | 6f93134 | 2020-09-15 14:17:41 +0100 | [diff] [blame] | 1147 | TEST_SUITE_END() // ExportToCLImage |
Gian Marco Iodice | 05639f6 | 2019-09-24 12:05:06 +0100 | [diff] [blame] | 1148 | TEST_SUITE_END() // FP16 |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1149 | |
| 1150 | TEST_SUITE(MixedPrecision) |
| 1151 | |
| 1152 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::ALL, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1153 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1154 | m_values, |
| 1155 | n_values), |
| 1156 | k_values), |
| 1157 | b_values), |
| 1158 | m0_values_precommit), |
| 1159 | n0_values_precommit), |
| 1160 | k0_values_precommit), |
| 1161 | v0_values_precommit), |
| 1162 | h0_values_precommit), |
| 1163 | i_values_lhs), |
| 1164 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1165 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1166 | framework::dataset::make("DataType", DataType::F16)), |
| 1167 | a_values_precommit), |
| 1168 | beta_values_precommit), |
| 1169 | broadcast_bias_values), |
| 1170 | lhs_transpose_values), |
| 1171 | act_values)) |
| 1172 | { |
| 1173 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 1174 | if(validate_result) |
| 1175 | { |
| 1176 | validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision); |
| 1177 | } |
| 1178 | else |
| 1179 | { |
| 1180 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1181 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1182 | } |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1183 | } |
| 1184 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 1185 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMMatrixMultiplyReshapedMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1186 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1187 | m_values, |
| 1188 | n_values), |
| 1189 | k_values), |
| 1190 | b_values), |
| 1191 | m0_values_nightly), |
| 1192 | n0_values_nightly), |
| 1193 | k0_values_nightly), |
| 1194 | v0_values_nightly), |
| 1195 | h0_values_nightly), |
| 1196 | i_values_lhs), |
| 1197 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1198 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1199 | framework::dataset::make("DataType", DataType::F16)), |
| 1200 | a_values_nightly), |
| 1201 | beta_values_nightly), |
| 1202 | broadcast_bias_values), |
| 1203 | lhs_transpose_values), |
| 1204 | act_values)) |
| 1205 | { |
| 1206 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 1207 | if(validate_result) |
| 1208 | { |
| 1209 | validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision); |
| 1210 | } |
| 1211 | else |
| 1212 | { |
| 1213 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1214 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1215 | } |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1216 | } |
| 1217 | |
| 1218 | FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::ALL, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1219 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1220 | m_w_values, |
| 1221 | m_h_values), |
| 1222 | n_values), |
| 1223 | k_values), |
| 1224 | b_values), |
| 1225 | m0_values_precommit), |
| 1226 | n0_values_precommit), |
| 1227 | k0_values_precommit), |
| 1228 | v0_values_precommit), |
| 1229 | h0_values_precommit), |
| 1230 | i_values_lhs), |
| 1231 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1232 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1233 | framework::dataset::make("DataType", DataType::F16)), |
| 1234 | a_values_precommit), |
| 1235 | beta_values_precommit), |
| 1236 | lhs_transpose_values), |
| 1237 | act_values)) |
| 1238 | { |
| 1239 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 1240 | if(validate_result) |
| 1241 | { |
| 1242 | validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision); |
| 1243 | } |
| 1244 | else |
| 1245 | { |
| 1246 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1247 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1248 | } |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1249 | } |
| 1250 | |
Michalis Spyrou | 1d89777 | 2019-12-09 18:47:29 +0000 | [diff] [blame] | 1251 | FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMMatrixMultiplyReshaped3DMixedPrecisionFixture<half>, framework::DatasetMode::DISABLED, |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1252 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1253 | m_w_values, |
| 1254 | m_h_values), |
| 1255 | n_values), |
| 1256 | k_values), |
| 1257 | b_values), |
| 1258 | m0_values_nightly), |
| 1259 | n0_values_nightly), |
| 1260 | k0_values_nightly), |
| 1261 | v0_values_nightly), |
| 1262 | h0_values_nightly), |
| 1263 | i_values_lhs), |
| 1264 | i_values_rhs), |
Gian Marco Iodice | e3a849a | 2020-06-10 17:59:30 +0100 | [diff] [blame] | 1265 | framework::dataset::make("export_to_cl_image_rhs", false)), |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1266 | framework::dataset::make("DataType", DataType::F16)), |
| 1267 | a_values_nightly), |
| 1268 | beta_values_nightly), |
| 1269 | lhs_transpose_values), |
| 1270 | act_values)) |
| 1271 | { |
| 1272 | // Validate output |
Giorgio Arena | a3b13b5 | 2021-11-08 17:52:26 +0000 | [diff] [blame] | 1273 | if(validate_result) |
| 1274 | { |
| 1275 | validate(CLAccessor(_target), _reference, rel_tolerance_f16_mixed_precision, 0.f, abs_tolerance_f16_mixed_precision); |
| 1276 | } |
| 1277 | else |
| 1278 | { |
| 1279 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 1280 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 1281 | } |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1282 | } |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 1283 | |
Gian Marco Iodice | 0c17aa2 | 2019-09-27 09:23:15 +0100 | [diff] [blame] | 1284 | TEST_SUITE_END() // MixedPrecision |
Gian Marco Iodice | 9382ab3 | 2018-12-17 15:12:07 +0000 | [diff] [blame] | 1285 | TEST_SUITE_END() // Float |
Gian Marco Iodice | d1f5476 | 2019-07-19 09:54:47 +0100 | [diff] [blame] | 1286 | TEST_SUITE_END() // GEMMMatrixMultiplyReshaped |
Gian Marco Iodice | bf9731e | 2018-12-12 10:18:04 +0000 | [diff] [blame] | 1287 | TEST_SUITE_END() // CL |
| 1288 | } // namespace validation |
| 1289 | } // namespace test |
Michele Di Giorgio | 2568c6b | 2019-09-17 12:08:46 +0100 | [diff] [blame] | 1290 | } // namespace arm_compute |