blob: d25f43a3302a60dcc62049e30f329c5b7232fd2b [file] [log] [blame]
Pablo Tello299025a2017-09-29 11:30:12 +01001/*
SiCong Li11ab4512023-11-07 12:04:59 +00002 * Copyright (c) 2017-2024 Arm Limited.
Pablo Tello299025a2017-09-29 11:30:12 +01003 *
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 Marcoe75a02b2017-11-08 12:24:09 +000025#include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h"
26#include "arm_compute/runtime/NEON/functions/NEGEMMLowpOutputStage.h"
Pablo Tello299025a2017-09-29 11:30:12 +010027#include "arm_compute/runtime/Tensor.h"
28#include "arm_compute/runtime/TensorAllocator.h"
Manuel Bottinicfac51c2021-06-18 15:47:28 +010029#include "src/core/helpers/MemoryHelpers.h"
Georgios Pinitas7891a732021-08-20 21:39:25 +010030#include "src/cpu/operators/CpuGemmLowpMatrixMultiplyCore.h"
Pablo Tello299025a2017-09-29 11:30:12 +010031#include "tests/NEON/Accessor.h"
Gian Marco Iodiceab182122017-10-09 15:05:40 +010032#include "tests/NEON/Helper.h"
Gian Marcoe75a02b2017-11-08 12:24:09 +000033#include "tests/PaddingCalculator.h"
George Wort2d7e6832019-02-22 16:37:41 +000034#include "tests/datasets/GEMMLowpFusedOffsetOutputDataset.h"
Gian Marcofa4cacd2017-10-18 17:05:02 +010035#include "tests/datasets/LargeGEMMLowpDataset.h"
Gian Marcoe75a02b2017-11-08 12:24:09 +000036#include "tests/datasets/ShapeDatasets.h"
Gian Marcofa4cacd2017-10-18 17:05:02 +010037#include "tests/datasets/SmallGEMMLowpDataset.h"
Pablo Tello299025a2017-09-29 11:30:12 +010038#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
44namespace arm_compute
45{
46namespace test
47{
48namespace validation
49{
Radu Salavatf1f1f872024-02-27 18:32:26 +000050using framework::dataset::make;
51
52namespace
53{
54 constexpr AbsoluteTolerance<float> tolerance_batched(1);
55 constexpr AbsoluteTolerance<float> tolerance_quant(1);
56} // namespace
57
58
Pablo Tello299025a2017-09-29 11:30:12 +010059TEST_SUITE(NEON)
60TEST_SUITE(GEMMLowp)
Gian Marcoe75a02b2017-11-08 12:24:09 +000061TEST_SUITE(MatrixMultiplyCore)
SiCong Li11ab4512023-11-07 12:04:59 +000062
Gian Marcoe75a02b2017-11-08 12:24:09 +000063using NEGEMMLowpMatrixMultiplyCoreFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>;
Radu Salavatf1f1f872024-02-27 18:32:26 +000064using NEGEMMLowpMatrixMultiplyCoreAccumulateFixture = GEMMLowpMatrixMultiplyAccumulateValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>;
Jonathan Deakina668f9f2024-01-24 09:15:38 +000065using NEGEMMLowpBatchedMatMulFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore, false, false, true>;
66using NEGEMMLowpMatrixMultiplyCoreDynamicQuantizationFixture = GEMMLowpMatrixMultiplyCoreDynamicQuantizationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>;
67using NEGEMMLowpDequantizedMatrixMultiplyValidationFixture = GEMMLowpDequantizedMatrixMultiplyValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>;
68
69using framework::dataset::make;
SiCong Li11ab4512023-11-07 12:04:59 +000070
morgolock4adaddb2020-09-29 14:24:32 +010071DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, framework::dataset::concat(datasets::SmallGEMMLowpDataset(), datasets::LargeGEMMLowpDataset()),
72 shape_a, shape_b, shape_c, a_offset, b_offset)
73{
74 // Create tensors
75 Tensor a = create_tensor<Tensor>(shape_a, DataType::QASYMM8);
76 Tensor b = create_tensor<Tensor>(shape_b, DataType::QASYMM8);
77 Tensor c = create_tensor<Tensor>(shape_c, DataType::S32);
78
79 a.info()->set_quantization_info(QuantizationInfo(1.0f / 255, a_offset));
80 b.info()->set_quantization_info(QuantizationInfo(1.0f / 255, b_offset));
81
82 ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
83 ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
84 ARM_COMPUTE_EXPECT(c.info()->is_resizable(), framework::LogLevel::ERRORS);
85
86 // Create and configure function
87 NEGEMMLowpMatrixMultiplyCore gemmlowp_mm;
88 gemmlowp_mm.configure(&a, &b, nullptr, &c);
89
90 // Validate padding is zero
91 validate(a.info()->padding(), PaddingSize());
92 validate(b.info()->padding(), PaddingSize());
93 validate(c.info()->padding(), PaddingSize());
94}
Radu Salavat34bdffb2024-04-15 09:30:57 +000095// accumulation is not supported for Int8/UInt8 in aarch32
96#ifdef __aarch64__
Radu Salavatf1f1f872024-02-27 18:32:26 +000097DATA_TEST_CASE(ValidateAccumulate, framework::DatasetMode::ALL, combine(
98 zip(
99 make("In0",{ TensorShape(21U, 1U) }),
100 make("In1", { TensorShape(1U, 21U) }),
101 make("Dst", { TensorShape(1U, 1U) }),
102 make("a_offset", { -2 }),
103 make("a_offset", { 13 })
104 ),
105 zip(
106 make("OutputDataType", { DataType::S32, DataType::QASYMM8, DataType::QASYMM8_SIGNED}),
107 make("Expected", { true, false, false })
108 )),
109 shape_a, shape_b, shape_dst, a_offset, b_offset, output_data_type, expected)
110{
111 DataType input_data_type = (output_data_type == DataType::S32 ? DataType::QASYMM8 : output_data_type);
112 // Accumulation test for GEMM kernels
113 TensorInfo a(shape_a, 1, input_data_type, QuantizationInfo(1.0f / 255, a_offset));
114 TensorInfo b(shape_b, 1, input_data_type, QuantizationInfo(1.0f / 255, b_offset));
115 TensorInfo dst(shape_dst, 1, output_data_type, QuantizationInfo());
116
117 // Create and configure function
118 GEMMInfo gemm_info = GEMMInfo();
119 gemm_info.set_accumulate(true);
120
121 if (is_data_type_quantized(output_data_type))
122 {
123 GEMMLowpOutputStageInfo gemmLowpOutputStageInfo = GEMMLowpOutputStageInfo();
124 gemmLowpOutputStageInfo.type = GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT;
125
126 gemm_info.set_gemmlowp_output_stage(gemmLowpOutputStageInfo);
127 }
128
129 cpu::CpuGemmLowpMatrixMultiplyCore gemmlowp_mm;
130 Status status = gemmlowp_mm.validate(&a, &b, nullptr, &dst, gemm_info);
131
132 ARM_COMPUTE_EXPECT((expected == bool(status)), framework::LogLevel::ERRORS);
133}
Radu Salavat34bdffb2024-04-15 09:30:57 +0000134#endif // __arch64__
Radu Salavatf1f1f872024-02-27 18:32:26 +0000135
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000136// *INDENT-OFF*
137// clang-format off
SiCong Li11ab4512023-11-07 12:04:59 +0000138DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(
139 make("InputAInfo", { TensorInfo(TensorShape(21U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Input not a multiple of 4
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100140 TensorInfo(TensorShape(21U, 13U), 1, DataType::S32), // Mismatching data type
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000141 TensorInfo(TensorShape(20U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Invalid dimensions
142 TensorInfo(TensorShape(21U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Invalid dimensions
143 TensorInfo(TensorShape(16U, 32U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)),
144 }),
SiCong Li11ab4512023-11-07 12:04:59 +0000145 make("InputBInfo",{ TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)),
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000146 TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)),
147 TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)),
148 TensorInfo(TensorShape(33U, 21U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)),
149 TensorInfo(TensorShape(64U, 16U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 10)),
SiCong Li11ab4512023-11-07 12:04:59 +0000150 }),
151 make("OutputInfo",{ TensorInfo(TensorShape(33U, 13U), 1, DataType::S32),
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000152 TensorInfo(TensorShape(33U, 13U), 1, DataType::S32),
153 TensorInfo(TensorShape(33U, 13U), 1, DataType::S32),
154 TensorInfo(TensorShape(8U, 11U), 1, DataType::S32),
155 TensorInfo(TensorShape(64U, 32U), 1, DataType::S32),
SiCong Li11ab4512023-11-07 12:04:59 +0000156 }),
157 make("Expected", { true, false, false, false, true })),
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000158 a_info, b_info, output_info, expected)
159{
160 // Lock tensors
Georgios Pinitas631c41a2017-12-06 11:53:03 +0000161 Status status = NEGEMMLowpMatrixMultiplyCore::validate(&a_info.clone()->set_is_resizable(false),
162 &b_info.clone()->set_is_resizable(false),
Gian Marco Iodice4b908652018-10-18 10:21:02 +0100163 nullptr,
Georgios Pinitas631c41a2017-12-06 11:53:03 +0000164 &output_info.clone()->set_is_resizable(false));
165 ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS);
Georgios Pinitasa3b1b462017-11-16 19:24:39 +0000166}
167// clang-format on
168// *INDENT-ON*
169
Manuel Bottinicfac51c2021-06-18 15:47:28 +0100170/** Test case for memory injection in @ref cpu::CpuGemmLowpMatrixMultiplyCore.
171 *
172 * Configure the operator once and inject memory at run-time in multiple executions.
173 *
174 * Checks performed in order:
175 * - Both runs compute the same output
176 */
177TEST_CASE(MemoryInjection, framework::DatasetMode::ALL)
178{
179 auto gemm = std::make_unique<cpu::CpuGemmLowpMatrixMultiplyCore>();
180 auto a_info = TensorInfo(TensorShape(32U, 72U), 1, DataType::QASYMM8);
181 auto b_info = TensorInfo(TensorShape(17U, 32U), 1, DataType::QASYMM8);
182 auto dst_info = TensorInfo(TensorShape(17U, 72U), 1, DataType::S32);
183 a_info.set_quantization_info(QuantizationInfo(1.0f / 255, -9));
184 b_info.set_quantization_info(QuantizationInfo(1.0f / 255, 1));
185 const auto gemm_info = GEMMInfo{};
186 gemm->configure(&a_info, &b_info, nullptr, &dst_info, gemm_info);
187
188 // telhs are newly created every call of this lambda function
189 auto a = create_tensor<Tensor>(a_info);
190 auto b = create_tensor<Tensor>(b_info);
191 auto dst = create_tensor<Tensor>(dst_info);
192 a.allocator()->allocate();
193 b.allocator()->allocate();
194 dst.allocator()->allocate();
195
196 ITensorPack run_pack =
197 {
198 { TensorType::ACL_SRC_0, &a },
199 { TensorType::ACL_SRC_1, &b },
200 { TensorType::ACL_DST, &dst }
201 };
202 ITensorPack prep_pack =
203 {
204 { TensorType::ACL_SRC_1, &b },
205 };
206
207 auto mg = MemoryGroup{};
208 auto ws = manage_workspace<Tensor>(gemm->workspace(), mg, run_pack, prep_pack);
209
210 auto run_conv = [&]() -> Tensor
211 {
212 auto dst = create_tensor<Tensor>(dst_info);
213 dst.allocator()->allocate();
214 run_pack.add_tensor(TensorType::ACL_DST, &dst);
215
216 library->fill_tensor_value(Accessor(a), static_cast<uint8_t>(1));
217 library->fill_tensor_value(Accessor(b), static_cast<uint8_t>(2));
218 // This operator is configured once and captured by this lambda.
219 gemm->prepare(prep_pack);
220 gemm->run(run_pack);
221 return dst;
222 };
223 auto result_0 = run_conv();
224 auto result_1 = run_conv();
225 for(size_t i = 0; i < result_0.info()->tensor_shape().total_size(); ++i)
226 {
227 ARM_COMPUTE_EXPECT(((uint8_t *)result_0.buffer())[i] == ((uint8_t *)result_1.buffer())[i], framework::LogLevel::ERRORS);
228 }
229}
230
231/** Test case for memory injection in @ref NEGEMMLowpMatrixMultiplyCore.
232 *
233 * Make sure @ref NEGEMMLowpMatrixMultiplyCore still works through injecting the memory at configure time using the old API.
234 *
235 * Checks performed in order:
236 * - Both runs compute the same output
237 */
238TEST_CASE(MultipleExecutionWithConfigure, framework::DatasetMode::ALL)
239{
240 auto gemm = std::make_unique<NEGEMMLowpMatrixMultiplyCore>();
241 auto a_info = TensorInfo(TensorShape(32U, 72U), 1, DataType::QASYMM8);
242 auto b_info = TensorInfo(TensorShape(17U, 32U), 1, DataType::QASYMM8);
243 auto dst_info = TensorInfo(TensorShape(17U, 72U), 1, DataType::S32);
244 a_info.set_quantization_info(QuantizationInfo(1.0f / 255, -9));
245 b_info.set_quantization_info(QuantizationInfo(1.0f / 255, 1));
246 const auto gemm_info = GEMMInfo{};
247 auto run_conv = [&]()
248 {
249 auto a = create_tensor<Tensor>(a_info);
250 auto b = create_tensor<Tensor>(b_info);
251 auto dst = create_tensor<Tensor>(dst_info);
252 gemm->configure(&a, &b, nullptr, &dst, gemm_info);
253 a.allocator()->allocate();
254 b.allocator()->allocate();
255 dst.allocator()->allocate();
256 library->fill_tensor_value(Accessor(a), static_cast<uint8_t>(1));
257 library->fill_tensor_value(Accessor(b), static_cast<uint8_t>(2));
258 gemm->run();
259 return dst;
260 };
261 auto result_0 = run_conv();
262 auto result_1 = run_conv();
263 for(size_t i = 0; i < result_0.info()->tensor_shape().total_size(); ++i)
264 {
265 ARM_COMPUTE_EXPECT(((uint8_t *)result_0.buffer())[i] == ((uint8_t *)result_1.buffer())[i], framework::LogLevel::ERRORS);
266 }
267}
268
Gian Marcoe75a02b2017-11-08 12:24:09 +0000269FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFixture, framework::DatasetMode::ALL, datasets::SmallGEMMLowpDataset())
Pablo Tello299025a2017-09-29 11:30:12 +0100270{
271 // Validate output
Gian Marcofa4cacd2017-10-18 17:05:02 +0100272 validate(Accessor(_target), _reference);
273}
274
Gian Marcoe75a02b2017-11-08 12:24:09 +0000275FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpDataset())
Gian Marcofa4cacd2017-10-18 17:05:02 +0100276{
277 // Validate output
278 validate(Accessor(_target), _reference);
Pablo Tello299025a2017-09-29 11:30:12 +0100279}
Pablo Tello299025a2017-09-29 11:30:12 +0100280
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100281TEST_SUITE(BatchedMatMul)
282TEST_SUITE(QASYMM8)
Radu Salavatf1f1f872024-02-27 18:32:26 +0000283using NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedUnsigned =
284 GEMMLowpBatchedMatrixMultiplyCoreFusedOffsetOutputFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore, false, false, uint8_t, uint8_t, true>;
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100285FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedUnsigned, framework::DatasetMode::ALL,
SiCong Li11ab4512023-11-07 12:04:59 +0000286 combine(datasets::SmallGEMMLowpFusedBatchedMatMulDataset(),
287 make("DataType", { DataType::QASYMM8 }),
288 make("reshape_b_only_on_first_run", { false })))
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100289{
290 validate(Accessor(_target), _reference, tolerance_batched);
291}
292TEST_SUITE_END() // QASYMM8
293
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100294TEST_SUITE(QASYMM8_SIGNED)
Radu Salavatf1f1f872024-02-27 18:32:26 +0000295using NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedSigned =
296 GEMMLowpBatchedMatrixMultiplyCoreFusedOffsetOutputFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore, false, false, int8_t, int8_t, true>;
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100297FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedSigned, framework::DatasetMode::ALL,
SiCong Li11ab4512023-11-07 12:04:59 +0000298 combine(datasets::SmallGEMMLowpFusedBatchedMatMulDataset(),
299 make("DataType", { DataType::QASYMM8_SIGNED }),
300 make("reshape_b_only_on_first_run", { false })))
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100301{
302 validate(Accessor(_target), _reference, tolerance_batched);
303}
304TEST_SUITE_END() // QASYMM8_SIGNED
305TEST_SUITE_END() // BatchedMatMul
306
George Wort2d7e6832019-02-22 16:37:41 +0000307TEST_SUITE(FusedOffsetOutput)
Radu Salavatf1f1f872024-02-27 18:32:26 +0000308using NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixture = GEMMLowpMatrixMultiplyCoreFusedOffsetOutputValidationFixture<Tensor, Accessor, NEGEMMLowpMatrixMultiplyCore>;
SiCong Li11ab4512023-11-07 12:04:59 +0000309FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixture, framework::DatasetMode::ALL,
310 combine(datasets::SmallGEMMLowpFusedOffsetOutputUint8Dataset(),
Radu Salavatf1f1f872024-02-27 18:32:26 +0000311 make("DataType", { DataType::QASYMM8 }),
312 make("reshape_b_only_on_first_run", { false })))
George Wort2d7e6832019-02-22 16:37:41 +0000313{
314 // Validate output
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100315 validate(Accessor(_target), _reference, tolerance_quant);
George Wort2d7e6832019-02-22 16:37:41 +0000316}
SiCong Li11ab4512023-11-07 12:04:59 +0000317FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixture, framework::DatasetMode::NIGHTLY,
318 combine(datasets::LargeGEMMLowpFusedOffsetOutputUint8Dataset(),
Radu Salavatf1f1f872024-02-27 18:32:26 +0000319 make("DataType", { DataType::QASYMM8 }),
320 make("reshape_b_only_on_first_run", { false })))
George Wort2d7e6832019-02-22 16:37:41 +0000321{
322 // Validate output
Mohammed Suhail Munshi97a609b2022-10-21 11:15:54 +0100323 validate(Accessor(_target), _reference, tolerance_quant);
George Wort2d7e6832019-02-22 16:37:41 +0000324}
325TEST_SUITE_END() // FusedOffsetOutput
Radu Salavatf1f1f872024-02-27 18:32:26 +0000326
Radu Salavatcdce25b2024-04-12 12:26:50 +0000327// accumulation is not supported for Int8/UInt8 in aarch32
328#ifdef __aarch64__
Radu Salavatf1f1f872024-02-27 18:32:26 +0000329TEST_SUITE(ACCUMULATION)
330TEST_SUITE(S32)
331FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreAccumulateFixture, framework::DatasetMode::ALL, datasets::SmallGEMMLowpDataset())
332{
333 // Validate output
334 validate(Accessor(_target), _reference);
335}
336FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreAccumulateFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpDataset())
337{
338 // Validate output
339 validate(Accessor(_target), _reference);
340}
341TEST_SUITE_END() // S32
342TEST_SUITE_END() // ACCUMULATION
Radu Salavatcdce25b2024-04-12 12:26:50 +0000343#endif // __arch64__
Radu Salavatf1f1f872024-02-27 18:32:26 +0000344
Jonathan Deakina668f9f2024-01-24 09:15:38 +0000345TEST_SUITE(DynamicQuantization)
346FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpMatrixMultiplyCoreDynamicQuantizationFixture, framework::DatasetMode::ALL, datasets::SmallGEMMLowpDataset())
347{
348 // Validate output
349 validate(Accessor(_target), _reference);
350}
351
352FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpMatrixMultiplyCoreDynamicQuantizationFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpDataset())
353{
354 // Validate output
355 validate(Accessor(_target), _reference);
356}
357TEST_SUITE_END() // DynamicQuantization
358
Gunes Bayir83ca1052024-04-16 09:45:58 +0100359#ifdef __aarch64__
360// Deqaunt tests involve returning F32 from the MatrixMultiplyCore kernels and is only implemented in aarch64
Jonathan Deakina668f9f2024-01-24 09:15:38 +0000361TEST_SUITE(Dequant)
Gunes Bayir83ca1052024-04-16 09:45:58 +0100362constexpr AbsoluteTolerance<float> tolerance_dequantized(0.01f);
Gunes Bayire5ef8c12024-04-26 16:51:54 +0100363FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpDequantizedMatrixMultiplyValidationFixture, framework::DatasetMode::ALL,
364 combine(
365 datasets::SmallGEMMLowpDataset(),
366 make("accumulate", {true, false})
367 ))
Jonathan Deakina668f9f2024-01-24 09:15:38 +0000368{
369 // Validate output
370 validate(Accessor(_target), _reference, tolerance_dequantized);
371}
372
Gunes Bayire5ef8c12024-04-26 16:51:54 +0100373FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMLowpDequantizedMatrixMultiplyValidationFixture, framework::DatasetMode::NIGHTLY,
374 combine(
375 datasets::LargeGEMMLowpDataset(),
376 make("accumulate", {false})
377 ))
Jonathan Deakina668f9f2024-01-24 09:15:38 +0000378{
379 // Validate output
380 validate(Accessor(_target), _reference, tolerance_dequantized);
381}
382TEST_SUITE_END() // Dequant
Gunes Bayir83ca1052024-04-16 09:45:58 +0100383#endif // __aarch64__
Jonathan Deakina668f9f2024-01-24 09:15:38 +0000384
Gian Marcoe75a02b2017-11-08 12:24:09 +0000385TEST_SUITE_END() // MatrixMultiplyCore
Gian Marcoe75a02b2017-11-08 12:24:09 +0000386TEST_SUITE_END() // GEMMLowp
Manuel Bottiniae58bdf2021-06-17 17:18:45 +0100387TEST_SUITE_END() // NEON
Pablo Tello299025a2017-09-29 11:30:12 +0100388} // namespace validation
389} // namespace test
390} // namespace arm_compute