Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 1 | /* |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2024 Arm Limited. |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +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/Types.h" |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 25 | #include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h" |
| 26 | #include "arm_compute/runtime/NEON/functions/NEGEMMLowpOutputStage.h" |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 27 | #include "arm_compute/runtime/Tensor.h" |
| 28 | #include "arm_compute/runtime/TensorAllocator.h" |
Manuel Bottini | cfac51c | 2021-06-18 15:47:28 +0100 | [diff] [blame] | 29 | #include "src/core/helpers/MemoryHelpers.h" |
Georgios Pinitas | 7891a73 | 2021-08-20 21:39:25 +0100 | [diff] [blame] | 30 | #include "src/cpu/operators/CpuGemmLowpMatrixMultiplyCore.h" |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 31 | #include "tests/NEON/Accessor.h" |
Gian Marco Iodice | ab18212 | 2017-10-09 15:05:40 +0100 | [diff] [blame] | 32 | #include "tests/NEON/Helper.h" |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 33 | #include "tests/PaddingCalculator.h" |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 34 | #include "tests/datasets/GEMMLowpFusedOffsetOutputDataset.h" |
Gian Marco | fa4cacd | 2017-10-18 17:05:02 +0100 | [diff] [blame] | 35 | #include "tests/datasets/LargeGEMMLowpDataset.h" |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 36 | #include "tests/datasets/ShapeDatasets.h" |
Gian Marco | fa4cacd | 2017-10-18 17:05:02 +0100 | [diff] [blame] | 37 | #include "tests/datasets/SmallGEMMLowpDataset.h" |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 38 | #include "tests/framework/Asserts.h" |
| 39 | #include "tests/framework/Macros.h" |
| 40 | #include "tests/framework/datasets/Datasets.h" |
| 41 | #include "tests/validation/Validation.h" |
| 42 | #include "tests/validation/fixtures/GEMMLowpFixture.h" |
| 43 | |
| 44 | namespace arm_compute |
| 45 | { |
| 46 | namespace test |
| 47 | { |
| 48 | namespace validation |
| 49 | { |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 50 | using framework::dataset::make; |
| 51 | |
| 52 | namespace |
| 53 | { |
| 54 | constexpr AbsoluteTolerance<float> tolerance_batched(1); |
| 55 | constexpr AbsoluteTolerance<float> tolerance_quant(1); |
| 56 | } // namespace |
| 57 | |
| 58 | |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 59 | TEST_SUITE(NEON) |
| 60 | TEST_SUITE(GEMMLowp) |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 61 | TEST_SUITE(MatrixMultiplyCore) |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 62 | |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 63 | using NEGEMMLowpMatrixMultiplyCoreFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>; |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 64 | using NEGEMMLowpMatrixMultiplyCoreAccumulateFixture = GEMMLowpMatrixMultiplyAccumulateValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>; |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 65 | |
morgolock | 4adaddb | 2020-09-29 14:24:32 +0100 | [diff] [blame] | 66 | DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, framework::dataset::concat(datasets::SmallGEMMLowpDataset(), datasets::LargeGEMMLowpDataset()), |
| 67 | shape_a, shape_b, shape_c, a_offset, b_offset) |
| 68 | { |
| 69 | // Create tensors |
| 70 | Tensor a = create_tensor<Tensor>(shape_a, DataType::QASYMM8); |
| 71 | Tensor b = create_tensor<Tensor>(shape_b, DataType::QASYMM8); |
| 72 | Tensor c = create_tensor<Tensor>(shape_c, DataType::S32); |
| 73 | |
| 74 | a.info()->set_quantization_info(QuantizationInfo(1.0f / 255, a_offset)); |
| 75 | b.info()->set_quantization_info(QuantizationInfo(1.0f / 255, b_offset)); |
| 76 | |
| 77 | ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 78 | ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 79 | ARM_COMPUTE_EXPECT(c.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 80 | |
| 81 | // Create and configure function |
| 82 | NEGEMMLowpMatrixMultiplyCore gemmlowp_mm; |
| 83 | gemmlowp_mm.configure(&a, &b, nullptr, &c); |
| 84 | |
| 85 | // Validate padding is zero |
| 86 | validate(a.info()->padding(), PaddingSize()); |
| 87 | validate(b.info()->padding(), PaddingSize()); |
| 88 | validate(c.info()->padding(), PaddingSize()); |
| 89 | } |
| 90 | |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 91 | DATA_TEST_CASE(ValidateAccumulate, framework::DatasetMode::ALL, combine( |
| 92 | zip( |
| 93 | make("In0",{ TensorShape(21U, 1U) }), |
| 94 | make("In1", { TensorShape(1U, 21U) }), |
| 95 | make("Dst", { TensorShape(1U, 1U) }), |
| 96 | make("a_offset", { -2 }), |
| 97 | make("a_offset", { 13 }) |
| 98 | ), |
| 99 | zip( |
| 100 | make("OutputDataType", { DataType::S32, DataType::QASYMM8, DataType::QASYMM8_SIGNED}), |
| 101 | make("Expected", { true, false, false }) |
| 102 | )), |
| 103 | shape_a, shape_b, shape_dst, a_offset, b_offset, output_data_type, expected) |
| 104 | { |
| 105 | DataType input_data_type = (output_data_type == DataType::S32 ? DataType::QASYMM8 : output_data_type); |
| 106 | // Accumulation test for GEMM kernels |
| 107 | TensorInfo a(shape_a, 1, input_data_type, QuantizationInfo(1.0f / 255, a_offset)); |
| 108 | TensorInfo b(shape_b, 1, input_data_type, QuantizationInfo(1.0f / 255, b_offset)); |
| 109 | TensorInfo dst(shape_dst, 1, output_data_type, QuantizationInfo()); |
| 110 | |
| 111 | // Create and configure function |
| 112 | GEMMInfo gemm_info = GEMMInfo(); |
| 113 | gemm_info.set_accumulate(true); |
| 114 | |
| 115 | if (is_data_type_quantized(output_data_type)) |
| 116 | { |
| 117 | GEMMLowpOutputStageInfo gemmLowpOutputStageInfo = GEMMLowpOutputStageInfo(); |
| 118 | gemmLowpOutputStageInfo.type = GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT; |
| 119 | |
| 120 | gemm_info.set_gemmlowp_output_stage(gemmLowpOutputStageInfo); |
| 121 | } |
| 122 | |
| 123 | cpu::CpuGemmLowpMatrixMultiplyCore gemmlowp_mm; |
| 124 | Status status = gemmlowp_mm.validate(&a, &b, nullptr, &dst, gemm_info); |
| 125 | |
| 126 | ARM_COMPUTE_EXPECT((expected == bool(status)), framework::LogLevel::ERRORS); |
| 127 | } |
| 128 | |
Georgios Pinitas | a3b1b46 | 2017-11-16 19:24:39 +0000 | [diff] [blame] | 129 | // *INDENT-OFF* |
| 130 | // clang-format off |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 131 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip( |
| 132 | make("InputAInfo", { TensorInfo(TensorShape(21U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Input not a multiple of 4 |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 133 | TensorInfo(TensorShape(21U, 13U), 1, DataType::S32), // Mismatching data type |
Georgios Pinitas | a3b1b46 | 2017-11-16 19:24:39 +0000 | [diff] [blame] | 134 | TensorInfo(TensorShape(20U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Invalid dimensions |
| 135 | TensorInfo(TensorShape(21U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Invalid dimensions |
| 136 | TensorInfo(TensorShape(16U, 32U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), |
| 137 | }), |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 138 | make("InputBInfo",{ TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)), |
Georgios Pinitas | a3b1b46 | 2017-11-16 19:24:39 +0000 | [diff] [blame] | 139 | TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)), |
| 140 | TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)), |
| 141 | TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)), |
| 142 | TensorInfo(TensorShape(64U, 16U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)), |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 143 | }), |
| 144 | make("OutputInfo",{ TensorInfo(TensorShape(33U, 13U), 1, DataType::S32), |
Georgios Pinitas | a3b1b46 | 2017-11-16 19:24:39 +0000 | [diff] [blame] | 145 | TensorInfo(TensorShape(33U, 13U), 1, DataType::S32), |
| 146 | TensorInfo(TensorShape(33U, 13U), 1, DataType::S32), |
| 147 | TensorInfo(TensorShape(8U, 11U), 1, DataType::S32), |
| 148 | TensorInfo(TensorShape(64U, 32U), 1, DataType::S32), |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 149 | }), |
| 150 | make("Expected", { true, false, false, false, true })), |
Georgios Pinitas | a3b1b46 | 2017-11-16 19:24:39 +0000 | [diff] [blame] | 151 | a_info, b_info, output_info, expected) |
| 152 | { |
| 153 | // Lock tensors |
Georgios Pinitas | 631c41a | 2017-12-06 11:53:03 +0000 | [diff] [blame] | 154 | Status status = NEGEMMLowpMatrixMultiplyCore::validate(&a_info.clone()->set_is_resizable(false), |
| 155 | &b_info.clone()->set_is_resizable(false), |
Gian Marco Iodice | 4b90865 | 2018-10-18 10:21:02 +0100 | [diff] [blame] | 156 | nullptr, |
Georgios Pinitas | 631c41a | 2017-12-06 11:53:03 +0000 | [diff] [blame] | 157 | &output_info.clone()->set_is_resizable(false)); |
| 158 | ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS); |
Georgios Pinitas | a3b1b46 | 2017-11-16 19:24:39 +0000 | [diff] [blame] | 159 | } |
| 160 | // clang-format on |
| 161 | // *INDENT-ON* |
| 162 | |
Manuel Bottini | cfac51c | 2021-06-18 15:47:28 +0100 | [diff] [blame] | 163 | /** Test case for memory injection in @ref cpu::CpuGemmLowpMatrixMultiplyCore. |
| 164 | * |
| 165 | * Configure the operator once and inject memory at run-time in multiple executions. |
| 166 | * |
| 167 | * Checks performed in order: |
| 168 | * - Both runs compute the same output |
| 169 | */ |
| 170 | TEST_CASE(MemoryInjection, framework::DatasetMode::ALL) |
| 171 | { |
| 172 | auto gemm = std::make_unique<cpu::CpuGemmLowpMatrixMultiplyCore>(); |
| 173 | auto a_info = TensorInfo(TensorShape(32U, 72U), 1, DataType::QASYMM8); |
| 174 | auto b_info = TensorInfo(TensorShape(17U, 32U), 1, DataType::QASYMM8); |
| 175 | auto dst_info = TensorInfo(TensorShape(17U, 72U), 1, DataType::S32); |
| 176 | a_info.set_quantization_info(QuantizationInfo(1.0f / 255, -9)); |
| 177 | b_info.set_quantization_info(QuantizationInfo(1.0f / 255, 1)); |
| 178 | const auto gemm_info = GEMMInfo{}; |
| 179 | gemm->configure(&a_info, &b_info, nullptr, &dst_info, gemm_info); |
| 180 | |
| 181 | // telhs are newly created every call of this lambda function |
| 182 | auto a = create_tensor<Tensor>(a_info); |
| 183 | auto b = create_tensor<Tensor>(b_info); |
| 184 | auto dst = create_tensor<Tensor>(dst_info); |
| 185 | a.allocator()->allocate(); |
| 186 | b.allocator()->allocate(); |
| 187 | dst.allocator()->allocate(); |
| 188 | |
| 189 | ITensorPack run_pack = |
| 190 | { |
| 191 | { TensorType::ACL_SRC_0, &a }, |
| 192 | { TensorType::ACL_SRC_1, &b }, |
| 193 | { TensorType::ACL_DST, &dst } |
| 194 | }; |
| 195 | ITensorPack prep_pack = |
| 196 | { |
| 197 | { TensorType::ACL_SRC_1, &b }, |
| 198 | }; |
| 199 | |
| 200 | auto mg = MemoryGroup{}; |
| 201 | auto ws = manage_workspace<Tensor>(gemm->workspace(), mg, run_pack, prep_pack); |
| 202 | |
| 203 | auto run_conv = [&]() -> Tensor |
| 204 | { |
| 205 | auto dst = create_tensor<Tensor>(dst_info); |
| 206 | dst.allocator()->allocate(); |
| 207 | run_pack.add_tensor(TensorType::ACL_DST, &dst); |
| 208 | |
| 209 | library->fill_tensor_value(Accessor(a), static_cast<uint8_t>(1)); |
| 210 | library->fill_tensor_value(Accessor(b), static_cast<uint8_t>(2)); |
| 211 | // This operator is configured once and captured by this lambda. |
| 212 | gemm->prepare(prep_pack); |
| 213 | gemm->run(run_pack); |
| 214 | return dst; |
| 215 | }; |
| 216 | auto result_0 = run_conv(); |
| 217 | auto result_1 = run_conv(); |
| 218 | for(size_t i = 0; i < result_0.info()->tensor_shape().total_size(); ++i) |
| 219 | { |
| 220 | ARM_COMPUTE_EXPECT(((uint8_t *)result_0.buffer())[i] == ((uint8_t *)result_1.buffer())[i], framework::LogLevel::ERRORS); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | /** Test case for memory injection in @ref NEGEMMLowpMatrixMultiplyCore. |
| 225 | * |
| 226 | * Make sure @ref NEGEMMLowpMatrixMultiplyCore still works through injecting the memory at configure time using the old API. |
| 227 | * |
| 228 | * Checks performed in order: |
| 229 | * - Both runs compute the same output |
| 230 | */ |
| 231 | TEST_CASE(MultipleExecutionWithConfigure, framework::DatasetMode::ALL) |
| 232 | { |
| 233 | auto gemm = std::make_unique<NEGEMMLowpMatrixMultiplyCore>(); |
| 234 | auto a_info = TensorInfo(TensorShape(32U, 72U), 1, DataType::QASYMM8); |
| 235 | auto b_info = TensorInfo(TensorShape(17U, 32U), 1, DataType::QASYMM8); |
| 236 | auto dst_info = TensorInfo(TensorShape(17U, 72U), 1, DataType::S32); |
| 237 | a_info.set_quantization_info(QuantizationInfo(1.0f / 255, -9)); |
| 238 | b_info.set_quantization_info(QuantizationInfo(1.0f / 255, 1)); |
| 239 | const auto gemm_info = GEMMInfo{}; |
| 240 | auto run_conv = [&]() |
| 241 | { |
| 242 | auto a = create_tensor<Tensor>(a_info); |
| 243 | auto b = create_tensor<Tensor>(b_info); |
| 244 | auto dst = create_tensor<Tensor>(dst_info); |
| 245 | gemm->configure(&a, &b, nullptr, &dst, gemm_info); |
| 246 | a.allocator()->allocate(); |
| 247 | b.allocator()->allocate(); |
| 248 | dst.allocator()->allocate(); |
| 249 | library->fill_tensor_value(Accessor(a), static_cast<uint8_t>(1)); |
| 250 | library->fill_tensor_value(Accessor(b), static_cast<uint8_t>(2)); |
| 251 | gemm->run(); |
| 252 | return dst; |
| 253 | }; |
| 254 | auto result_0 = run_conv(); |
| 255 | auto result_1 = run_conv(); |
| 256 | for(size_t i = 0; i < result_0.info()->tensor_shape().total_size(); ++i) |
| 257 | { |
| 258 | ARM_COMPUTE_EXPECT(((uint8_t *)result_0.buffer())[i] == ((uint8_t *)result_1.buffer())[i], framework::LogLevel::ERRORS); |
| 259 | } |
| 260 | } |
| 261 | |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 262 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFixture, framework::DatasetMode::ALL, datasets::SmallGEMMLowpDataset()) |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 263 | { |
| 264 | // Validate output |
Gian Marco | fa4cacd | 2017-10-18 17:05:02 +0100 | [diff] [blame] | 265 | validate(Accessor(_target), _reference); |
| 266 | } |
| 267 | |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 268 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpDataset()) |
Gian Marco | fa4cacd | 2017-10-18 17:05:02 +0100 | [diff] [blame] | 269 | { |
| 270 | // Validate output |
| 271 | validate(Accessor(_target), _reference); |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 272 | } |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 273 | |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 274 | TEST_SUITE(BatchedMatMul) |
| 275 | TEST_SUITE(QASYMM8) |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 276 | using NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedUnsigned = |
| 277 | GEMMLowpBatchedMatrixMultiplyCoreFusedOffsetOutputFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore, false, false, uint8_t, uint8_t, true>; |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 278 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedUnsigned, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 279 | combine(datasets::SmallGEMMLowpFusedBatchedMatMulDataset(), |
| 280 | make("DataType", { DataType::QASYMM8 }), |
| 281 | make("reshape_b_only_on_first_run", { false }))) |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 282 | { |
| 283 | validate(Accessor(_target), _reference, tolerance_batched); |
| 284 | } |
| 285 | TEST_SUITE_END() // QASYMM8 |
| 286 | |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 287 | TEST_SUITE(QASYMM8_SIGNED) |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 288 | using NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedSigned = |
| 289 | GEMMLowpBatchedMatrixMultiplyCoreFusedOffsetOutputFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore, false, false, int8_t, int8_t, true>; |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 290 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedSigned, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 291 | combine(datasets::SmallGEMMLowpFusedBatchedMatMulDataset(), |
| 292 | make("DataType", { DataType::QASYMM8_SIGNED }), |
| 293 | make("reshape_b_only_on_first_run", { false }))) |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 294 | { |
| 295 | validate(Accessor(_target), _reference, tolerance_batched); |
| 296 | } |
| 297 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 298 | TEST_SUITE_END() // BatchedMatMul |
| 299 | |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 300 | TEST_SUITE(FusedOffsetOutput) |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 301 | using NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixture = GEMMLowpMatrixMultiplyCoreFusedOffsetOutputValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>; |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 302 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixture, framework::DatasetMode::ALL, |
| 303 | combine(datasets::SmallGEMMLowpFusedOffsetOutputUint8Dataset(), |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 304 | make("DataType", { DataType::QASYMM8 }), |
| 305 | make("reshape_b_only_on_first_run", { false }))) |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 306 | { |
| 307 | // Validate output |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 308 | validate(Accessor(_target), _reference, tolerance_quant); |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 309 | } |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 310 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixture, framework::DatasetMode::NIGHTLY, |
| 311 | combine(datasets::LargeGEMMLowpFusedOffsetOutputUint8Dataset(), |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 312 | make("DataType", { DataType::QASYMM8 }), |
| 313 | make("reshape_b_only_on_first_run", { false }))) |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 314 | { |
| 315 | // Validate output |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 316 | validate(Accessor(_target), _reference, tolerance_quant); |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 317 | } |
| 318 | TEST_SUITE_END() // FusedOffsetOutput |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 319 | |
Radu Salavat | cdce25b | 2024-04-12 12:26:50 +0000 | [diff] [blame^] | 320 | // accumulation is not supported for Int8/UInt8 in aarch32 |
| 321 | #ifdef __aarch64__ |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 322 | TEST_SUITE(ACCUMULATION) |
| 323 | TEST_SUITE(S32) |
| 324 | FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreAccumulateFixture, framework::DatasetMode::ALL, datasets::SmallGEMMLowpDataset()) |
| 325 | { |
| 326 | // Validate output |
| 327 | validate(Accessor(_target), _reference); |
| 328 | } |
| 329 | FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreAccumulateFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpDataset()) |
| 330 | { |
| 331 | // Validate output |
| 332 | validate(Accessor(_target), _reference); |
| 333 | } |
| 334 | TEST_SUITE_END() // S32 |
| 335 | TEST_SUITE_END() // ACCUMULATION |
Radu Salavat | cdce25b | 2024-04-12 12:26:50 +0000 | [diff] [blame^] | 336 | #endif // __arch64__ |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 337 | |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 338 | TEST_SUITE_END() // MatrixMultiplyCore |
Gian Marco | e75a02b | 2017-11-08 12:24:09 +0000 | [diff] [blame] | 339 | TEST_SUITE_END() // GEMMLowp |
Manuel Bottini | ae58bdf | 2021-06-17 17:18:45 +0100 | [diff] [blame] | 340 | TEST_SUITE_END() // NEON |
Pablo Tello | 299025a | 2017-09-29 11:30:12 +0100 | [diff] [blame] | 341 | } // namespace validation |
| 342 | } // namespace test |
| 343 | } // namespace arm_compute |