From 5d75d4a236bd4d73b514bd81d902fbdbd660b00a Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Thu, 15 Apr 2021 12:54:53 +0100 Subject: Fix validation bug in release mode for armv7 Resolve COMPMID-4377, COMPMID-4379 Change-Id: I302f08b5bf0afb5295d31843fea20181d9283658 Signed-off-by: Giorgio Arena Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5435 Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- SConstruct | 2 - arm_compute/core/TensorShape.h | 11 ----- tests/validation/CL/FullyConnectedLayer.cpp | 69 ++++++++++++----------------- 3 files changed, 29 insertions(+), 53 deletions(-) diff --git a/SConstruct b/SConstruct index ea140f52ff..5f65099322 100644 --- a/SConstruct +++ b/SConstruct @@ -338,8 +338,6 @@ elif env['os'] == 'bare_metal': env.Append(CPPDEFINES = ['BARE_METAL']) if env['os'] == 'linux' and env['arch'] == 'armv7a': env.Append(CXXFLAGS = [ '-Wno-psabi' ]) - if not env['debug']: - env.Append(CPPDEFINES = ['LINUX_V7_RELEASE']) if env['specs_file'] != "": env.Append(LINKFLAGS = ['-specs='+env['specs_file']]) diff --git a/arm_compute/core/TensorShape.h b/arm_compute/core/TensorShape.h index 9f6cf773e4..b6ab9dc75a 100644 --- a/arm_compute/core/TensorShape.h +++ b/arm_compute/core/TensorShape.h @@ -57,18 +57,7 @@ public: apply_dimension_correction(); } /** Allow instances of this class to be copy constructed */ - // Avoid -O3 aggressive optimization for the copy constructor when building in release mode for armv7a -#if defined(LINUX_V7_RELEASE) -#pragma GCC push_options -#pragma GCC optimize("O2") - TensorShape(const TensorShape &other) - : Dimensions(static_cast(other)) - { - } -#pragma GCC pop_options -#else // defined(LINUX_V7_RELEASE) TensorShape(const TensorShape &) = default; -#endif // defined(LINUX_V7_RELEASE) /** Allow instances of this class to be copied */ TensorShape &operator=(const TensorShape &) = default; /** Allow instances of this class to be move constructed */ diff --git a/tests/validation/CL/FullyConnectedLayer.cpp b/tests/validation/CL/FullyConnectedLayer.cpp index 066f0b689e..7b313e7c50 100644 --- a/tests/validation/CL/FullyConnectedLayer.cpp +++ b/tests/validation/CL/FullyConnectedLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -51,15 +51,6 @@ constexpr float tolerance_num = 0.07f; /**< Tolerance n /** Tolerance for quantized asymmetric operations */ constexpr AbsoluteTolerance tolerance_qasymm8(1); -/** CNN data types */ -const auto CNNDataTypes = framework::dataset::make("DataType", -{ - DataType::F16, - DataType::F32, - DataType::QASYMM8, - DataType::QASYMM8_SIGNED, -}); - const auto FullyConnectedParameters = combine(framework::dataset::make("TransposeWeights", { false, true }), framework::dataset::make("ReshapeWeights", { false, true })); const auto QuantizationData = framework::dataset::make("QuantizationInfo", @@ -77,13 +68,11 @@ const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH) }); -const auto ActivationFunctionsQuantizedDataset = framework::dataset::make("ActivationInfo", -{ - ActivationLayerInfo(), - ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), - ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f), - ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.75f, 0.25f) -}); +const auto ActivationFunctionsQuantizedDataset = concat(concat(concat( + framework::dataset::make("ActivationInfo", ActivationLayerInfo()), + framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))), + framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f))), + framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.75f, 0.25f))); } // namespace TEST_SUITE(CL) @@ -170,13 +159,13 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixture, framework: validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0, abs_tolerance_f32); } FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLFullyConnectedLayerMixedDataLayoutFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(combine( - framework::dataset::make("Input", TensorShape(9U, 5U, 7U)), - framework::dataset::make("Weights", TensorShape(315U, 271U))), - framework::dataset::make("Biases", TensorShape(271U))), - framework::dataset::make("Output", TensorShape(271U))), - FullyConnectedParameters), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)))) + framework::dataset::make("Input", TensorShape(9U, 5U, 7U)), + framework::dataset::make("Weights", TensorShape(315U, 271U))), + framework::dataset::make("Biases", TensorShape(271U))), + framework::dataset::make("Output", TensorShape(271U))), + FullyConnectedParameters), + framework::dataset::make("DataType", DataType::F32)), + framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)))) { // Validate output validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0, abs_tolerance_f32); @@ -207,14 +196,14 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerQuantizedFixture, } FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLFullyConnectedLayerQuantizedMixedDataLayoutFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(combine(combine( - framework::dataset::make("Input", TensorShape(9U, 5U, 7U)), - framework::dataset::make("Weights", TensorShape(315U, 271U))), - framework::dataset::make("Biases", TensorShape(271U))), - framework::dataset::make("Output", TensorShape(271U))), - FullyConnectedParameters), - framework::dataset::make("DataType", DataType::QASYMM8)), - QuantizationData), - framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)))) + framework::dataset::make("Input", TensorShape(9U, 5U, 7U)), + framework::dataset::make("Weights", TensorShape(315U, 271U))), + framework::dataset::make("Biases", TensorShape(271U))), + framework::dataset::make("Output", TensorShape(271U))), + FullyConnectedParameters), + framework::dataset::make("DataType", DataType::QASYMM8)), + QuantizationData), + framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)))) { // Validate output validate(CLAccessor(_target), _reference, tolerance_qasymm8); @@ -237,14 +226,14 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerQuantizedFixture, } FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLFullyConnectedLayerQuantizedMixedDataLayoutFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(combine(combine( - framework::dataset::make("Input", TensorShape(9U, 5U, 7U)), - framework::dataset::make("Weights", TensorShape(315U, 271U))), - framework::dataset::make("Biases", TensorShape(271U))), - framework::dataset::make("Output", TensorShape(271U))), - FullyConnectedParameters), - framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), - QuantizationData), - framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)))) + framework::dataset::make("Input", TensorShape(9U, 5U, 7U)), + framework::dataset::make("Weights", TensorShape(315U, 271U))), + framework::dataset::make("Biases", TensorShape(271U))), + framework::dataset::make("Output", TensorShape(271U))), + FullyConnectedParameters), + framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), + QuantizationData), + framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)))) { // Validate output validate(CLAccessor(_target), _reference, tolerance_qasymm8); -- cgit v1.2.1