From 879d1313ba69d9ced8424f54ffeea6a3c60496f0 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 30 Sep 2019 13:25:53 +0100 Subject: COMPMID-2452: Fix compilation issues on armclang Change-Id: I41bd60760270a2c7d83e391fd9430b4513ab00bc Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/2002 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- arm_compute/core/CPP/CPPTypes.h | 6 +++--- arm_compute/graph/Graph.h | 7 +++++-- arm_compute/graph/Types.h | 2 +- .../graph/detail/CrossLayerMemoryManagerHelpers.h | 4 ++-- arm_compute/graph/detail/ExecutionHelpers.h | 4 ++-- arm_compute/runtime/IMemoryGroup.h | 8 -------- arm_compute/runtime/IRuntimeContext.h | 2 +- arm_compute/runtime/ITransformWeights.h | 16 +++++++++++++--- src/graph/Graph.cpp | 2 +- src/runtime/CPUUtils.cpp | 5 ----- src/runtime/PoolManager.cpp | 14 +++++++------- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/arm_compute/core/CPP/CPPTypes.h b/arm_compute/core/CPP/CPPTypes.h index 0ac8bf6e52..87fa442672 100644 --- a/arm_compute/core/CPP/CPPTypes.h +++ b/arm_compute/core/CPP/CPPTypes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -113,8 +113,8 @@ public: */ CPUInfo &operator=(const CPUInfo &cpuinfo) = delete; CPUInfo(const CPUInfo &cpuinfo) = delete; - CPUInfo &operator=(const CPUInfo &&cpuinfo) = delete; - CPUInfo(const CPUInfo &&cpuinfo) = delete; + CPUInfo &operator=(CPUInfo &&cpuinfo) = default; + CPUInfo(CPUInfo &&cpuinfo) = default; /** Checks if the cpu model supports fp16. * diff --git a/arm_compute/graph/Graph.h b/arm_compute/graph/Graph.h index 878976f0af..92507e74e9 100644 --- a/arm_compute/graph/Graph.h +++ b/arm_compute/graph/Graph.h @@ -35,10 +35,13 @@ #include #include #include -#include #include #include +#ifndef BARE_METAL +#include +#endif /* BARE_METAL */ + namespace arm_compute { namespace graph @@ -231,7 +234,7 @@ private: template inline NodeID Graph::add_node(Ts &&... args) { - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); // Create node NodeID nid = _nodes.size(); diff --git a/arm_compute/graph/Types.h b/arm_compute/graph/Types.h index 63b1c94ac8..5b82f93686 100644 --- a/arm_compute/graph/Types.h +++ b/arm_compute/graph/Types.h @@ -73,7 +73,7 @@ constexpr NodeID EmptyNodeID = std::numeric_limits::max(); constexpr EdgeID EmptyEdgeID = std::numeric_limits::max(); // Forward declarations -class TensorDescriptor; +struct TensorDescriptor; /** Graph configuration structure */ struct GraphConfig { diff --git a/arm_compute/graph/detail/CrossLayerMemoryManagerHelpers.h b/arm_compute/graph/detail/CrossLayerMemoryManagerHelpers.h index b7424c8e88..da17806011 100644 --- a/arm_compute/graph/detail/CrossLayerMemoryManagerHelpers.h +++ b/arm_compute/graph/detail/CrossLayerMemoryManagerHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ namespace graph // Forward declarations class Graph; class GraphContext; -class ExecutionWorkload; +struct ExecutionWorkload; class ITransMemoryManager; class ITensorHandle; diff --git a/arm_compute/graph/detail/ExecutionHelpers.h b/arm_compute/graph/detail/ExecutionHelpers.h index fd8d082770..955e6d5e1e 100644 --- a/arm_compute/graph/detail/ExecutionHelpers.h +++ b/arm_compute/graph/detail/ExecutionHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ namespace graph // Forward declarations class Graph; class GraphContext; -class ExecutionWorkload; +struct ExecutionWorkload; class Tensor; class INode; diff --git a/arm_compute/runtime/IMemoryGroup.h b/arm_compute/runtime/IMemoryGroup.h index 4736acb559..540af8ba69 100644 --- a/arm_compute/runtime/IMemoryGroup.h +++ b/arm_compute/runtime/IMemoryGroup.h @@ -91,14 +91,6 @@ public: { _memory_group.acquire(); } - /** Prevent instances of this class from being copied (As this class contains pointers) */ - MemoryGroupResourceScope(const MemoryGroupResourceScope &) = delete; - /** Default move constructor */ - MemoryGroupResourceScope(MemoryGroupResourceScope &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - MemoryGroupResourceScope &operator=(const MemoryGroupResourceScope &) = delete; - /** Default move assignment operator */ - MemoryGroupResourceScope &operator=(MemoryGroupResourceScope &&) = default; /** Destructor */ ~MemoryGroupResourceScope() { diff --git a/arm_compute/runtime/IRuntimeContext.h b/arm_compute/runtime/IRuntimeContext.h index f928085682..2bca6c7677 100644 --- a/arm_compute/runtime/IRuntimeContext.h +++ b/arm_compute/runtime/IRuntimeContext.h @@ -29,7 +29,7 @@ namespace arm_compute // Forward declarations class IScheduler; class IAssetManager; -class DeviceProperties; +struct DeviceProperties; /** Context interface */ class IRuntimeContext diff --git a/arm_compute/runtime/ITransformWeights.h b/arm_compute/runtime/ITransformWeights.h index 6376c30088..c41df18c92 100644 --- a/arm_compute/runtime/ITransformWeights.h +++ b/arm_compute/runtime/ITransformWeights.h @@ -65,9 +65,20 @@ public: /** Prevent instances of this class to be copied */ ITransformWeights &operator=(const ITransformWeights &) = delete; /** Allow instances of this class to be move constructed */ - ITransformWeights(ITransformWeights &&) = default; + ITransformWeights(ITransformWeights &&other) + { + *this = std::move(other); + } /** Allow instances of this class to be moved */ - ITransformWeights &operator=(ITransformWeights &&) = default; + ITransformWeights &operator=(ITransformWeights &&other) + { + if(this != &other) + { + _num_refcount = other._num_refcount.load(); + _reshape_run = other._reshape_run; + } + return *this; + } /** Get a pointer to the transformed weights * @@ -111,7 +122,6 @@ protected: std::atomic _num_refcount{ 0 }; bool _reshape_run{ false }; }; - } // arm_compute #endif /*__ARM_COMPUTE_ITRANSFORMWEIGHTS_H__ */ \ No newline at end of file diff --git a/src/graph/Graph.cpp b/src/graph/Graph.cpp index 9d437b1834..edc8d6b33d 100644 --- a/src/graph/Graph.cpp +++ b/src/graph/Graph.cpp @@ -68,7 +68,7 @@ bool Graph::remove_node(NodeID nid) EdgeID Graph::add_connection(NodeID source, size_t source_idx, NodeID sink, size_t sink_idx) { - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); // Check if node index is valid, if node exists and finally if the connection index is valid ARM_COMPUTE_ERROR_ON((source >= _nodes.size()) || (_nodes[source] == nullptr) || (source_idx >= _nodes[source]->num_outputs())); diff --git a/src/runtime/CPUUtils.cpp b/src/runtime/CPUUtils.cpp index f7240db99e..5860720d3b 100644 --- a/src/runtime/CPUUtils.cpp +++ b/src/runtime/CPUUtils.cpp @@ -30,13 +30,8 @@ #include #include #include -#include #include #include -#include -#include -#include -#include #ifndef BARE_METAL /* C++ std::regex takes up a lot of space in the standalone builds */ diff --git a/src/runtime/PoolManager.cpp b/src/runtime/PoolManager.cpp index 5ec2ce92c1..c865c0ca27 100644 --- a/src/runtime/PoolManager.cpp +++ b/src/runtime/PoolManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -41,7 +41,7 @@ IMemoryPool *PoolManager::lock_pool() ARM_COMPUTE_ERROR_ON_MSG(_free_pools.empty() && _occupied_pools.empty(), "Haven't setup any pools!"); _sem->wait(); - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); ARM_COMPUTE_ERROR_ON_MSG(_free_pools.empty(), "Empty pool must exist as semaphore has been signalled"); _occupied_pools.splice(std::begin(_occupied_pools), _free_pools, std::begin(_free_pools)); return _occupied_pools.front().get(); @@ -51,7 +51,7 @@ void PoolManager::unlock_pool(IMemoryPool *pool) { ARM_COMPUTE_ERROR_ON_MSG(_free_pools.empty() && _occupied_pools.empty(), "Haven't setup any pools!"); - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); auto it = std::find_if(std::begin(_occupied_pools), std::end(_occupied_pools), [pool](const std::unique_ptr &pool_it) { return pool_it.get() == pool; @@ -63,7 +63,7 @@ void PoolManager::unlock_pool(IMemoryPool *pool) void PoolManager::register_pool(std::unique_ptr pool) { - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); ARM_COMPUTE_ERROR_ON_MSG(!_occupied_pools.empty(), "All pools should be free in order to register a new one!"); // Set pool @@ -75,7 +75,7 @@ void PoolManager::register_pool(std::unique_ptr pool) std::unique_ptr PoolManager::release_pool() { - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); ARM_COMPUTE_ERROR_ON_MSG(!_occupied_pools.empty(), "All pools should be free in order to release one!"); if(!_free_pools.empty()) @@ -95,7 +95,7 @@ std::unique_ptr PoolManager::release_pool() void PoolManager::clear_pools() { - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); ARM_COMPUTE_ERROR_ON_MSG(!_occupied_pools.empty(), "All pools should be free in order to clear the PoolManager!"); _free_pools.clear(); @@ -105,7 +105,7 @@ void PoolManager::clear_pools() size_t PoolManager::num_pools() const { - std::lock_guard lock(_mtx); + arm_compute::lock_guard lock(_mtx); return _free_pools.size() + _occupied_pools.size(); } \ No newline at end of file -- cgit v1.2.1