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