blob: 535c3e634ed1333b48482828648baa50399f63b2 [file] [log] [blame]
Sanghoon Lee70f82912017-08-24 14:21:24 +01001/*
Matthew Bentham314d3e22023-06-23 10:53:52 +00002 * Copyright (c) 2017-2023 Arm Limited.
Sanghoon Lee70f82912017-08-24 14:21:24 +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,
Georgios Pinitas5a594532018-12-03 14:30:05 +000021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Sanghoon Lee70f82912017-08-24 14:21:24 +010022 * SOFTWARE.
23 */
24#include "arm_compute/core/Types.h"
Matthew Bentham314d3e22023-06-23 10:53:52 +000025#include "arm_compute/core/utils/StringUtils.h"
Sanghoon Lee70f82912017-08-24 14:21:24 +010026#include "arm_compute/runtime/NEON/functions/NEArithmeticAddition.h"
27#include "arm_compute/runtime/Tensor.h"
28#include "arm_compute/runtime/TensorAllocator.h"
Giorgio Arena5ae8d802021-11-18 18:02:13 +000029#include "src/common/cpuinfo/CpuIsaInfo.h"
30#include "src/cpu/kernels/CpuAddKernel.h"
Sanghoon Lee70f82912017-08-24 14:21:24 +010031#include "tests/NEON/Accessor.h"
32#include "tests/PaddingCalculator.h"
33#include "tests/datasets/ConvertPolicyDataset.h"
34#include "tests/datasets/ShapeDatasets.h"
35#include "tests/framework/Asserts.h"
36#include "tests/framework/Macros.h"
37#include "tests/framework/datasets/Datasets.h"
38#include "tests/validation/Validation.h"
Georgios Pinitascbf39c62018-09-10 15:07:45 +010039#include "tests/validation/fixtures/ArithmeticOperationsFixture.h"
Sanghoon Lee70f82912017-08-24 14:21:24 +010040
41namespace arm_compute
42{
43namespace test
44{
45namespace validation
46{
47namespace
48{
Georgios Pinitasbdcdc392021-04-22 16:42:03 +010049#if !defined(__aarch64__) || defined(ENABLE_SVE)
Manuel Bottini65383e22019-06-24 14:25:32 +010050constexpr AbsoluteTolerance<float> tolerance_quant(1); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
Georgios Pinitasbdcdc392021-04-22 16:42:03 +010051#else // !defined(__aarch64__) || defined(ENABLE_SVE)
Michalis Spyroua3c9a3b2020-12-08 21:02:16 +000052constexpr AbsoluteTolerance<float> tolerance_quant(0);
Georgios Pinitasbdcdc392021-04-22 16:42:03 +010053#endif // !defined(__aarch64__) || defined(ENABLE_SVE)
Sheri Zhanga387e272021-06-29 17:34:06 +010054const auto InPlaceDataSet = framework::dataset::make("InPlace", { false, true });
55const auto OutOfPlaceDataSet = framework::dataset::make("InPlace", { false });
Sanghoon Lee70f82912017-08-24 14:21:24 +010056} // namespace
57
58TEST_SUITE(NEON)
59TEST_SUITE(ArithmeticAddition)
60
61template <typename T>
62using NEArithmeticAdditionFixture = ArithmeticAdditionValidationFixture<Tensor, Accessor, NEArithmeticAddition, T>;
63
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000064// *INDENT-OFF*
65// clang-format off
66DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
Georgios Pinitasda816752021-07-02 09:22:14 +010067 framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
Georgios Pinitas5a594532018-12-03 14:30:05 +000068 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Unsupported broadcast
69 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
70 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),// Mismatching shapes
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000071 }),
Georgios Pinitasda816752021-07-02 09:22:14 +010072 framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
Georgios Pinitas5a594532018-12-03 14:30:05 +000073 TensorInfo(TensorShape(1U, 13U, 2U), 1, DataType::S16),
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000074 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
75 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000076 })),
Georgios Pinitasda816752021-07-02 09:22:14 +010077 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
Georgios Pinitas5a594532018-12-03 14:30:05 +000078 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::S16),
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000079 TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
80 TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000081 })),
Georgios Pinitasda816752021-07-02 09:22:14 +010082 framework::dataset::make("Expected", { true, false, false, false})),
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000083 input1_info, input2_info, output_info, expected)
84{
Georgios Pinitas5a594532018-12-03 14:30:05 +000085 Status s = NEArithmeticAddition::validate(&input1_info.clone()->set_is_resizable(false),
86 &input2_info.clone()->set_is_resizable(false),
87 &output_info.clone()->set_is_resizable(false),
88 ConvertPolicy::WRAP);
89 ARM_COMPUTE_EXPECT(bool(s) == expected, framework::LogLevel::ERRORS);
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +000090}
Giorgio Arena5ae8d802021-11-18 18:02:13 +000091
92DATA_TEST_CASE(KernelSelection, framework::DatasetMode::ALL, concat(concat(
Viet-Hoa Do9fc0b5c2022-10-20 11:18:17 +010093 combine(combine(framework::dataset::make("CpuExt", std::string("NEON")),
Giorgio Arena5ae8d802021-11-18 18:02:13 +000094 framework::dataset::make("DataType", { DataType::F32,
95 DataType::F16,
96 DataType::U8,
97 DataType::S16,
98 DataType::S32,
99 DataType::QASYMM8,
100 DataType::QASYMM8_SIGNED,
101 DataType::QSYMM16
102 })),
Viet-Hoa Do40b44192022-09-22 10:24:23 +0100103 framework::dataset::make("CanUseFixedpoint", {true, false})),
Viet-Hoa Do9fc0b5c2022-10-20 11:18:17 +0100104 combine(combine(framework::dataset::make("CpuExt", std::string("SVE")),
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000105 framework::dataset::make("DataType", { DataType::F32,
106 DataType::F16,
107 DataType::U8,
108 DataType::S16,
109 DataType::S32
Gunes Bayir9b921be2022-07-28 17:44:00 +0100110 })),
Viet-Hoa Do40b44192022-09-22 10:24:23 +0100111 framework::dataset::make("CanUseFixedpoint", {true, false}))),
Viet-Hoa Do9fc0b5c2022-10-20 11:18:17 +0100112 combine(combine(framework::dataset::make("CpuExt", std::string("SVE2")),
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000113 framework::dataset::make("DataType", { DataType::QASYMM8,
114 DataType::QASYMM8_SIGNED,
115 DataType::QSYMM16
Gunes Bayir9b921be2022-07-28 17:44:00 +0100116 })),
Viet-Hoa Do40b44192022-09-22 10:24:23 +0100117 framework::dataset::make("CanUseFixedpoint", {true, false}))),
Viet-Hoa Do9fc0b5c2022-10-20 11:18:17 +0100118 cpu_ext, data_type, can_use_fixedpoint)
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000119{
120 using namespace cpu::kernels;
121
122 cpuinfo::CpuIsaInfo cpu_isa{};
123 cpu_isa.neon = (cpu_ext == "NEON");
124 cpu_isa.sve = (cpu_ext == "SVE");
125 cpu_isa.sve2 = (cpu_ext == "SVE2");
126 cpu_isa.fp16 = (data_type == DataType::F16);
127
Viet-Hoa Do9fc0b5c2022-10-20 11:18:17 +0100128 const auto *selected_impl = CpuAddKernel::get_implementation(CpuAddKernelDataTypeISASelectorData{data_type, cpu_isa, can_use_fixedpoint}, cpu::KernelSelectionType::Preferred);
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000129
130 ARM_COMPUTE_ERROR_ON_NULLPTR(selected_impl);
131
Viet-Hoa Do40b44192022-09-22 10:24:23 +0100132 bool qasymm8_any = (data_type == DataType::QASYMM8 || data_type == DataType::QASYMM8_SIGNED);
Gunes Bayir9b921be2022-07-28 17:44:00 +0100133
134 std::string expected;
Viet-Hoa Do9fc0b5c2022-10-20 11:18:17 +0100135 if(qasymm8_any && can_use_fixedpoint)
Viet-Hoa Do40b44192022-09-22 10:24:23 +0100136 {
137 expected = "neon_" + cpu_impl_dt(data_type) + "_add_fixedpoint";
138 }
Gunes Bayir9b921be2022-07-28 17:44:00 +0100139 else
140 {
141 expected = lower_string(cpu_ext) + "_" + cpu_impl_dt(data_type) + "_add";
142 }
143
Giorgio Arena5ae8d802021-11-18 18:02:13 +0000144 std::string actual = selected_impl->name;
145
146 ARM_COMPUTE_EXPECT_EQUAL(expected, actual, framework::LogLevel::ERRORS);
147}
Ioan-Cristian Szabo397d58a2017-11-30 15:19:11 +0000148// clang-format on
149// *INDENT-ON*
150
Michele Di Giorgio3be0b8c2020-06-18 15:28:54 +0100151TEST_CASE(NoPaddingAdded, framework::DatasetMode::PRECOMMIT)
152{
153 // NEArithmeticAddition doesn't use padding, so make sure this is the case.
154 Tensor input1 = create_tensor<Tensor>(TensorShape(15U, 15U), DataType::F32);
155 Tensor input2 = create_tensor<Tensor>(TensorShape(15U, 1U), DataType::F32);
156 Tensor output = create_tensor<Tensor>(TensorShape(15U, 15U), DataType::F32);
157
158 NEArithmeticAddition add;
159 add.configure(&input1, &input2, &output, ConvertPolicy::WRAP);
160
161 // Validate padding is zero
162 validate(input1.info()->padding(), PaddingSize());
163 validate(input2.info()->padding(), PaddingSize());
164 validate(output.info()->padding(), PaddingSize());
165}
166
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000167TEST_SUITE(Integer)
Sanghoon Lee70f82912017-08-24 14:21:24 +0100168TEST_SUITE(U8)
Sheri Zhanga387e272021-06-29 17:34:06 +0100169FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
170 DataType::U8)),
171 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
172 OutOfPlaceDataSet))
Sanghoon Lee70f82912017-08-24 14:21:24 +0100173{
174 // Validate output
175 validate(Accessor(_target), _reference);
176}
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000177TEST_SUITE_END() // U8
Sanghoon Lee70f82912017-08-24 14:21:24 +0100178
179TEST_SUITE(S16)
Sheri Zhanga387e272021-06-29 17:34:06 +0100180FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
181 DataType::S16)),
182 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
183 OutOfPlaceDataSet))
Sanghoon Lee70f82912017-08-24 14:21:24 +0100184{
185 // Validate output
186 validate(Accessor(_target), _reference);
187}
188
Sheri Zhanga387e272021-06-29 17:34:06 +0100189FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticAdditionFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
190 DataType::S16)),
191 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
192 OutOfPlaceDataSet))
Sanghoon Lee70f82912017-08-24 14:21:24 +0100193{
194 // Validate output
195 validate(Accessor(_target), _reference);
196}
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000197TEST_SUITE_END() // S16
Michele Di Giorgio11c562c2020-06-10 16:34:50 +0100198
199TEST_SUITE(S32)
Sheri Zhanga387e272021-06-29 17:34:06 +0100200FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixture<int32_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
201 DataType::S32)),
202 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
203 OutOfPlaceDataSet))
Michele Di Giorgio11c562c2020-06-10 16:34:50 +0100204{
205 // Validate output
206 validate(Accessor(_target), _reference);
207}
208TEST_SUITE_END() // S32
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000209TEST_SUITE_END() // Integer
Sanghoon Lee70f82912017-08-24 14:21:24 +0100210
Sanghoon Lee70f82912017-08-24 14:21:24 +0100211TEST_SUITE(Float)
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +0000212#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Sanghoon Lee70f82912017-08-24 14:21:24 +0100213TEST_SUITE(F16)
Sheri Zhanga387e272021-06-29 17:34:06 +0100214FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)),
215 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
216 OutOfPlaceDataSet))
Sanghoon Lee70f82912017-08-24 14:21:24 +0100217{
218 // Validate output
219 validate(Accessor(_target), _reference);
220}
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000221TEST_SUITE_END() // F16
222#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Sanghoon Lee70f82912017-08-24 14:21:24 +0100223
224TEST_SUITE(F32)
Sheri Zhanga387e272021-06-29 17:34:06 +0100225FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
226 DataType::F32)),
227 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
228 OutOfPlaceDataSet))
Sanghoon Lee70f82912017-08-24 14:21:24 +0100229{
230 // Validate output
231 validate(Accessor(_target), _reference);
232}
233
Sheri Zhanga387e272021-06-29 17:34:06 +0100234FIXTURE_DATA_TEST_CASE(RunLarge, NEArithmeticAdditionFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
235 DataType::F32)),
236 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
237 OutOfPlaceDataSet))
Sanghoon Lee70f82912017-08-24 14:21:24 +0100238{
239 // Validate output
240 validate(Accessor(_target), _reference);
241}
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000242
243template <typename T>
244using NEArithmeticAdditionBroadcastFixture = ArithmeticAdditionBroadcastValidationFixture<Tensor, Accessor, NEArithmeticAddition, T>;
245
Sheri Zhanga387e272021-06-29 17:34:06 +0100246FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticAdditionBroadcastFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapesBroadcast(),
Georgios Pinitasda816752021-07-02 09:22:14 +0100247 framework::dataset::make("DataType", DataType::F32)),
Sheri Zhanga387e272021-06-29 17:34:06 +0100248 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
249 OutOfPlaceDataSet))
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000250{
251 // Validate output
252 validate(Accessor(_target), _reference);
253}
254
Sheri Zhanga387e272021-06-29 17:34:06 +0100255FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, NEArithmeticAdditionBroadcastFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapesBroadcast(),
Georgios Pinitasda816752021-07-02 09:22:14 +0100256 framework::dataset::make("DataType", DataType::F32)),
Sheri Zhanga387e272021-06-29 17:34:06 +0100257 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
258 OutOfPlaceDataSet))
Diego Lopez Recas0021d752017-12-18 14:42:56 +0000259{
260 // Validate output
261 validate(Accessor(_target), _reference);
262}
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000263TEST_SUITE_END() // F32
264TEST_SUITE_END() // Float
Sanghoon Lee70f82912017-08-24 14:21:24 +0100265
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000266template <typename T>
267using NEArithmeticAdditionQuantizedFixture = ArithmeticAdditionValidationQuantizedFixture<Tensor, Accessor, NEArithmeticAddition, T>;
268
Michalis Spyrou2232a202020-07-13 15:15:33 +0100269template <typename T>
270using NEArithmeticAdditionQuantizedBroadcastFixture = ArithmeticAdditionValidationQuantizedBroadcastFixture<Tensor, Accessor, NEArithmeticAddition, T>;
271
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000272TEST_SUITE(Quantized)
273TEST_SUITE(QASYMM8)
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000274FIXTURE_DATA_TEST_CASE(RunSmall,
275 NEArithmeticAdditionQuantizedFixture<uint8_t>,
276 framework::DatasetMode::PRECOMMIT,
Sheri Zhanga387e272021-06-29 17:34:06 +0100277 combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8)),
278 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
279 framework::dataset::make("Src0QInfo", { QuantizationInfo(5.f / 255.f, 20) })),
280 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 255.f, 10) })),
281 framework::dataset::make("OutQInfo", { QuantizationInfo(1.f / 255.f, 5) })),
282 OutOfPlaceDataSet))
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000283{
284 // Validate output
Manuel Bottini65383e22019-06-24 14:25:32 +0100285 validate(Accessor(_target), _reference, tolerance_quant);
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000286}
287TEST_SUITE_END() // QASYMM8
Michalis Spyroubc4d7c22019-12-03 15:11:09 +0000288
289TEST_SUITE(QASYMM8_SIGNED)
290FIXTURE_DATA_TEST_CASE(RunSmall,
291 NEArithmeticAdditionQuantizedFixture<int8_t>,
292 framework::DatasetMode::ALL,
Sheri Zhanga387e272021-06-29 17:34:06 +0100293 combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
294 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
295 framework::dataset::make("Src0QInfo", { QuantizationInfo(0.5f, 20) })),
296 framework::dataset::make("Src1QInfo", { QuantizationInfo(0.5f, 10) })),
297 framework::dataset::make("OutQInfo", { QuantizationInfo(0.5f, 5) })),
298 OutOfPlaceDataSet))
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100299{
Michalis Spyroubc4d7c22019-12-03 15:11:09 +0000300 // Validate output
Michalis Spyroubc4d7c22019-12-03 15:11:09 +0000301 validate(Accessor(_target), _reference, tolerance_quant);
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100302}
Michalis Spyrou2232a202020-07-13 15:15:33 +0100303
Sheri Zhanga387e272021-06-29 17:34:06 +0100304FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, NEArithmeticAdditionQuantizedBroadcastFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(
Georgios Pinitasda816752021-07-02 09:22:14 +0100305 datasets::SmallShapesBroadcast(), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
Michalis Spyrou2232a202020-07-13 15:15:33 +0100306 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
307 framework::dataset::make("Src0QInfo", { QuantizationInfo(0.5f, 20) })),
308 framework::dataset::make("Src1QInfo", { QuantizationInfo(0.5f, 10) })),
Sheri Zhanga387e272021-06-29 17:34:06 +0100309 framework::dataset::make("OutQInfo", { QuantizationInfo(0.5f, 5) })),
310 OutOfPlaceDataSet))
Michalis Spyrou2232a202020-07-13 15:15:33 +0100311{
312 // Validate output
Michalis Spyrou2232a202020-07-13 15:15:33 +0100313 validate(Accessor(_target), _reference, tolerance_quant);
Michalis Spyrou2232a202020-07-13 15:15:33 +0100314}
Michalis Spyroubc4d7c22019-12-03 15:11:09 +0000315TEST_SUITE_END() // QASYMM8_SIGNED
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100316
Michalis Spyroubc4d7c22019-12-03 15:11:09 +0000317TEST_SUITE(QSYMM16)
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100318FIXTURE_DATA_TEST_CASE(RunSmall,
319 NEArithmeticAdditionQuantizedFixture<int16_t>,
320 framework::DatasetMode::PRECOMMIT,
Sheri Zhanga387e272021-06-29 17:34:06 +0100321 combine(combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QSYMM16)),
322 framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
323 framework::dataset::make("Src0QInfo", { QuantizationInfo(1.f / 32768.f, 0), QuantizationInfo(5.f / 32768.f, 0) })),
324 framework::dataset::make("Src1QInfo", { QuantizationInfo(2.f / 32768.f, 0), QuantizationInfo(5.f / 32768.f, 0) })),
325 framework::dataset::make("OutQInfo", { QuantizationInfo(5.f / 32768.f, 0) })),
326 OutOfPlaceDataSet))
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100327{
328 // Validate output
Manuel Bottini65383e22019-06-24 14:25:32 +0100329 validate(Accessor(_target), _reference, tolerance_quant);
Manuel Bottini3689fcd2019-06-14 17:18:12 +0100330}
331TEST_SUITE_END() // QSYMM16
Georgios Pinitasa84faff2018-12-05 18:17:24 +0000332TEST_SUITE_END() // Quantized
333
334TEST_SUITE_END() // ArithmeticAddition
Sheri Zhangac6499a2021-02-10 15:32:38 +0000335TEST_SUITE_END() // Neon
Sanghoon Lee70f82912017-08-24 14:21:24 +0100336} // namespace validation
337} // namespace test
338} // namespace arm_compute