diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-02-20 17:09:28 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-02-26 13:35:36 +0000 |
commit | 0b192e84510c006d87cee3c29f95511ad088b704 (patch) | |
tree | 80abef10e2afde5dcab6715b207ebca4d7dc0755 /arm_compute | |
parent | 582163206bbfb03b3af0009d6ec2d9bab747780d (diff) | |
download | ComputeLibrary-0b192e84510c006d87cee3c29f95511ad088b704.tar.gz |
COMPMID-3067: Address gcc9 failures
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I048d1d7dda7edf587d37ce83a93b557d8a95754a
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2771
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/core/CL/OpenCL.h | 6 | ||||
-rw-r--r-- | arm_compute/graph/backends/FunctionHelpers.h | 73 | ||||
-rw-r--r-- | arm_compute/runtime/FunctionDescriptors.h | 7 | ||||
-rw-r--r-- | arm_compute/runtime/MemoryGroup.h | 12 |
4 files changed, 53 insertions, 45 deletions
diff --git a/arm_compute/core/CL/OpenCL.h b/arm_compute/core/CL/OpenCL.h index 7be65c894a..b87cc67b72 100644 --- a/arm_compute/core/CL/OpenCL.h +++ b/arm_compute/core/CL/OpenCL.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 ARM Limited. + * Copyright (c) 2016-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -62,7 +62,7 @@ class CLSymbols final { public: /** Default Constructor */ - CLSymbols() = default; + CLSymbols() noexcept(false); /** Load OpenCL symbols from handle * * @param[in] handle Handle to load symbols from @@ -141,7 +141,7 @@ public: #undef DECLARE_FUNCTION_PTR private: - std::pair<bool, bool> _loaded{ false, false }; + std::pair<bool, bool> _loaded; }; } // namespace arm_compute #endif /* ARM_COMPUTE_OPENCL_H */ diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h index 20c69bfffa..44b24b58bf 100644 --- a/arm_compute/graph/backends/FunctionHelpers.h +++ b/arm_compute/graph/backends/FunctionHelpers.h @@ -47,6 +47,13 @@ namespace backends { namespace detail { +// Address rule DR-9R5 (1579. Return by converting move constructor) +#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5)) +#define RETURN_UNIQUE_PTR(x) (x) +#else /* defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5)) */ +#define RETURN_UNIQUE_PTR(x) (std::move(x)) +#endif /* defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5)) */ + /** Returns backing tensor of a given tensor * * @tparam TargetInfo Target information @@ -121,7 +128,7 @@ std::unique_ptr<IFunction> create_activation_layer(ActivationLayerNode &node) << " InPlace : " << is_in_place_operation(input, output) << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend batch normalization layer function @@ -165,7 +172,7 @@ std::unique_ptr<IFunction> create_batch_normalization_layer(BatchNormalizationLa << " InPlace: " << is_in_place_operation(input, output) << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend batch normalization layer function @@ -222,7 +229,7 @@ std::unique_ptr<IFunction> create_fused_convolution_batch_normalization_layer(Fu << " Output shape: " << output->info()->tensor_shape() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend fused depthwise convolution batch normalization layer function @@ -278,7 +285,7 @@ std::unique_ptr<IFunction> create_fused_depthwise_convolution_batch_normalizatio << " Output shape: " << output->info()->tensor_shape() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend bounding box transform layer function @@ -316,7 +323,7 @@ std::unique_ptr<IFunction> create_bounding_box_transform_layer(BoundingBoxTransf << " BoundingBox Info img H: " << bbox_info.img_height() << " " << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend channel shuffle layer function @@ -351,7 +358,7 @@ std::unique_ptr<IFunction> create_channel_shuffle_layer(ChannelShuffleLayerNode << " Num groups: " << num_groups << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend layer concatenate function @@ -407,7 +414,7 @@ std::unique_ptr<arm_compute::IFunction> create_concatenate_layer(ConcatenateLaye << qss.str() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend convolution layer function @@ -498,7 +505,7 @@ std::unique_ptr<IFunction> create_convolution_layer(ConvolutionLayerNode &node, << qss.str() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend deconvolution layer function @@ -604,7 +611,7 @@ std::unique_ptr<IFunction> create_depthwise_convolution_layer(DepthwiseConvoluti << qss.str() << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "") << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend dequantize layer function @@ -643,7 +650,7 @@ std::unique_ptr<IFunction> create_dequantization_layer(DequantizationLayerNode & << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend detection output layer function * @@ -688,7 +695,7 @@ std::unique_ptr<IFunction> create_detection_output_layer(DetectionOutputLayerNod << " DetectionOutputLayer info: " << detect_info << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend detection post process layer function @@ -743,7 +750,7 @@ std::unique_ptr<IFunction> create_detection_post_process_layer(DetectionPostProc << " DetectionPostProcessLayer info: " << detect_info << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend element-wise operation layer function @@ -805,7 +812,7 @@ std::unique_ptr<IFunction> create_eltwise_layer(EltwiseLayerNode &node) << " Shape: " << input1->info()->tensor_shape() << std::endl); - return func; + return RETURN_UNIQUE_PTR(func); } /** Create a backend flatten layer function @@ -843,7 +850,7 @@ std::unique_ptr<IFunction> create_flatten_layer(FlattenLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend fully connected layer function @@ -899,7 +906,7 @@ std::unique_ptr<IFunction> create_fully_connected_layer(FullyConnectedLayerNode << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend generate proposals layer function @@ -948,7 +955,7 @@ std::unique_ptr<IFunction> create_generate_proposals_layer(GenerateProposalsLaye << " Scores Out shape: " << scores_out->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend normalization layer function @@ -990,7 +997,7 @@ std::unique_ptr<IFunction> create_normalization_layer(NormalizationLayerNode &no << " Normalization info: " << norm_info.type() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend normalize planar YUV layer function @@ -1030,7 +1037,7 @@ std::unique_ptr<IFunction> create_normalize_planar_yuv_layer(NormalizePlanarYUVL << " Shape: " << input->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend pad layer function @@ -1069,7 +1076,7 @@ std::unique_ptr<IFunction> create_pad_layer(PadLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend permute layer function @@ -1108,7 +1115,7 @@ std::unique_ptr<IFunction> create_permute_layer(PermuteLayerNode &node) << " Permutation vector: " << perm << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend pooling layer function @@ -1147,7 +1154,7 @@ std::unique_ptr<IFunction> create_pooling_layer(PoolingLayerNode &node) << " Pooling info: " << pool_info.pool_type << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend PRelu layer function @@ -1185,7 +1192,7 @@ std::unique_ptr<IFunction> create_prelu_layer(PReluLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend print layer function @@ -1256,7 +1263,7 @@ std::unique_ptr<IFunction> create_priorbox_layer(PriorBoxLayerNode &node) << " PriorBoxLayer info: " << prior_info << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend quantization layer function @@ -1293,7 +1300,7 @@ std::unique_ptr<IFunction> create_quantization_layer(QuantizationLayerNode &node << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend reorg layer function @@ -1330,7 +1337,7 @@ std::unique_ptr<IFunction> create_reorg_layer(ReorgLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend reshape layer function @@ -1367,7 +1374,7 @@ std::unique_ptr<IFunction> create_reshape_layer(ReshapeLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend resize layer function @@ -1406,7 +1413,7 @@ std::unique_ptr<IFunction> create_resize_layer(ResizeLayerNode &node) << " Interpolation: " << policy << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend ROI align layer function @@ -1451,7 +1458,7 @@ std::unique_ptr<IFunction> create_roi_align_layer(ROIAlignLayerNode &node) << " ROIPooling height: " << pool_info.pooled_height() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend slice layer function @@ -1488,7 +1495,7 @@ std::unique_ptr<IFunction> create_slice_layer(SliceLayerNode &node) << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend softmax layer function @@ -1527,7 +1534,7 @@ std::unique_ptr<IFunction> create_softmax_layer(SoftmaxLayerNode &node, GraphCon << " Output shape: " << output->info()->tensor_shape() << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend layer stack function @@ -1570,7 +1577,7 @@ std::unique_ptr<arm_compute::IFunction> create_stack_layer(StackLayerNode &node) << " Axis: " << axis << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend Upsample layer function * @@ -1614,7 +1621,7 @@ std::unique_ptr<IFunction> create_upsample_layer(UpsampleLayerNode &node, GraphC << " Upsampling policy: " << upsampling_policy << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } /** Create a backend YOLO layer function * @@ -1657,7 +1664,7 @@ std::unique_ptr<IFunction> create_yolo_layer(YOLOLayerNode &node, GraphContext & << " Num classes: " << num_classes << std::endl); - return std::move(func); + return RETURN_UNIQUE_PTR(func); } } // namespace detail } // namespace backends diff --git a/arm_compute/runtime/FunctionDescriptors.h b/arm_compute/runtime/FunctionDescriptors.h index d523c56907..3706d0859f 100644 --- a/arm_compute/runtime/FunctionDescriptors.h +++ b/arm_compute/runtime/FunctionDescriptors.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 ARM Limited. + * Copyright (c) 2019-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,8 +44,9 @@ struct FFT1DInfo /** Descriptor used by the FFT2D function */ struct FFT2DInfo { - std::pair<unsigned int, unsigned int> axes{ 0, 1 }; /**< Axes to run on. If same, multiple transforms are performed on single axis*/ - FFTDirection direction{ FFTDirection::Forward }; /**< Direction of the FFT. */ + unsigned int axis0{ 0 }; /**< Axis to run first pass on. If same, multiple transforms are performed on single axis*/ + unsigned int axis1{ 1 }; /**< Axis to run second pass on. If same, multiple transforms are performed on single axis*/ + FFTDirection direction{ FFTDirection::Forward }; /**< Direction of the FFT. */ }; } // namespace arm_compute #endif /* ARM_COMPUTE_RUNTIME_FUNCTION_DESCRIPTORS_H */ diff --git a/arm_compute/runtime/MemoryGroup.h b/arm_compute/runtime/MemoryGroup.h index ba1dbc0a28..4d484954a1 100644 --- a/arm_compute/runtime/MemoryGroup.h +++ b/arm_compute/runtime/MemoryGroup.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,9 +44,7 @@ class MemoryGroup final : public IMemoryGroup { public: /** Default Constructor */ - MemoryGroup(IMemoryManager *memory_manager); - /** Default Constructor */ - MemoryGroup(std::shared_ptr<IMemoryManager> = nullptr); + MemoryGroup(std::shared_ptr<IMemoryManager> = nullptr) noexcept; /** Default destructor */ ~MemoryGroup() = default; /** Prevent instances of this class from being copied (As this class contains pointers) */ @@ -71,8 +69,10 @@ private: MemoryMappings _mappings; /**< Memory mappings of the group */ }; -inline MemoryGroup::MemoryGroup(std::shared_ptr<IMemoryManager> memory_manager) - : _memory_manager(memory_manager), _pool(nullptr), _mappings() +inline MemoryGroup::MemoryGroup(std::shared_ptr<IMemoryManager> memory_manager) noexcept + : _memory_manager(memory_manager), + _pool(nullptr), + _mappings() { } |