From 40f51a63c8e7258db15269427ae4fe1ad199c550 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Sat, 21 Nov 2020 03:04:18 +0000 Subject: Update default C++ standard to C++14 (3RDPARTY_UPDATE) Resolves: COMPMID-3849 Signed-off-by: Georgios Pinitas Change-Id: I6369f112337310140e2d6c8e79630cd11138dfa0 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4544 Tested-by: Arm Jenkins Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins --- tests/CL/Helper.h | 10 +++++----- tests/NEON/Helper.h | 12 ++++++------ tests/RawTensor.cpp | 8 ++++---- tests/SimpleTensor.h | 7 +++---- tests/framework/Framework.cpp | 4 ++-- tests/framework/Framework.h | 2 +- tests/framework/TestCaseFactory.h | 5 ++--- tests/framework/command_line/CommonOptions.cpp | 12 ++++++------ tests/framework/instruments/Instrument.h | 4 +--- tests/framework/instruments/SchedulerTimer.cpp | 2 +- tests/main.cpp | 13 ++++++------- tests/validate_examples/RunExample.cpp | 6 +++--- tests/validate_examples/graph_validate_utils.h | 10 +++++----- tests/validation/CL/UNIT/TensorAllocator.cpp | 6 +++--- tests/validation/NEON/UNIT/TensorAllocator.cpp | 10 ++++------ tests/validation/fixtures/UNIT/DynamicTensorFixture.h | 6 +++--- 16 files changed, 55 insertions(+), 62 deletions(-) (limited to 'tests') diff --git a/tests/CL/Helper.h b/tests/CL/Helper.h index e548af4938..d217af6e18 100644 --- a/tests/CL/Helper.h +++ b/tests/CL/Helper.h @@ -33,7 +33,7 @@ #include "src/core/CL/ICLKernel.h" -#include "support/MemorySupport.h" +#include namespace arm_compute { @@ -51,7 +51,7 @@ public: template void configure(Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->configure(std::forward(args)...); _kernel = std::move(k); } @@ -63,7 +63,7 @@ public: template void configure(GPUTarget gpu_target, Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->set_target(gpu_target); k->configure(std::forward(args)...); _kernel = std::move(k); @@ -92,7 +92,7 @@ public: template void configure(T first, Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->configure(first, std::forward(args)...); _kernel = std::move(k); _border_handler->configure(first, BorderSize(bordersize), BorderMode::CONSTANT, PixelValue()); @@ -113,7 +113,7 @@ public: template void configure(T first, T second, Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->set_target(CLScheduler::get().target()); k->configure(first, second, std::forward(args)...); _kernel = std::move(k); diff --git a/tests/NEON/Helper.h b/tests/NEON/Helper.h index ea47a416b1..714152ebcd 100644 --- a/tests/NEON/Helper.h +++ b/tests/NEON/Helper.h @@ -28,11 +28,11 @@ #include "arm_compute/runtime/NEON/INESimpleFunction.h" #include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" #include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "support/MemorySupport.h" #include "tests/Globals.h" #include #include +#include #include namespace arm_compute @@ -64,7 +64,7 @@ public: template void configure(Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->configure(std::forward(args)...); _kernel = std::move(k); } @@ -92,11 +92,11 @@ public: template void configure(T first, Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->configure(first, std::forward(args)...); _kernel = std::move(k); - auto b = arm_compute::support::cpp14::make_unique(); + auto b = std::make_unique(); b->configure(first, BorderSize(bordersize), BorderMode::CONSTANT, PixelValue()); _border_handler = std::move(b); } @@ -115,11 +115,11 @@ public: template void configure(T first, Args &&... args) { - auto k = arm_compute::support::cpp14::make_unique(); + auto k = std::make_unique(); k->configure(first, std::forward(args)...); _kernel = std::move(k); - auto b = arm_compute::support::cpp14::make_unique(); + auto b = std::make_unique(); b->configure(first, BorderSize(_kernel->border_size()), BorderMode::CONSTANT, PixelValue()); _border_handler = std::move(b); } diff --git a/tests/RawTensor.cpp b/tests/RawTensor.cpp index a32886e425..8d610a4969 100644 --- a/tests/RawTensor.cpp +++ b/tests/RawTensor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 Arm Limited. + * Copyright (c) 2017-2020 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -30,20 +30,20 @@ namespace test RawTensor::RawTensor(TensorShape shape, Format format) : SimpleTensor(shape, format) { - _buffer = support::cpp14::make_unique(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size()); + _buffer = std::make_unique(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size()); } RawTensor::RawTensor(TensorShape shape, DataType data_type, int num_channels) : SimpleTensor(shape, data_type, num_channels) { - _buffer = support::cpp14::make_unique(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size()); + _buffer = std::make_unique(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size()); } RawTensor::RawTensor(const RawTensor &tensor) : SimpleTensor(tensor.shape(), tensor.data_type(), tensor.num_channels()) { _format = tensor.format(); - _buffer = support::cpp14::make_unique(num_elements() * num_channels() * element_size()); + _buffer = std::make_unique(num_elements() * num_channels() * element_size()); std::copy_n(tensor.data(), num_elements() * num_channels() * element_size(), _buffer.get()); } diff --git a/tests/SimpleTensor.h b/tests/SimpleTensor.h index 82a53521ac..c1bd7f87b5 100644 --- a/tests/SimpleTensor.h +++ b/tests/SimpleTensor.h @@ -27,7 +27,6 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/core/Utils.h" -#include "support/MemorySupport.h" #include "tests/IAccessor.h" #include "tests/Utils.h" @@ -268,7 +267,7 @@ SimpleTensor::SimpleTensor(TensorShape shape, Format format) _data_layout(DataLayout::NCHW) { _num_channels = num_channels(); - _buffer = support::cpp14::make_unique(num_elements() * _num_channels); + _buffer = std::make_unique(num_elements() * _num_channels); } template @@ -280,7 +279,7 @@ SimpleTensor::SimpleTensor(TensorShape shape, DataType data_type, int num_cha _quantization_info(quantization_info), _data_layout(data_layout) { - _buffer = support::cpp14::make_unique(this->_shape.total_size() * _num_channels); + _buffer = std::make_unique(this->_shape.total_size() * _num_channels); } template @@ -293,7 +292,7 @@ SimpleTensor::SimpleTensor(const SimpleTensor &tensor) _quantization_info(tensor.quantization_info()), _data_layout(tensor.data_layout()) { - _buffer = support::cpp14::make_unique(tensor.num_elements() * _num_channels); + _buffer = std::make_unique(tensor.num_elements() * _num_channels); std::copy_n(tensor.data(), this->_shape.total_size() * _num_channels, _buffer.get()); } diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index 8e836ee41f..a1c684c08a 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -24,7 +24,6 @@ #include "Framework.h" #include "arm_compute/runtime/Scheduler.h" -#include "support/MemorySupport.h" #include "tests/framework/ParametersLibrary.h" #include "tests/framework/TestFilter.h" @@ -36,6 +35,7 @@ #include #include +#include #include #include @@ -94,7 +94,7 @@ Framework::Framework() Instrument::make_instrument); #endif /* ARM_COMPUTE_CL */ - instruments_info = support::cpp14::make_unique(); + instruments_info = std::make_unique(); } std::set Framework::available_instruments() const diff --git a/tests/framework/Framework.h b/tests/framework/Framework.h index 01ab37347e..cf854f2351 100644 --- a/tests/framework/Framework.h +++ b/tests/framework/Framework.h @@ -355,7 +355,7 @@ private: template inline void Framework::add_test_case(std::string test_name, DatasetMode mode, TestCaseFactory::Status status) { - _test_factories.emplace_back(support::cpp14::make_unique>(current_suite_name(), std::move(test_name), mode, status)); + _test_factories.emplace_back(std::make_unique>(current_suite_name(), std::move(test_name), mode, status)); } template diff --git a/tests/framework/TestCaseFactory.h b/tests/framework/TestCaseFactory.h index 97ba230743..a41226af24 100644 --- a/tests/framework/TestCaseFactory.h +++ b/tests/framework/TestCaseFactory.h @@ -26,7 +26,6 @@ #include "DatasetModes.h" #include "TestCase.h" -#include "support/MemorySupport.h" #include #include @@ -183,7 +182,7 @@ inline ::std::ostream &operator<<(::std::ostream &stream, TestCaseFactory::Statu template inline std::unique_ptr SimpleTestCaseFactory::make() const { - return support::cpp14::make_unique(); + return std::make_unique(); } template @@ -195,7 +194,7 @@ inline DataTestCaseFactory::DataTestCaseFactory(std::string suite_name, st template inline std::unique_ptr DataTestCaseFactory::make() const { - return support::cpp14::make_unique(_data); + return std::make_unique(_data); } } // namespace framework } // namespace test diff --git a/tests/framework/command_line/CommonOptions.cpp b/tests/framework/command_line/CommonOptions.cpp index b4bf58bfdc..6fb37470c1 100644 --- a/tests/framework/command_line/CommonOptions.cpp +++ b/tests/framework/command_line/CommonOptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Arm Limited. + * Copyright (c) 2018-2020 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -101,7 +101,7 @@ std::vector> CommonOptions::create_printers() if(pretty_console->value() && (log_file->is_set() || log_format->value() != LogFormat::PRETTY)) { - auto pretty_printer = support::cpp14::make_unique(); + auto pretty_printer = std::make_unique(); pretty_printer->set_color_output(color_output->value()); printers.push_back(std::move(pretty_printer)); } @@ -110,13 +110,13 @@ std::vector> CommonOptions::create_printers() switch(log_format->value()) { case LogFormat::JSON: - printer = support::cpp14::make_unique(); + printer = std::make_unique(); break; case LogFormat::NONE: break; case LogFormat::PRETTY: default: - auto pretty_printer = support::cpp14::make_unique(); + auto pretty_printer = std::make_unique(); // Don't use colours if we print to a file: pretty_printer->set_color_output((!log_file->is_set()) && color_output->value()); printer = std::move(pretty_printer); @@ -139,14 +139,14 @@ std::vector> CommonOptions::create_printers() if(json_file->is_set()) { - printers.push_back(support::cpp14::make_unique()); + printers.push_back(std::make_unique()); log_streams.push_back(std::make_shared(json_file->value())); printers.back()->set_stream(*log_streams.back().get()); } if(pretty_file->is_set()) { - printers.push_back(support::cpp14::make_unique()); + printers.push_back(std::make_unique()); log_streams.push_back(std::make_shared(pretty_file->value())); printers.back()->set_stream(*log_streams.back().get()); } diff --git a/tests/framework/instruments/Instrument.h b/tests/framework/instruments/Instrument.h index 4506460515..3ea15825ad 100644 --- a/tests/framework/instruments/Instrument.h +++ b/tests/framework/instruments/Instrument.h @@ -24,8 +24,6 @@ #ifndef ARM_COMPUTE_TEST_INSTRUMENT #define ARM_COMPUTE_TEST_INSTRUMENT -#include "support/MemorySupport.h" - #include "../Utils.h" #include "Measurement.h" @@ -135,7 +133,7 @@ protected: template inline std::unique_ptr Instrument::make_instrument() { - return support::cpp14::make_unique(scale); + return std::make_unique(scale); } } // namespace framework diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp index b4d1c597e7..c81b807c3e 100644 --- a/tests/framework/instruments/SchedulerTimer.cpp +++ b/tests/framework/instruments/SchedulerTimer.cpp @@ -188,7 +188,7 @@ void SchedulerClock::test_start() { if(user != nullptr && user->scheduler() != nullptr) { - user->intercept_scheduler(support::cpp14::make_unique>(_kernels, *user->scheduler(), _scale_factor)); + user->intercept_scheduler(std::make_unique>(_kernels, *user->scheduler(), _scale_factor)); } }); } diff --git a/tests/main.cpp b/tests/main.cpp index f0d5df7d84..46a081b6c8 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "support/MemorySupport.h" #include "support/StringSupport.h" #include "tests/AssetsLibrary.h" #include "tests/framework/DatasetModes.h" @@ -166,20 +165,20 @@ int main(int argc, char **argv) Scheduler::get().set_num_threads(threads->value()); // Create CPU context - auto cpu_ctx = support::cpp14::make_unique(); + auto cpu_ctx = std::make_unique(); cpu_ctx->set_scheduler(&Scheduler::get()); // Track CPU context - auto cpu_ctx_track = support::cpp14::make_unique(cpu_ctx.get()); + auto cpu_ctx_track = std::make_unique(cpu_ctx.get()); // Create parameters - parameters = support::cpp14::make_unique(); + parameters = std::make_unique(); parameters->set_cpu_ctx(std::move(cpu_ctx)); #ifdef ARM_COMPUTE_GC // Setup OpenGL context { - auto gles_ctx = support::cpp14::make_unique(); + auto gles_ctx = std::make_unique(); ARM_COMPUTE_ERROR_ON(gles_ctx == nullptr); { // Legacy singletons API: This has been deprecated and the singletons will be removed @@ -312,8 +311,8 @@ int main(int argc, char **argv) return 0; } - library = support::cpp14::make_unique(assets->value(), seed->value()); - fixed_library = support::cpp14::make_unique(assets->value(), fixed_seed); + library = std::make_unique(assets->value(), seed->value()); + fixed_library = std::make_unique(assets->value(), fixed_seed); if(!parser.validate()) { diff --git a/tests/validate_examples/RunExample.cpp b/tests/validate_examples/RunExample.cpp index aca4ddcc7c..736d4816f5 100644 --- a/tests/validate_examples/RunExample.cpp +++ b/tests/validate_examples/RunExample.cpp @@ -27,8 +27,8 @@ #include "utils/Utils.cpp" #include "ValidateExample.h" -#include "arm_compute/runtime/Scheduler.h" #include "arm_compute/runtime/CL/CLHelpers.h" +#include "arm_compute/runtime/Scheduler.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/framework/Framework.h" @@ -139,8 +139,8 @@ int run_example(int argc, char **argv, std::unique_ptr example) g_example_argv.emplace_back(const_cast(arg.c_str())); // NOLINT } - library = support::cpp14::make_unique("." /* Only using random values */, seed->value()); - fixed_library = support::cpp14::make_unique(".", fixed_seed); + library = std::make_unique("." /* Only using random values */, seed->value()); + fixed_library = std::make_unique(".", fixed_seed); if(options.log_level->value() > framework::LogLevel::NONE) { diff --git a/tests/validate_examples/graph_validate_utils.h b/tests/validate_examples/graph_validate_utils.h index 36134a4cea..f6f47cc2c3 100644 --- a/tests/validate_examples/graph_validate_utils.h +++ b/tests/validate_examples/graph_validate_utils.h @@ -337,11 +337,11 @@ inline std::unique_ptr get_accessor(const TensorParams & { if(!tensor.npy.empty()) { - return arm_compute::support::cpp14::make_unique(tensor.npy); + return std::make_unique(tensor.npy); } else { - return arm_compute::support::cpp14::make_unique(lower, upper, seed); + return std::make_unique(lower, upper, seed); } } @@ -607,17 +607,17 @@ inline std::unique_ptr get_verify_accessor(ExampleParams { case DataType::QASYMM8: { - return arm_compute::support::cpp14::make_unique>( + return std::make_unique>( params); } case DataType::F16: { - return arm_compute::support::cpp14::make_unique>( + return std::make_unique>( params); } case DataType::F32: { - return arm_compute::support::cpp14::make_unique>( + return std::make_unique>( params); } default: diff --git a/tests/validation/CL/UNIT/TensorAllocator.cpp b/tests/validation/CL/UNIT/TensorAllocator.cpp index 9db98fb534..3ccdd99fe3 100644 --- a/tests/validation/CL/UNIT/TensorAllocator.cpp +++ b/tests/validation/CL/UNIT/TensorAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 Arm Limited. + * Copyright (c) 2018-2020 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -135,10 +135,10 @@ TEST_CASE(ImportMemoryMalloc, framework::DatasetMode::ALL) const size_t total_size_in_bytes = tensor.info()->total_size(); const size_t alignment = CLKernelLibrary::get().get_device().getInfo(); size_t space = total_size_in_bytes + alignment; - auto raw_data = support::cpp14::make_unique(space); + auto raw_data = std::make_unique(space); void *aligned_ptr = raw_data.get(); - support::cpp11::align(alignment, total_size_in_bytes, aligned_ptr, space); + std::align(alignment, total_size_in_bytes, aligned_ptr, space); cl::Buffer wrapped_buffer(import_malloc_memory_helper(aligned_ptr, total_size_in_bytes)); ARM_COMPUTE_EXPECT(bool(tensor.allocator()->import_memory(wrapped_buffer)), framework::LogLevel::ERRORS); diff --git a/tests/validation/NEON/UNIT/TensorAllocator.cpp b/tests/validation/NEON/UNIT/TensorAllocator.cpp index 273d2e0a4f..ef19524d1c 100644 --- a/tests/validation/NEON/UNIT/TensorAllocator.cpp +++ b/tests/validation/NEON/UNIT/TensorAllocator.cpp @@ -29,8 +29,6 @@ #include "arm_compute/runtime/MemoryRegion.h" #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" -#include "support/MemorySupport.h" - #include "tests/Globals.h" #include "tests/Utils.h" #include "tests/framework/Asserts.h" @@ -58,7 +56,7 @@ TEST_CASE(ImportMemory, framework::DatasetMode::ALL) // Allocate memory buffer const size_t total_size = info.total_size(); - auto data = support::cpp14::make_unique(total_size); + auto data = std::make_unique(total_size); // Negative case : Import nullptr Tensor t1; @@ -111,10 +109,10 @@ TEST_CASE(ImportMemoryMalloc, framework::DatasetMode::ALL) const size_t total_size_in_elems = tensor.info()->tensor_shape().total_size(); const size_t total_size_in_bytes = tensor.info()->total_size(); size_t space = total_size_in_bytes + required_alignment; - auto raw_data = support::cpp14::make_unique(space); + auto raw_data = std::make_unique(space); void *aligned_ptr = raw_data.get(); - support::cpp11::align(required_alignment, total_size_in_bytes, aligned_ptr, space); + std::align(required_alignment, total_size_in_bytes, aligned_ptr, space); ARM_COMPUTE_EXPECT(bool(tensor.allocator()->import_memory(aligned_ptr)), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(!tensor.info()->is_resizable(), framework::LogLevel::ERRORS); @@ -160,7 +158,7 @@ TEST_CASE(ImportMemoryMallocPadded, framework::DatasetMode::ALL) // Allocate and import tensor const size_t total_size_in_bytes = tensor.info()->total_size(); - auto raw_data = support::cpp14::make_unique(total_size_in_bytes); + auto raw_data = std::make_unique(total_size_in_bytes); ARM_COMPUTE_EXPECT(bool(tensor.allocator()->import_memory(raw_data.get())), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(!tensor.info()->is_resizable(), framework::LogLevel::ERRORS); diff --git a/tests/validation/fixtures/UNIT/DynamicTensorFixture.h b/tests/validation/fixtures/UNIT/DynamicTensorFixture.h index 74e62fb77f..4ac19bf3ba 100644 --- a/tests/validation/fixtures/UNIT/DynamicTensorFixture.h +++ b/tests/validation/fixtures/UNIT/DynamicTensorFixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Arm Limited. + * Copyright (c) 2019-2020 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -264,7 +264,7 @@ public: _info = info; // Create function - _f_target = support::cpp14::make_unique(_ms.mm); + _f_target = std::make_unique(_ms.mm); } void run_iteration(unsigned int idx) @@ -425,7 +425,7 @@ protected: for(unsigned int i = 0; i < num_functions; ++i) { - _functions.emplace_back(support::cpp14::make_unique(_ms.mm)); + _functions.emplace_back(std::make_unique(_ms.mm)); } for(unsigned int i = 0; i < num_resizes; ++i) -- cgit v1.2.1