Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 1 | /* |
Gunes Bayir | 2aec5f1 | 2024-01-23 17:19:44 +0000 | [diff] [blame] | 2 | * Copyright (c) 2023-2024 Arm Limited. |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +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/NEON/functions/NEMatMul.h" |
| 26 | |
| 27 | #include "tests/NEON/Accessor.h" |
| 28 | #include "tests/framework/Asserts.h" |
| 29 | #include "tests/framework/Macros.h" |
| 30 | #include "tests/framework/datasets/Datasets.h" |
| 31 | #include "tests/validation/Validation.h" |
| 32 | |
| 33 | #include "tests/datasets/LargeMatMulDataset.h" |
| 34 | #include "tests/datasets/SmallMatMulDataset.h" |
| 35 | #include "tests/validation/fixtures/MatMulFixture.h" |
| 36 | |
| 37 | namespace arm_compute |
| 38 | { |
| 39 | namespace test |
| 40 | { |
| 41 | namespace validation |
| 42 | { |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 43 | using framework::dataset::make; |
| 44 | |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 45 | TEST_SUITE(NEON) |
| 46 | TEST_SUITE(MatMul) |
| 47 | |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 48 | constexpr AbsoluteTolerance<float> tolerance_fp32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for FP32 data types */ |
| 49 | const AbsoluteTolerance<half> tolerance_fp16(half(0.1f)); |
Ramy Elgammal | af15076 | 2023-04-25 17:19:27 +0100 | [diff] [blame] | 50 | #ifdef __aarch64__ |
Gunes Bayir | 43ba0dd | 2024-03-19 15:31:11 +0000 | [diff] [blame^] | 51 | constexpr AbsoluteTolerance<int32_t> tolerance_qasymm8(1); |
| 52 | constexpr AbsoluteTolerance<int32_t> tolerance_qasymm8_signed(1); |
Ramy Elgammal | af15076 | 2023-04-25 17:19:27 +0100 | [diff] [blame] | 53 | #endif // __aarch64__ |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 54 | |
| 55 | // clang-format off |
| 56 | // *INDENT-OFF* |
| 57 | // Validation Tests |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 58 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, |
| 59 | zip( |
| 60 | make("InputAInfo", { |
| 61 | TensorInfo(TensorShape(9U, 6U), 1, DataType::F32), // Mismatching datatype |
| 62 | TensorInfo(TensorShape(9U, 6U), 1, DataType::S32), // Unsupported datatypes |
| 63 | TensorInfo(TensorShape(9U, 6U, 2U), 1, DataType::F32), // Broadcasting in batch dimension not supported |
| 64 | TensorInfo(TensorShape(9U, 6U), 1, DataType::F32), // Invalid shape for multiplication |
| 65 | TensorInfo(TensorShape(9U, 6U), 1, DataType::F32), |
| 66 | TensorInfo(TensorShape(9U, 6U , 12U) , 1 , DataType::F32), |
| 67 | TensorInfo(TensorShape(9U, 6U , 12U) , 1 , DataType::F32), // Tensors are not dynamic |
| 68 | TensorInfo(TensorShape(9U, 6U), 1, DataType::QASYMM8), |
| 69 | TensorInfo(TensorShape(9U, 6U), 1, DataType::QASYMM8_SIGNED), |
| 70 | TensorInfo(TensorShape(9U, 6U), 1, DataType::QASYMM8_SIGNED), // Mismatching data type |
| 71 | }), |
| 72 | make("InputBInfo", { |
| 73 | TensorInfo(TensorShape(5U, 9U), 1, DataType::QASYMM8), |
| 74 | TensorInfo(TensorShape(5U, 9U), 1, DataType::S32), |
| 75 | TensorInfo(TensorShape(5U, 9U, 1U), 1, DataType::F32), |
| 76 | TensorInfo(TensorShape(5U, 12U), 1, DataType::F32), |
| 77 | TensorInfo(TensorShape(5U, 9U), 1, DataType::F32), |
| 78 | TensorInfo(TensorShape(5U, 9U, 12U), 1, DataType::F32), |
| 79 | TensorInfo(TensorShape(5U, 9U, 12U), 1, DataType::F32), |
| 80 | TensorInfo(TensorShape(5U, 9U), 1, DataType::QASYMM8), |
| 81 | TensorInfo(TensorShape(5U, 9U), 1, DataType::QASYMM8_SIGNED), |
| 82 | TensorInfo(TensorShape(5U, 9U), 1, DataType::QASYMM8_SIGNED), |
| 83 | }), |
| 84 | make("OutputInfo", { |
| 85 | TensorInfo(TensorShape(5U, 6U), 1, DataType::F32), |
| 86 | TensorInfo(TensorShape(5U, 6U), 1, DataType::S32), |
| 87 | TensorInfo(TensorShape(5U, 6U, 2U), 1, DataType::F32), |
| 88 | TensorInfo(TensorShape(5U, 6U), 1, DataType::F32), |
| 89 | TensorInfo(TensorShape(5U, 6U), 1, DataType::F32), |
| 90 | TensorInfo(TensorShape(5U, 6U, 12U) , 1, DataType::F32), |
| 91 | TensorInfo(TensorShape(5U, 6U, 12U) , 1, DataType::F32), |
| 92 | TensorInfo(TensorShape(5U, 6U), 1, DataType::QASYMM8), |
| 93 | TensorInfo(TensorShape(5U, 6U), 1, DataType::QASYMM8_SIGNED), |
| 94 | TensorInfo(TensorShape(5U, 6U), 1, DataType::QASYMM8), |
| 95 | }), |
| 96 | make("TensorIsConst", {false, false, false, false, false , false, true, false, false, false}), |
| 97 | make("Expected", { false, false, false, false, true, true, false, true, true, false })), |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 98 | a_info, b_info, output_info, are_tensors_const, expected) |
| 99 | { |
| 100 | TensorInfo a{a_info}; |
| 101 | TensorInfo b{b_info}; |
| 102 | a.set_are_values_constant(are_tensors_const); |
| 103 | b.set_are_values_constant(are_tensors_const); |
| 104 | Status status = NEMatMul::validate(&a, |
| 105 | &b, |
| 106 | &output_info, |
| 107 | MatMulInfo(), |
| 108 | CpuMatMulSettings()); |
| 109 | ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS); |
| 110 | } |
| 111 | // *INDENT-ON* |
| 112 | // clang-format on |
| 113 | |
| 114 | // Generic Template |
| 115 | template <typename T> |
| 116 | using NEMatMulFixture = MatMulValidationWithActivationFixture<Tensor, Accessor, NEMatMul, CpuMatMulSettings, T>; |
| 117 | |
| 118 | // Fast math Template |
| 119 | template <typename T> |
| 120 | using NEMatMulFastMathFixture = MatMulGenericValidationFixture<Tensor, Accessor, NEMatMul, CpuMatMulSettings, T>; |
| 121 | |
| 122 | template <typename T> |
| 123 | using NEMatMulDynamicTensorsFixture = MatMulValidationWithDynamicTensorsFixture<Tensor, Accessor, NEMatMul, CpuMatMulSettings, T>; |
| 124 | |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 125 | template <typename T> |
| 126 | using NEQuantizedMatMulFixture = QuantizedMatMulValidationFixture<Tensor, Accessor, NEMatMul, CpuMatMulSettings, T>; |
| 127 | |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 128 | TEST_SUITE(Float) |
| 129 | TEST_SUITE(FP32) |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 130 | FIXTURE_DATA_TEST_CASE(RunSmall, NEMatMulFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 131 | combine( |
| 132 | datasets::SmallMatMulDataset(), |
| 133 | make("TransposeA", { false, true }), |
| 134 | make("TransposeB", { false, true }), |
| 135 | make("DataType", DataType::F32), |
| 136 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 137 | { |
| 138 | // Validate output |
| 139 | validate(Accessor(_target), _reference, tolerance_fp32); |
| 140 | } |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 141 | FIXTURE_DATA_TEST_CASE(RunLarge, NEMatMulFixture<float>, framework::DatasetMode::NIGHTLY, |
| 142 | combine( |
| 143 | datasets::LargeMatMulDataset(), |
| 144 | make("TransposeA", { false, true }), |
| 145 | make("TransposeB", { false, true }), |
| 146 | make("DataType", DataType::F32), |
| 147 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 148 | { |
| 149 | // Validate output |
| 150 | validate(Accessor(_target), _reference, tolerance_fp32); |
| 151 | } |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 152 | FIXTURE_DATA_TEST_CASE(RunHighDimensions, NEMatMulFixture<float>, framework::DatasetMode::NIGHTLY, |
| 153 | combine( |
| 154 | datasets::HighDimensionalMatMulDataset(), |
| 155 | make("TransposeA", { false, true }), |
| 156 | make("TransposeB", { false, true }), |
| 157 | make("DataType", DataType::F32), |
| 158 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 159 | { |
| 160 | // Validate output |
| 161 | validate(Accessor(_target), _reference, tolerance_fp32); |
| 162 | } |
| 163 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 164 | FIXTURE_DATA_TEST_CASE(RunStressDynamicTensors, NEMatMulDynamicTensorsFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 165 | combine( |
| 166 | datasets::SmallMatMulDataset(), |
| 167 | make("TransposeA", { false, true }), |
| 168 | make("TransposeB", { false, true }), |
| 169 | make("DataType", DataType::F32), |
| 170 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }), |
| 171 | make("NumberOfRuns", 5))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 172 | { |
| 173 | // Validate output |
| 174 | validate(Accessor(_target), _reference, tolerance_fp32); |
| 175 | } |
| 176 | TEST_SUITE_END() // FP32 |
| 177 | |
| 178 | #ifdef ARM_COMPUTE_ENABLE_BF16 |
| 179 | /* Note : MatMul BF16 is enabled by specifying FP32 datatype and enabling the fast math setting */ |
Gunes Bayir | 2aec5f1 | 2024-01-23 17:19:44 +0000 | [diff] [blame] | 180 | constexpr AbsoluteTolerance<float> tolerance_bf16(0.02f); |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 181 | TEST_SUITE(BF16) |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 182 | FIXTURE_DATA_TEST_CASE(RunSmall, NEMatMulFastMathFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 183 | combine( |
| 184 | datasets::SmallMatMulDataset(), |
| 185 | make("TransposeA", { false, true }), |
| 186 | make("TransposeB", { false, true }), |
| 187 | make("DataType", DataType::F32), |
| 188 | make("ActivationInfo", { ActivationLayerInfo() }), |
| 189 | make("RunTimes", { 0 }), |
| 190 | make("Settings", { CpuMatMulSettings().fast_math(true) }), |
| 191 | make("LhsQInfo", { QuantizationInfo() }), |
| 192 | make("RhsQInfo", { QuantizationInfo() }), |
| 193 | make("OutQInfo", { QuantizationInfo() })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 194 | ) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 195 | { |
| 196 | // Validate output |
| 197 | validate(Accessor(_target), _reference, tolerance_bf16); |
| 198 | } |
Gunes Bayir | 2aec5f1 | 2024-01-23 17:19:44 +0000 | [diff] [blame] | 199 | |
| 200 | FIXTURE_DATA_TEST_CASE(RunLarge, NEMatMulFastMathFixture<float>, framework::DatasetMode::NIGHTLY, |
| 201 | combine( |
| 202 | datasets::LargeMatMulDataset(), |
| 203 | make("TransposeA", { false, true }), |
| 204 | make("TransposeB", { false, true }), |
| 205 | make("DataType", DataType::F32), |
| 206 | make("ActivationInfo", { ActivationLayerInfo() }), |
| 207 | make("RunTimes", { 0 }), |
| 208 | make("Settings", { CpuMatMulSettings().fast_math(true) }), |
| 209 | make("LhsQInfo", { QuantizationInfo() }), |
| 210 | make("RhsQInfo", { QuantizationInfo() }), |
| 211 | make("OutQInfo", { QuantizationInfo() })) |
| 212 | ) |
| 213 | { |
| 214 | // Validate output |
| 215 | validate(Accessor(_target), _reference, tolerance_bf16, 0.01 /* tolerance_num */); |
| 216 | } |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 217 | TEST_SUITE_END() // BF16 |
| 218 | #endif /* ARM_COMPUTE_ENABLE_BF16 */ |
| 219 | |
| 220 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 221 | TEST_SUITE(FP16) |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 222 | FIXTURE_DATA_TEST_CASE(RunSmall, NEMatMulFixture<half>, framework::DatasetMode::PRECOMMIT, |
| 223 | combine( |
| 224 | datasets::SmallMatMulDataset(), |
| 225 | make("TransposeA", { false, true }), |
| 226 | make("TransposeB", { false, true }), |
| 227 | make("DataType", DataType::F16), |
| 228 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 229 | { |
| 230 | // Validate output |
| 231 | validate(Accessor(_target), _reference, tolerance_fp16); |
| 232 | } |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 233 | FIXTURE_DATA_TEST_CASE(RunLarge, NEMatMulFixture<half>, framework::DatasetMode::NIGHTLY, |
| 234 | combine( |
| 235 | datasets::LargeMatMulDataset(), |
| 236 | make("TransposeA", { false, true }), |
| 237 | make("TransposeB", { false, true }), |
| 238 | make("DataType", DataType::F16), |
| 239 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 240 | { |
| 241 | // Validate output |
| 242 | validate(Accessor(_target), _reference, tolerance_fp16); |
| 243 | } |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 244 | FIXTURE_DATA_TEST_CASE(RunStressDynamicTensors, NEMatMulDynamicTensorsFixture<half>, framework::DatasetMode::PRECOMMIT, |
| 245 | combine( |
| 246 | datasets::SmallMatMulDataset(), |
| 247 | make("TransposeA", { false, true }), |
| 248 | make("TransposeB", { false, true }), |
| 249 | make("DataType", DataType::F16), |
| 250 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }), |
| 251 | make("NumberOfRuns", 5))) |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 252 | { |
| 253 | // Validate output |
| 254 | validate(Accessor(_target), _reference, tolerance_fp16); |
| 255 | } |
| 256 | TEST_SUITE_END() // FP16 |
| 257 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
| 258 | |
| 259 | TEST_SUITE_END() // Float |
| 260 | |
Ramy Elgammal | 05a65e3 | 2023-04-24 01:58:21 +0100 | [diff] [blame] | 261 | #ifdef __aarch64__ // All the GeMM CPU assembly kernels for integer datatypes require aarch64 |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 262 | TEST_SUITE(Quantized) |
| 263 | |
| 264 | TEST_SUITE(QASYMM8) |
| 265 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 266 | FIXTURE_DATA_TEST_CASE(RunSmall, NEQuantizedMatMulFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 267 | combine( |
| 268 | datasets::SmallMatMulDataset(), |
| 269 | make("TransposeA", { false, true }), |
| 270 | make("TransposeB", { false, true }), |
| 271 | make("DataType", DataType::QASYMM8), |
| 272 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }), |
| 273 | make("NumberOfExtraRuns", { 0, 1 }), |
| 274 | make("LhsQInfo", { QuantizationInfo(1.f / 50, 1) }), |
| 275 | make("RhsQInfo", { QuantizationInfo(1.f / 30, -1) }), |
| 276 | make("OutQInfo", { QuantizationInfo(1.f, 2) })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 277 | ) |
| 278 | { |
| 279 | // Validate output |
| 280 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 281 | } |
| 282 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 283 | FIXTURE_DATA_TEST_CASE(RunSmallExtraActivation, NEQuantizedMatMulFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 284 | combine( |
| 285 | datasets::SmallerMatMulDataset(), |
| 286 | make("TransposeA", { false, true }), |
| 287 | make("TransposeB", { false, true }), |
| 288 | make("DataType", DataType::QASYMM8), |
| 289 | make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU) }), |
| 290 | make("NumberOfExtraRuns", { 0, 1 }), |
| 291 | make("LhsQInfo", { QuantizationInfo(1.f / 50, 1) }), |
| 292 | make("RhsQInfo", { QuantizationInfo(1.f / 30, -1) }), |
| 293 | make("OutQInfo", { QuantizationInfo(1.f, 2) })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 294 | ) |
| 295 | { |
| 296 | // Validate output |
| 297 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 298 | } |
| 299 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 300 | FIXTURE_DATA_TEST_CASE(RunLarge, NEQuantizedMatMulFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 301 | combine( |
| 302 | datasets::LargeMatMulDataset(), |
| 303 | make("TransposeA", { false, true }), |
| 304 | make("TransposeB", { false, true }), |
| 305 | make("DataType", DataType::QASYMM8), |
| 306 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }), |
| 307 | make("NumberOfExtraRuns", { 0, 1 }), |
| 308 | make("LhsQInfo", { QuantizationInfo(1.f / 100, 1) }), |
| 309 | make("RhsQInfo", { QuantizationInfo(1.f / 200, -1) }), |
| 310 | make("OutQInfo", { QuantizationInfo(1.f, 2) })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 311 | ) |
| 312 | { |
| 313 | // Validate output |
| 314 | validate(Accessor(_target), _reference, tolerance_qasymm8); |
| 315 | } |
| 316 | |
| 317 | TEST_SUITE_END() // QASYMM8 |
| 318 | |
| 319 | TEST_SUITE(QASYMM8_SIGNED) |
| 320 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 321 | FIXTURE_DATA_TEST_CASE(RunSmall, NEQuantizedMatMulFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 322 | combine( |
| 323 | datasets::SmallMatMulDataset(), |
| 324 | make("TransposeA", { false, true }), |
| 325 | make("TransposeB", { false, true }), |
| 326 | make("DataType", DataType::QASYMM8_SIGNED), |
| 327 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }), |
| 328 | make("NumberOfExtraRuns", { 0, 1 }), |
| 329 | make("LhsQInfo", { QuantizationInfo(1.f / 40, -2) }), |
| 330 | make("RhsQInfo", { QuantizationInfo(1.f / 50, 1) }), |
| 331 | make("OutQInfo", { QuantizationInfo(1.f, 1) })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 332 | ) |
| 333 | { |
| 334 | // Validate output |
| 335 | validate(Accessor(_target), _reference, tolerance_qasymm8_signed); |
| 336 | } |
| 337 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 338 | FIXTURE_DATA_TEST_CASE(RunSmallExtraActivation, NEQuantizedMatMulFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
| 339 | combine( |
| 340 | datasets::SmallerMatMulDataset(), |
| 341 | make("TransposeA", { false, true }), |
| 342 | make("TransposeB", { false, true }), |
| 343 | make("DataType", DataType::QASYMM8_SIGNED), |
| 344 | make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU) }), |
| 345 | make("NumberOfExtraRuns", { 0, 1 }), |
| 346 | make("LhsQInfo", { QuantizationInfo(1.f / 40, -2) }), |
| 347 | make("RhsQInfo", { QuantizationInfo(1.f / 50, 1) }), |
| 348 | make("OutQInfo", { QuantizationInfo(1.f, 1) })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 349 | ) |
| 350 | { |
| 351 | // Validate output |
| 352 | validate(Accessor(_target), _reference, tolerance_qasymm8_signed); |
| 353 | } |
| 354 | |
Viet-Hoa Do | c85edf1 | 2023-09-01 16:48:17 +0100 | [diff] [blame] | 355 | FIXTURE_DATA_TEST_CASE(RunLarge, NEQuantizedMatMulFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
| 356 | combine( |
| 357 | datasets::LargeMatMulDataset(), |
| 358 | make("TransposeA", { false, true }), |
| 359 | make("TransposeB", { false, true }), |
| 360 | make("DataType", DataType::QASYMM8_SIGNED), |
| 361 | make("ActivationInfo", { ActivationLayerInfo(), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) }), |
| 362 | make("NumberOfExtraRuns", { 0, 1 }), |
| 363 | make("LhsQInfo", { QuantizationInfo(1.f / 150, -2) }), |
| 364 | make("RhsQInfo", { QuantizationInfo(1.f / 250, 1) }), |
| 365 | make("OutQInfo", { QuantizationInfo(1.f, 1) })) |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 366 | ) |
| 367 | { |
| 368 | // Validate output |
| 369 | validate(Accessor(_target), _reference, tolerance_qasymm8_signed); |
| 370 | } |
| 371 | |
| 372 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 373 | |
| 374 | TEST_SUITE_END() // Quantized |
Ramy Elgammal | 05a65e3 | 2023-04-24 01:58:21 +0100 | [diff] [blame] | 375 | #endif // __aarch64__ |
Viet-Hoa Do | 9c7c2d2 | 2023-04-11 17:16:27 +0100 | [diff] [blame] | 376 | |
Mohammed Suhail Munshi | a1b1e41 | 2023-03-23 22:21:31 +0000 | [diff] [blame] | 377 | TEST_SUITE_END() // MatMul |
| 378 | TEST_SUITE_END() // NEON |
| 379 | } // namespace validation |
| 380 | } // namespace test |
| 381 | } // namespace arm_compute |