Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 1 | /* |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2024 Arm Limited. |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +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 | */ |
| 24 | #include "arm_compute/core/Types.h" |
| 25 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h" |
| 28 | #include "arm_compute/runtime/CL/functions/CLGEMMLowpOutputStage.h" |
| 29 | #include "tests/CL/CLAccessor.h" |
| 30 | #include "tests/PaddingCalculator.h" |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 31 | #include "tests/datasets/GEMMLowpFusedOffsetOutputDataset.h" |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 32 | #include "tests/datasets/LargeGEMMLowpDataset.h" |
| 33 | #include "tests/datasets/ShapeDatasets.h" |
| 34 | #include "tests/datasets/SmallGEMMLowpDataset.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" |
| 39 | #include "tests/validation/fixtures/GEMMLowpFixture.h" |
| 40 | |
| 41 | namespace arm_compute |
| 42 | { |
| 43 | namespace test |
| 44 | { |
| 45 | namespace validation |
| 46 | { |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 47 | |
| 48 | using framework::dataset::make; |
| 49 | |
Manuel Bottini | 959c26d | 2019-12-02 16:22:35 +0000 | [diff] [blame] | 50 | namespace |
| 51 | { |
| 52 | constexpr AbsoluteTolerance<float> tolerance_quant(1); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */ |
| 53 | } |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 54 | TEST_SUITE(CL) |
| 55 | TEST_SUITE(GEMMLowp) |
| 56 | |
| 57 | TEST_SUITE(MatrixMultiplyCore) |
| 58 | using CLGEMMLowpMatrixMultiplyCoreFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore>; |
Ramy Elgammal | a77c6d7 | 2022-09-08 11:30:08 +0100 | [diff] [blame] | 59 | using CLGEMMLowpBatchedMatMulFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, false, false, true>; |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 60 | |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 61 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFixture, framework::DatasetMode::ALL, datasets::SmallGEMMLowpDataset()) |
| 62 | { |
| 63 | // Validate output |
| 64 | validate(CLAccessor(_target), _reference); |
| 65 | } |
| 66 | |
| 67 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMLowpMatrixMultiplyCoreFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpDataset()) |
| 68 | { |
| 69 | // Validate output |
| 70 | validate(CLAccessor(_target), _reference); |
| 71 | } |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 72 | |
| 73 | using CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedUnsigned = |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 74 | GEMMLowpBatchedMatrixMultiplyCoreFusedOffsetOutputFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, false, false, uint8_t, uint8_t, true>; |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 75 | TEST_SUITE(BatchedMatMul) |
| 76 | TEST_SUITE(QASYMM8) |
| 77 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedUnsigned, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 78 | combine(datasets::SmallGEMMLowpFusedBatchedMatMulDataset(), |
| 79 | make("DataType", { DataType::QASYMM8 }), |
| 80 | make("reshape_b_only_on_first_run", { false }))) |
Ramy Elgammal | a77c6d7 | 2022-09-08 11:30:08 +0100 | [diff] [blame] | 81 | { |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 82 | validate(CLAccessor(_target), _reference, tolerance_quant); |
Ramy Elgammal | a77c6d7 | 2022-09-08 11:30:08 +0100 | [diff] [blame] | 83 | } |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 84 | TEST_SUITE_END() // QASYMM8 |
| 85 | |
| 86 | using CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedSigned = |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 87 | GEMMLowpBatchedMatrixMultiplyCoreFusedOffsetOutputFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, false, false, int8_t, int8_t, true>; |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 88 | TEST_SUITE(QASYMM8_SIGNED) |
| 89 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputFixtureBatchedSigned, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 90 | combine(datasets::SmallGEMMLowpFusedBatchedMatMulDataset(), |
| 91 | make("DataType", { DataType::QASYMM8_SIGNED }), |
| 92 | make("reshape_b_only_on_first_run", { false }))) |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 93 | { |
| 94 | validate(CLAccessor(_target), _reference, tolerance_quant); |
| 95 | } |
| 96 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 97 | TEST_SUITE_END() // BatchedMatMul |
| 98 | |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 99 | TEST_SUITE(FusedOffsetOutput) |
Manuel Bottini | 959c26d | 2019-12-02 16:22:35 +0000 | [diff] [blame] | 100 | TEST_SUITE(QASYMM8) |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 101 | using CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputUint8Fixture = GEMMLowpMatrixMultiplyCoreFusedOffsetOutputValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore>; |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 102 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputUint8Fixture, framework::DatasetMode::ALL, |
| 103 | combine(datasets::SmallGEMMLowpFusedOffsetOutputUint8Dataset(), |
| 104 | make("DataType", { DataType::QASYMM8 }), |
| 105 | make("reshape_b_only_on_first_run", { true, false }))) |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 106 | { |
| 107 | // Validate output |
Manuel Bottini | 959c26d | 2019-12-02 16:22:35 +0000 | [diff] [blame] | 108 | validate(CLAccessor(_target), _reference, tolerance_quant); |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Giorgio Arena | 5f6fdc1 | 2021-06-09 15:23:06 +0100 | [diff] [blame] | 111 | TEST_SUITE(Output3D) |
| 112 | using CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputOutput3DUint8Fixture = |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 113 | GEMMLowpMatrixMultiplyCoreFusedOffsetOutputValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, false, true>; |
Giorgio Arena | 5f6fdc1 | 2021-06-09 15:23:06 +0100 | [diff] [blame] | 114 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputOutput3DUint8Fixture, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 115 | combine(datasets::SmallGEMMLowpFusedOffsetOutputOutput3DUint8Dataset(), |
| 116 | make("DataType", { DataType::QASYMM8 }), |
| 117 | make("reshape_b_only_on_first_run", { true, false }))) |
Giorgio Arena | 5f6fdc1 | 2021-06-09 15:23:06 +0100 | [diff] [blame] | 118 | { |
| 119 | // Validate output |
| 120 | validate(CLAccessor(_target), _reference, tolerance_quant); |
| 121 | } |
| 122 | TEST_SUITE_END() // Output3D |
| 123 | |
| 124 | TEST_SUITE(InputOutput3D) |
| 125 | using CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputInputOutput3DUint8Fixture = |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 126 | GEMMLowpMatrixMultiplyCoreFusedOffsetOutputValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, true, true>; |
Giorgio Arena | 5f6fdc1 | 2021-06-09 15:23:06 +0100 | [diff] [blame] | 127 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputInputOutput3DUint8Fixture, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 128 | combine(datasets::SmallGEMMLowpFusedOffsetOutputInputOutput3DUint8Dataset(), |
| 129 | make("DataType", { DataType::QASYMM8 }), |
| 130 | make("reshape_b_only_on_first_run", { true, false }))) |
Giorgio Arena | 5f6fdc1 | 2021-06-09 15:23:06 +0100 | [diff] [blame] | 131 | { |
| 132 | // Validate output |
| 133 | validate(CLAccessor(_target), _reference, tolerance_quant); |
| 134 | } |
| 135 | TEST_SUITE_END() // InputOutput3D |
| 136 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 137 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputUint8Fixture, framework::DatasetMode::NIGHTLY, |
| 138 | combine(datasets::LargeGEMMLowpFusedOffsetOutputUint8Dataset(), |
| 139 | make("DataType", { DataType::QASYMM8 }), |
| 140 | make("reshape_b_only_on_first_run", { true, false }))) |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 141 | { |
| 142 | // Validate output |
Manuel Bottini | 959c26d | 2019-12-02 16:22:35 +0000 | [diff] [blame] | 143 | validate(CLAccessor(_target), _reference, tolerance_quant); |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 144 | } |
Manuel Bottini | 959c26d | 2019-12-02 16:22:35 +0000 | [diff] [blame] | 145 | TEST_SUITE_END() // QASYMM8 |
| 146 | TEST_SUITE(QASYMM8_SIGNED) |
| 147 | using CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputInt8Fixture = |
| 148 | GEMMLowpMatrixMultiplyCoreFusedOffsetOutputValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, false, false, int8_t, int8_t>; |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 149 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreFusedOffsetOutputInt8Fixture, framework::DatasetMode::ALL, |
| 150 | combine(datasets::SmallGEMMLowpFusedOffsetOutputInt8Dataset(), |
Radu Salavat | f1f1f87 | 2024-02-27 18:32:26 +0000 | [diff] [blame] | 151 | make("DataType", { DataType::QASYMM8_SIGNED }), |
| 152 | make("reshape_b_only_on_first_run", { false }))) |
Manuel Bottini | 959c26d | 2019-12-02 16:22:35 +0000 | [diff] [blame] | 153 | { |
| 154 | // Validate output |
| 155 | validate(CLAccessor(_target), _reference, tolerance_quant); |
| 156 | } |
| 157 | TEST_SUITE_END() // QASYMM8_SIGNED |
George Wort | 2d7e683 | 2019-02-22 16:37:41 +0000 | [diff] [blame] | 158 | TEST_SUITE_END() // FusedOffsetOutput |
| 159 | |
Georgios Pinitas | ebf6b8a | 2018-09-24 16:31:08 +0100 | [diff] [blame] | 160 | TEST_SUITE(Output3D) |
| 161 | using CLGEMMLowpMatrixMultiplyCoreOutput3DFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, false, true>; |
| 162 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreOutput3DFixture, framework::DatasetMode::PRECOMMIT, datasets::SmallGEMMLowpOutput3DDataset()) |
| 163 | { |
| 164 | // Validate output |
| 165 | validate(CLAccessor(_target), _reference); |
| 166 | } |
| 167 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMLowpMatrixMultiplyCoreOutput3DFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpOutput3DDataset()) |
| 168 | { |
| 169 | // Validate output |
| 170 | validate(CLAccessor(_target), _reference); |
| 171 | } |
| 172 | TEST_SUITE_END() // Output3D |
| 173 | |
| 174 | TEST_SUITE(InputOutput3D) |
| 175 | using CLGEMMLowpMatrixMultiplyCoreInputOutput3DFixture = GEMMLowpMatrixMultiplyCoreValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyCore, true, true>; |
| 176 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyCoreInputOutput3DFixture, framework::DatasetMode::PRECOMMIT, datasets::SmallGEMMLowpInputOutput3DDataset()) |
| 177 | { |
| 178 | // Validate output |
| 179 | validate(CLAccessor(_target), _reference); |
| 180 | } |
| 181 | FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMLowpMatrixMultiplyCoreInputOutput3DFixture, framework::DatasetMode::NIGHTLY, datasets::LargeGEMMLowpInputOutput3DDataset()) |
| 182 | { |
| 183 | // Validate output |
| 184 | validate(CLAccessor(_target), _reference); |
| 185 | } |
| 186 | TEST_SUITE_END() // InputOutput3D |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 187 | TEST_SUITE_END() // MatrixMultiplyCore |
| 188 | |
| 189 | TEST_SUITE(OutputStage) |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 190 | |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 191 | TEST_SUITE(QuantizeDownInt32Scale) |
| 192 | |
| 193 | TEST_SUITE(QASYMM8) |
| 194 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 195 | const auto quantize_down_int32_to_uint8_scale_cases = make("result_offset", -2, 1) * make("result_mult_int", 1, 2) * make("result_shift", 2, 3) |
| 196 | * make("min", 0) * make("max", 255) * make("addBias", { false, true }); |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 197 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 198 | const auto quantize_down_int32_to_uint8_scale_relu_cases = make("result_offset", -2, 1) * make("result_mult_int", 1, 2) |
| 199 | * make("result_shift", 2, 3) * make("min", 0, 2) * make("max", 171, 173) * make("addBias", { false, true }); |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 200 | |
| 201 | using CLGEMMLowpQuantizeDownInt32ScaleFixture = GEMMLowpQuantizeDownInt32ToUint8ScaleValidationFixture<CLTensor, CLAccessor, CLGEMMLowpOutputStage>; |
| 202 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 203 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpQuantizeDownInt32ScaleFixture, framework::DatasetMode::ALL, |
| 204 | combine(datasets::SmallShapes(), quantize_down_int32_to_uint8_scale_cases)) |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 205 | { |
| 206 | // Validate output |
| 207 | validate(CLAccessor(_target), _reference); |
| 208 | } |
| 209 | |
| 210 | TEST_SUITE(BoundedReLu) |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 211 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpQuantizeDownInt32ScaleFixture, framework::DatasetMode::ALL, |
| 212 | combine(datasets::SmallShapes(), quantize_down_int32_to_uint8_scale_relu_cases)) |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 213 | { |
| 214 | // Validate output |
| 215 | validate(CLAccessor(_target), _reference); |
| 216 | } |
| 217 | |
| 218 | TEST_SUITE_END() // BoundedReLu |
| 219 | TEST_SUITE_END() // QASYMM8 |
| 220 | |
| 221 | TEST_SUITE(QASYMM8_SIGNED) |
| 222 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 223 | const auto quantize_down_int32_to_int8_scale_cases = make("result_offset", -2, 1) * make("result_mult_int", 1, 2) * make("result_shift", 2, 3) |
| 224 | * make("min", -128) * make("max", 127) * make("addBias", { false, true }); |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 225 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 226 | const auto quantize_down_int32_to_int8_scale_relu_cases = make("result_offset", -2, 1) * make("result_mult_int", 1, 2) |
| 227 | * make("result_shift", 2, 3) * make("min", -100, -98) * make("max", 71, 73) * make("addBias", { false, true }); |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 228 | |
| 229 | using CLGEMMLowpQuantizeDownInt32ScaleFixture = GEMMLowpQuantizeDownInt32ToInt8ScaleValidationFixture<CLTensor, CLAccessor, CLGEMMLowpOutputStage>; |
| 230 | |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 231 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpQuantizeDownInt32ScaleFixture, framework::DatasetMode::ALL, |
| 232 | combine(datasets::SmallShapes(), quantize_down_int32_to_int8_scale_cases)) |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 233 | { |
| 234 | // Validate output |
| 235 | validate(CLAccessor(_target), _reference); |
| 236 | } |
| 237 | |
| 238 | TEST_SUITE(BoundedReLu) |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 239 | FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpQuantizeDownInt32ScaleFixture, framework::DatasetMode::ALL, |
| 240 | combine(datasets::SmallShapes(), quantize_down_int32_to_int8_scale_relu_cases)) |
Luca Foschiani | 4b86953 | 2020-02-13 15:07:36 +0000 | [diff] [blame] | 241 | { |
| 242 | // Validate output |
| 243 | validate(CLAccessor(_target), _reference); |
| 244 | } |
| 245 | |
| 246 | TEST_SUITE_END() // BoundedReLu |
| 247 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 248 | TEST_SUITE_END() // QuantizeDownInt32Scale |
| 249 | |
Sheri Zhang | 1b14c75 | 2020-03-09 14:29:52 +0000 | [diff] [blame] | 250 | TEST_SUITE(QuantizeDownInt32ScaleByFloat) |
| 251 | |
| 252 | TEST_SUITE(QASYMM8) |
| 253 | using CLGEMMLowpQuantizeDownInt32ScaleByFloatFixture = |
| 254 | GEMMLowpQuantizeDownInt32ScaleByFloatValidationFixture<CLTensor, CLAccessor, CLGEMMLowpOutputStage, uint8_t>; |
| 255 | |
| 256 | FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMLowpQuantizeDownInt32ScaleByFloatFixture, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 257 | combine( |
| 258 | make("DataType", DataType::QASYMM8), |
| 259 | datasets::TinyShapes(), |
| 260 | make("result_real_multiplier", 0.33f), |
| 261 | make("result_offset", 2, 3), |
| 262 | make("min", 0), |
| 263 | make("max", 255), |
| 264 | make("addBias", { false, true }))) |
Sheri Zhang | 1b14c75 | 2020-03-09 14:29:52 +0000 | [diff] [blame] | 265 | { |
| 266 | // Validate output |
| 267 | validate(CLAccessor(_target), _reference); |
| 268 | } |
| 269 | TEST_SUITE_END() // QASYMM8 |
| 270 | |
| 271 | TEST_SUITE(QASYMM8_SIGNED) |
| 272 | using CLGEMMLowpQuantizeDownInt32ScaleByFloatFixture_Signed = |
| 273 | GEMMLowpQuantizeDownInt32ScaleByFloatValidationFixture<CLTensor, CLAccessor, CLGEMMLowpOutputStage, int8_t>; |
| 274 | FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMLowpQuantizeDownInt32ScaleByFloatFixture_Signed, framework::DatasetMode::ALL, |
SiCong Li | 11ab451 | 2023-11-07 12:04:59 +0000 | [diff] [blame] | 275 | combine( |
| 276 | make("DataType", DataType::QASYMM8_SIGNED), |
| 277 | datasets::TinyShapes(), |
| 278 | make("result_real_multiplier", 0.33f), |
| 279 | make("result_offset", 2, 3), |
| 280 | make("min", -128), |
| 281 | make("max", 127), |
| 282 | make("addBias", { false, true }))) |
Sheri Zhang | 1b14c75 | 2020-03-09 14:29:52 +0000 | [diff] [blame] | 283 | { |
| 284 | // Validate output |
| 285 | validate(CLAccessor(_target), _reference); |
| 286 | } |
| 287 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 288 | |
| 289 | TEST_SUITE_END() // QuantizeDownInt32ScaleByFloat |
| 290 | |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 291 | TEST_SUITE_END() // OutputStage |
| 292 | TEST_SUITE_END() // GEMMLowp |
| 293 | TEST_SUITE_END() // CL |
| 294 | } // namespace validation |
| 295 | } // namespace test |
Mohammed Suhail Munshi | 97a609b | 2022-10-21 11:15:54 +0100 | [diff] [blame] | 296 | } // namespace arm_compute |