From fbf3ecc1833b860019f965c88cda87ec9f44c3d5 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Thu, 23 Aug 2018 17:26:21 +0100 Subject: COMPMID-1534 - Fix GEMM and Magnitude test for FP16 On GEMM we had accuracy issue On Magnitude we have disabled the fp16 acceleration since we do not have feature parity with CL and this function is not used for ML Change-Id: Iaebe3bbbd2a9f45db0c714aa5ebaf48eb0b65741 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/145467 Tested-by: Jenkins Reviewed-by: Georgios Pinitas Reviewed-by: Anthony Barbier --- tests/validation/NEON/GEMM.cpp | 12 ++++++++---- tests/validation/NEON/Magnitude.cpp | 35 ++++++----------------------------- 2 files changed, 14 insertions(+), 33 deletions(-) (limited to 'tests/validation/NEON') diff --git a/tests/validation/NEON/GEMM.cpp b/tests/validation/NEON/GEMM.cpp index 9c64131a61..ded5ec68c4 100644 --- a/tests/validation/NEON/GEMM.cpp +++ b/tests/validation/NEON/GEMM.cpp @@ -49,8 +49,12 @@ namespace validation { namespace { -constexpr AbsoluteTolerance tolerance_f(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */ - +constexpr AbsoluteTolerance tolerance_f(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for FP32 data types */ +#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC +RelativeTolerance rel_tolerance_f16(half(0.2)); /**< Relative tolerance value for comparing reference's output against implementation's output for FP16 data types */ +const AbsoluteTolerance abs_tolerance_f16(0.2f); /**< Absolute tolerance value for comparing reference's output against implementation's output for FP16 data types */ +constexpr float tolerance_num = 0.07f; /**< Tolerance number for FP16 data types */ +#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ /** CNN data types */ const auto CNNDataTypes = framework::dataset::make("DataType", { @@ -125,13 +129,13 @@ TEST_SUITE(FP16) FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::F16))) { // Validate output - validate(Accessor(_target), _reference, tolerance_f); + validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16); } FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::F16))) { // Validate output - validate(Accessor(_target), _reference, tolerance_f); + validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16); } TEST_SUITE_END() #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ diff --git a/tests/validation/NEON/Magnitude.cpp b/tests/validation/NEON/Magnitude.cpp index 3b7562b61c..e1549a54b2 100644 --- a/tests/validation/NEON/Magnitude.cpp +++ b/tests/validation/NEON/Magnitude.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,15 +44,6 @@ AbsoluteTolerance tolerance(MagnitudeType magnitude_type) { return AbsoluteTolerance((MagnitudeType::L1NORM == magnitude_type) ? 0 : 1); } - -#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC -template <> -AbsoluteTolerance tolerance(MagnitudeType magnitude_type) -{ - return AbsoluteTolerance((MagnitudeType::L1NORM == magnitude_type) ? half(0.0) : half(1.0)); -} -#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ - } // namespace TEST_SUITE(NEON) @@ -88,36 +79,22 @@ template using NEMagnitudeFixture = MagnitudeValidationFixture; TEST_SUITE(S16) -FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S16)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })), - framework::dataset::make("UseFP16", false))) +FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S16)), + framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }))) + { // Validate output validate(Accessor(_target), _reference, tolerance(_magnitude_type)); } -FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })), - framework::dataset::make("UseFP16", false))) +FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)), + framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }))) { // Validate output validate(Accessor(_target), _reference, tolerance(_magnitude_type)); } TEST_SUITE_END() // S16 -#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC -TEST_SUITE(F16) -FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", - Format::S16)), - framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })), - framework::dataset::make("UseFP16", true))) -{ - // Validate output - validate(Accessor(_target), _reference, tolerance(_magnitude_type)); -} -TEST_SUITE_END() // F16 -#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ - TEST_SUITE_END() TEST_SUITE_END() } // namespace validation -- cgit v1.2.1