aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2019-09-09 19:00:57 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-09-17 11:37:02 +0000
commit26014cf4d0519aef280c8444c60ec34c4e37e3b6 (patch)
tree7f4b3cb8589c10e95288a722498c9256e8bf5e22
parentcaa7deedfe1b0d0020c6099d8f616ec92b1bd5e9 (diff)
downloadComputeLibrary-26014cf4d0519aef280c8444c60ec34c4e37e3b6.tar.gz
COMPMID-2649: Generalize MemoryGroup.
Avoids any upcasting. Change-Id: I2181c7c9df59a7fb8a78e11934fbd96058fd39c7 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-on: https://review.mlplatform.org/c/1918 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
-rw-r--r--arm_compute/runtime/CL/CLMemoryGroup.h46
-rw-r--r--arm_compute/runtime/CL/CLTensor.h5
-rw-r--r--arm_compute/runtime/CL/CLTensorAllocator.h21
-rw-r--r--arm_compute/runtime/CL/functions/CLCannyEdge.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLConvolution.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h2
-rw-r--r--arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLDirectDeconvolutionLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLFFT1D.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLFFT2D.h10
-rw-r--r--arm_compute/runtime/CL/functions/CLFFTConvolutionLayer.h2
-rw-r--r--arm_compute/runtime/CL/functions/CLFastCorners.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLGEMM.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLGaussian5x5.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLGaussianPyramid.h3
-rw-r--r--arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLHOGDescriptor.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLHOGGradient.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLHOGMultiDetection.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLHarrisCorners.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLLSTMLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h2
-rw-r--r--arm_compute/runtime/CL/functions/CLLocallyConnectedLayer.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLMeanStdDev.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLOpticalFlow.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLRNNLayer.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLReduceMean.h2
-rw-r--r--arm_compute/runtime/CL/functions/CLReductionOperation.h4
-rw-r--r--arm_compute/runtime/CL/functions/CLSobel5x5.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLSobel7x7.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLSoftmaxLayer.h6
-rw-r--r--arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h2
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h48
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/GCTensor.h8
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h19
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h6
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h6
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h6
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.h6
-rw-r--r--arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h8
-rw-r--r--arm_compute/runtime/IMemoryGroup.h36
-rw-r--r--arm_compute/runtime/MemoryGroup.h109
-rw-r--r--arm_compute/runtime/MemoryGroupBase.h165
-rw-r--r--arm_compute/runtime/NEON/functions/NEReduceMean.h3
-rw-r--r--arm_compute/runtime/Tensor.h7
-rw-r--r--arm_compute/runtime/TensorAllocator.h22
-rw-r--r--docs/01_library.dox4
-rw-r--r--src/graph/backends/CL/CLDeviceBackend.cpp4
-rw-r--r--src/graph/backends/CL/CLTensorHandle.cpp8
-rw-r--r--src/graph/backends/GLES/GCDeviceBackend.cpp6
-rw-r--r--src/graph/backends/GLES/GCTensorHandle.cpp8
-rw-r--r--src/graph/backends/NEON/NETensorHandle.cpp5
-rw-r--r--src/runtime/CL/CLTensor.cpp10
-rw-r--r--src/runtime/CL/CLTensorAllocator.cpp9
-rw-r--r--src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp1
-rw-r--r--src/runtime/CL/functions/CLSoftmaxLayer.cpp1
-rw-r--r--src/runtime/GLES_COMPUTE/GCTensor.cpp14
-rw-r--r--src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp8
-rw-r--r--src/runtime/Tensor.cpp12
-rw-r--r--src/runtime/TensorAllocator.cpp18
-rw-r--r--tests/validation/CL/UNIT/MemoryManager.cpp4
-rw-r--r--tests/validation/CL/UNIT/TensorAllocator.cpp6
-rw-r--r--tests/validation/GLES_COMPUTE/UNIT/MemoryManager.cpp4
68 files changed, 330 insertions, 468 deletions
diff --git a/arm_compute/runtime/CL/CLMemoryGroup.h b/arm_compute/runtime/CL/CLMemoryGroup.h
deleted file mode 100644
index db2372025..000000000
--- a/arm_compute/runtime/CL/CLMemoryGroup.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_CLMEMORYGROUP_H__
-#define __ARM_COMPUTE_CLMEMORYGROUP_H__
-
-#include "arm_compute/runtime/MemoryGroupBase.h"
-
-#include "arm_compute/core/CL/OpenCL.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-
-namespace arm_compute
-{
-/** Memory Group in OpenCL */
-using CLMemoryGroup = MemoryGroupBase<CLTensor>;
-
-template <>
-inline void MemoryGroupBase<CLTensor>::associate_memory_group(CLTensor *obj)
-{
- ARM_COMPUTE_ERROR_ON(obj == nullptr);
- auto allocator = dynamic_cast<CLTensorAllocator *>(obj->allocator());
- ARM_COMPUTE_ERROR_ON(allocator == nullptr);
- allocator->set_associated_memory_group(this);
-}
-} // arm_compute
-#endif /*__ARM_COMPUTE_CLMEMORYGROUP_H__ */
diff --git a/arm_compute/runtime/CL/CLTensor.h b/arm_compute/runtime/CL/CLTensor.h
index 65ff4f2bb..bc7283949 100644
--- a/arm_compute/runtime/CL/CLTensor.h
+++ b/arm_compute/runtime/CL/CLTensor.h
@@ -37,7 +37,7 @@ class ITensorAllocator;
class ITensorInfo;
/** Basic implementation of the OpenCL tensor interface */
-class CLTensor : public ICLTensor
+class CLTensor : public ICLTensor, public IMemoryManageable
{
public:
/** Constructor */
@@ -68,6 +68,7 @@ public:
TensorInfo *info() override;
const cl::Buffer &cl_buffer() const override;
CLQuantization quantization() const override;
+ void associate_memory_group(IMemoryGroup *memory_group) override;
protected:
// Inherited methods overridden:
@@ -80,5 +81,5 @@ private:
/** OpenCL Image */
using CLImage = CLTensor;
-}
+} // namespace arm_compute
#endif /*__ARM_COMPUTE_CLTENSOR_H__ */
diff --git a/arm_compute/runtime/CL/CLTensorAllocator.h b/arm_compute/runtime/CL/CLTensorAllocator.h
index f7800d39f..3450c72d6 100644
--- a/arm_compute/runtime/CL/CLTensorAllocator.h
+++ b/arm_compute/runtime/CL/CLTensorAllocator.h
@@ -27,6 +27,7 @@
#include "arm_compute/runtime/CL/CLArray.h"
#include "arm_compute/runtime/CL/CLMemory.h"
#include "arm_compute/runtime/ITensorAllocator.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/core/CL/CLTypes.h"
#include "arm_compute/core/CL/OpenCL.h"
@@ -36,10 +37,6 @@
namespace arm_compute
{
class CLTensor;
-template <typename>
-class MemoryGroupBase;
-/** Memory Group in OpenCL */
-using CLMemoryGroup = MemoryGroupBase<CLTensor>;
/** Basic implementation of a CL memory tensor allocator. */
class CLTensorAllocator : public ITensorAllocator
@@ -49,7 +46,7 @@ public:
*
* @param[in] owner (Optional) Owner of the allocator.
*/
- CLTensorAllocator(CLTensor *owner = nullptr);
+ CLTensorAllocator(IMemoryManageable *owner = nullptr);
/** Prevent instances of this class from being copied (As this class contains pointers) */
CLTensorAllocator(const CLTensorAllocator &) = delete;
/** Prevent instances of this class from being copy assigned (As this class contains pointers) */
@@ -127,7 +124,7 @@ public:
*
* @param[in] associated_memory_group Memory group to associate the tensor with
*/
- void set_associated_memory_group(CLMemoryGroup *associated_memory_group);
+ void set_associated_memory_group(IMemoryGroup *associated_memory_group);
protected:
/** Call map() on the OpenCL buffer.
@@ -142,12 +139,12 @@ private:
static const cl::Buffer _empty_buffer;
private:
- CLMemoryGroup *_associated_memory_group; /**< Registered memory manager */
- CLMemory _memory; /**< OpenCL memory */
- uint8_t *_mapping; /**< Pointer to the CPU mapping of the OpenCL buffer. */
- CLTensor *_owner; /**< Owner of the allocator */
- CLFloatArray _scale; /**< Scales array in case of quantized per channel data type */
- CLInt32Array _offset; /**< Offsets array in case of quantized per channel data type */
+ IMemoryManageable *_owner; /**< Memory manageable object that owns the allocator */
+ IMemoryGroup *_associated_memory_group; /**< Registered memory manager */
+ CLMemory _memory; /**< OpenCL memory */
+ uint8_t *_mapping; /**< Pointer to the CPU mapping of the OpenCL buffer. */
+ CLFloatArray _scale; /**< Scales array in case of quantized per channel data type */
+ CLInt32Array _offset; /**< Offsets array in case of quantized per channel data type */
};
} // namespace arm_compute
#endif /* __ARM_COMPUTE_CLTENSORALLOCATOR_H__ */
diff --git a/arm_compute/runtime/CL/functions/CLCannyEdge.h b/arm_compute/runtime/CL/functions/CLCannyEdge.h
index 13b31b292..ab5657caa 100644
--- a/arm_compute/runtime/CL/functions/CLCannyEdge.h
+++ b/arm_compute/runtime/CL/functions/CLCannyEdge.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,9 +28,9 @@
#include "arm_compute/core/CL/kernels/CLCannyEdgeKernel.h"
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -74,7 +74,7 @@ public:
virtual void run() override;
private:
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
std::unique_ptr<IFunction> _sobel; /**< Pointer to Sobel kernel. */
CLGradientKernel _gradient; /**< Gradient kernel. */
CLFillBorderKernel _border_mag_gradient; /**< Fill border on magnitude tensor kernel */
diff --git a/arm_compute/runtime/CL/functions/CLConvolution.h b/arm_compute/runtime/CL/functions/CLConvolution.h
index bc05cb2a8..b79affca9 100644
--- a/arm_compute/runtime/CL/functions/CLConvolution.h
+++ b/arm_compute/runtime/CL/functions/CLConvolution.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,11 +27,11 @@
#include "arm_compute/core/CL/kernels/CLConvolutionKernel.h"
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/ICLSimpleFunction.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -89,7 +89,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
CLTensor _tmp; /**< temporary buffer for output of horizontal pass */
bool _is_separable; /**< true if the convolution can be separated */
CLSeparableConvolutionHorKernel<matrix_size> _kernel_hor; /**< kernel for horizontal pass of separated convolution */
diff --git a/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h b/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h
index cab252f0e..977626411 100644
--- a/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h
+++ b/arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h
@@ -29,9 +29,7 @@
#include "arm_compute/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h"
#include "arm_compute/core/CL/kernels/CLMemsetKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/IFunction.h"
-#include "arm_compute/runtime/IMemoryManager.h"
namespace arm_compute
{
diff --git a/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h
index b25c36a93..d177f4505 100644
--- a/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h
+++ b/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h
@@ -35,11 +35,11 @@
#include "arm_compute/core/CL/kernels/CLGEMMMatrixVectorMultiplyKernel.h"
#include "arm_compute/core/CL/kernels/ICLDepthwiseConvolutionLayer3x3Kernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
#include "arm_compute/runtime/CL/functions/CLPermute.h"
#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -103,7 +103,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
std::unique_ptr<ICLDepthwiseConvolutionLayer3x3Kernel> _kernel;
CLFillBorderKernel _border_handler;
CLPermute _permute_input_to_nchw;
diff --git a/arm_compute/runtime/CL/functions/CLDirectDeconvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDirectDeconvolutionLayer.h
index b9a435abb..9dfc827bf 100644
--- a/arm_compute/runtime/CL/functions/CLDirectDeconvolutionLayer.h
+++ b/arm_compute/runtime/CL/functions/CLDirectDeconvolutionLayer.h
@@ -29,10 +29,10 @@
#include "arm_compute/runtime/CL/functions/CLReverse.h"
#include "arm_compute/runtime/CL/functions/CLTranspose.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -115,7 +115,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLDeconvolutionLayerUpsample _scale_f;
CLConvolutionLayer _conv_f;
CLReverse _flip_weights;
diff --git a/arm_compute/runtime/CL/functions/CLFFT1D.h b/arm_compute/runtime/CL/functions/CLFFT1D.h
index c7f90dd0f..47b15084a 100644
--- a/arm_compute/runtime/CL/functions/CLFFT1D.h
+++ b/arm_compute/runtime/CL/functions/CLFFT1D.h
@@ -29,9 +29,9 @@
#include "arm_compute/core/CL/kernels/CLFFTDigitReverseKernel.h"
#include "arm_compute/core/CL/kernels/CLFFTRadixStageKernel.h"
#include "arm_compute/core/CL/kernels/CLFFTScaleKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/FunctionDescriptors.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -70,7 +70,7 @@ public:
void run() override;
protected:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLFFTDigitReverseKernel _digit_reverse_kernel;
std::vector<CLFFTRadixStageKernel> _fft_kernels;
CLFFTScaleKernel _scale_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLFFT2D.h b/arm_compute/runtime/CL/functions/CLFFT2D.h
index a0673ecc9..d53f1ef8b 100644
--- a/arm_compute/runtime/CL/functions/CLFFT2D.h
+++ b/arm_compute/runtime/CL/functions/CLFFT2D.h
@@ -26,10 +26,10 @@
#include "arm_compute/runtime/IFunction.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLFFT1D.h"
#include "arm_compute/runtime/FunctionDescriptors.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -67,10 +67,10 @@ public:
void run() override;
protected:
- CLMemoryGroup _memory_group;
- CLFFT1D _first_pass_func;
- CLFFT1D _second_pass_func;
- CLTensor _first_pass_tensor;
+ MemoryGroup _memory_group;
+ CLFFT1D _first_pass_func;
+ CLFFT1D _second_pass_func;
+ CLTensor _first_pass_tensor;
};
} // namespace arm_compute
#endif /*__ARM_COMPUTE_CLFFT2D_H__ */
diff --git a/arm_compute/runtime/CL/functions/CLFFTConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLFFTConvolutionLayer.h
index 2fabe3454..d326c5982 100644
--- a/arm_compute/runtime/CL/functions/CLFFTConvolutionLayer.h
+++ b/arm_compute/runtime/CL/functions/CLFFTConvolutionLayer.h
@@ -109,7 +109,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLReverse _flip_weights_func;
CLPermute _permute_input_func;
CLPermute _permute_output_func;
diff --git a/arm_compute/runtime/CL/functions/CLFastCorners.h b/arm_compute/runtime/CL/functions/CLFastCorners.h
index 404b561e4..2c208aba3 100644
--- a/arm_compute/runtime/CL/functions/CLFastCorners.h
+++ b/arm_compute/runtime/CL/functions/CLFastCorners.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -29,11 +29,11 @@
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Window.h"
#include "arm_compute/runtime/CL/CLArray.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLNonMaximaSuppression3x3.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -75,7 +75,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLFastCornersKernel _fast_corners_kernel;
CLNonMaximaSuppression3x3 _suppr_func;
CLCopyToArrayKernel _copy_array_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h b/arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h
index e800dd7cb..7cf7d951b 100644
--- a/arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h
+++ b/arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h
@@ -28,13 +28,13 @@
#include "arm_compute/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.h"
#include "arm_compute/core/CL/kernels/CLTransposeKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLConvertFullyConnectedWeights.h"
#include "arm_compute/runtime/CL/functions/CLFlattenLayer.h"
#include "arm_compute/runtime/CL/functions/CLGEMM.h"
#include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h"
#include "arm_compute/runtime/CL/functions/CLGEMMLowpOutputStage.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -129,7 +129,7 @@ private:
void configure_conv_fc(const ICLTensor *input, const ICLTensor *weights, ICLTensor *output, bool retain_internal_weights);
void configure_mm(const ICLTensor *input, const ICLTensor *weights, ICLTensor *output, bool retain_internal_weights);
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLConvertFullyConnectedWeights _convert_weights;
CLFlattenLayer _flatten_layer;
CLFullyConnectedLayerReshapeWeights _reshape_weights_kernel;
@@ -149,5 +149,5 @@ private:
bool _is_prepared;
const ICLTensor *_original_weights;
};
-}
+} // namespace arm_compute
#endif /* __ARM_COMPUTE_CLFULLYCONNECTEDLAYER_H__ */
diff --git a/arm_compute/runtime/CL/functions/CLGEMM.h b/arm_compute/runtime/CL/functions/CLGEMM.h
index 7efeb129d..b8e5fa67d 100644
--- a/arm_compute/runtime/CL/functions/CLGEMM.h
+++ b/arm_compute/runtime/CL/functions/CLGEMM.h
@@ -29,10 +29,10 @@
#include "arm_compute/core/CL/kernels/CLGEMMMatrixMultiplyReshapedOnlyRHSKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -123,7 +123,7 @@ private:
static Status validate_reshaped_v2(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info);
static Status validate_reshaped_only_rhs(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info);
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLGEMMMatrixMultiplyKernel _mm_kernel;
CLGEMMReshapeLHSMatrixKernel _reshape_lhs_kernel;
CLGEMMReshapeRHSMatrixKernel _reshape_rhs_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h
index 027727c7f..d29a31a53 100644
--- a/arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h
+++ b/arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h
@@ -32,7 +32,6 @@
#include "arm_compute/core/CL/kernels/CLIm2ColKernel.h"
#include "arm_compute/core/CL/kernels/CLWeightsReshapeKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
#include "arm_compute/runtime/CL/functions/CLGEMM.h"
@@ -40,6 +39,7 @@
#include "arm_compute/runtime/CL/functions/CLGEMMLowpOutputStage.h"
#include "arm_compute/runtime/CL/functions/CLReshapeLayer.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -186,7 +186,7 @@ private:
int gemm_3d_depth, bool skip_im2col, const ActivationLayerInfo &act_info);
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLConvolutionLayerReshapeWeights _reshape_weights;
CLIm2ColKernel _im2col_kernel;
CLGEMM _mm_gemm;
diff --git a/arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h b/arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h
index b28fa0f3f..0a7199515 100644
--- a/arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h
+++ b/arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h
@@ -25,7 +25,6 @@
#define __ARM_COMPUTE_CLGEMMDECONVOLUTIONLAYER_H__
#include "arm_compute/core/CL/kernels/CLDeconvolutionReshapeOutputKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
#include "arm_compute/runtime/CL/functions/CLPermute.h"
@@ -34,6 +33,7 @@
#include "arm_compute/runtime/CL/functions/CLTranspose.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -114,7 +114,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLGEMM _mm_gemm;
CLGEMMLowpMatrixMultiplyCore _mm_gemmlowp;
diff --git a/arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h b/arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h
index 541985b50..6aacbf6ab 100644
--- a/arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h
+++ b/arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h
@@ -31,9 +31,9 @@
#include "arm_compute/core/CL/kernels/CLGEMMLowpOffsetContributionOutputStageKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMLowpReductionKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -100,7 +100,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLGEMMLowpMatrixMultiplyKernel _mm_midgard_kernel;
CLGEMMLowpMatrixMultiplyNativeKernel _mm_native_kernel;
CLGEMMLowpMatrixMultiplyReshapedOnlyRHSKernel _mm_reshaped_only_rhs_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLGaussian5x5.h b/arm_compute/runtime/CL/functions/CLGaussian5x5.h
index 892fe146d..0f5a6cd97 100644
--- a/arm_compute/runtime/CL/functions/CLGaussian5x5.h
+++ b/arm_compute/runtime/CL/functions/CLGaussian5x5.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,10 +27,10 @@
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
#include "arm_compute/core/CL/kernels/CLGaussian5x5Kernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -67,7 +67,7 @@ public:
void run() override;
protected:
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
CLGaussian5x5HorKernel _kernel_hor; /**< Horizontal pass kernel */
CLGaussian5x5VertKernel _kernel_vert; /**< Vertical pass kernel */
CLFillBorderKernel _border_handler; /**< Kernel to handle image borders */
diff --git a/arm_compute/runtime/CL/functions/CLGaussianPyramid.h b/arm_compute/runtime/CL/functions/CLGaussianPyramid.h
index 332f806a2..292d07809 100644
--- a/arm_compute/runtime/CL/functions/CLGaussianPyramid.h
+++ b/arm_compute/runtime/CL/functions/CLGaussianPyramid.h
@@ -40,8 +40,7 @@ namespace arm_compute
{
class ICLTensor;
-/** Common interface for all Gaussian pyramid functions
- */
+/** Common interface for all Gaussian pyramid functions */
class CLGaussianPyramid : public IFunction
{
public:
diff --git a/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h b/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h
index 26da0bfd7..efbbe44c1 100644
--- a/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h
+++ b/arm_compute/runtime/CL/functions/CLGenerateProposalsLayer.h
@@ -32,11 +32,11 @@
#include "arm_compute/core/CL/kernels/CLStridedSliceKernel.h"
#include "arm_compute/core/CPP/kernels/CPPBoxWithNonMaximaSuppressionLimitKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CPP/CPPScheduler.h"
#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -109,7 +109,7 @@ public:
private:
// Memory group manager
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
// OpenCL kernels
CLPermuteKernel _permute_deltas_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLHOGDescriptor.h b/arm_compute/runtime/CL/functions/CLHOGDescriptor.h
index 00d64f109..ce229ea06 100644
--- a/arm_compute/runtime/CL/functions/CLHOGDescriptor.h
+++ b/arm_compute/runtime/CL/functions/CLHOGDescriptor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -26,11 +26,11 @@
#include "arm_compute/core/CL/kernels/CLHOGDescriptorKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLHOGGradient.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -64,7 +64,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLHOGGradient _gradient;
CLHOGOrientationBinningKernel _orient_bin;
CLHOGBlockNormalizationKernel _block_norm;
diff --git a/arm_compute/runtime/CL/functions/CLHOGGradient.h b/arm_compute/runtime/CL/functions/CLHOGGradient.h
index 051e5860d..dbcc33537 100644
--- a/arm_compute/runtime/CL/functions/CLHOGGradient.h
+++ b/arm_compute/runtime/CL/functions/CLHOGGradient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,11 +28,11 @@
#include "arm_compute/core/CL/kernels/CLMagnitudePhaseKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLDerivative.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -66,7 +66,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLDerivative _derivative;
CLMagnitudePhaseKernel _mag_phase;
CLTensor _gx;
diff --git a/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h b/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h
index 924172377..6f87eb5e0 100644
--- a/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h
+++ b/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h
@@ -28,12 +28,12 @@
#include "arm_compute/core/CL/ICLMultiHOG.h"
#include "arm_compute/core/CL/kernels/CLHOGDescriptorKernel.h"
#include "arm_compute/core/CPP/kernels/CPPDetectionWindowNonMaximaSuppressionKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLHOGDetector.h"
#include "arm_compute/runtime/CL/functions/CLHOGGradient.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -89,7 +89,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLHOGGradient _gradient_kernel;
std::vector<CLHOGOrientationBinningKernel> _orient_bin_kernel;
std::vector<CLHOGBlockNormalizationKernel> _block_norm_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLHarrisCorners.h b/arm_compute/runtime/CL/functions/CLHarrisCorners.h
index 52041a96f..d8cc7c790 100644
--- a/arm_compute/runtime/CL/functions/CLHarrisCorners.h
+++ b/arm_compute/runtime/CL/functions/CLHarrisCorners.h
@@ -31,10 +31,10 @@
#include "arm_compute/core/CL/kernels/CLHarrisCornersKernel.h"
#include "arm_compute/core/NEON/kernels/NEHarrisCornersKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLNonMaximaSuppression3x3.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -87,7 +87,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
std::unique_ptr<IFunction> _sobel; /**< Sobel function */
CLHarrisScoreKernel _harris_score; /**< Harris score kernel */
CLNonMaximaSuppression3x3 _non_max_suppr; /**< Non-maxima suppression function */
diff --git a/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h b/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h
index 15dcc5831..26170768b 100644
--- a/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h
+++ b/arm_compute/runtime/CL/functions/CLL2NormalizeLayer.h
@@ -26,11 +26,11 @@
#include "arm_compute/core/CL/kernels/CLL2NormalizeLayerKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/ICLSimpleFunction.h"
#include "arm_compute/runtime/CL/functions/CLReductionOperation.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -75,7 +75,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLReductionOperation _reduce_func;
CLL2NormalizeLayerKernel _normalize_kernel;
CLTensor _sumsq;
diff --git a/arm_compute/runtime/CL/functions/CLLSTMLayer.h b/arm_compute/runtime/CL/functions/CLLSTMLayer.h
index 44b3baf81..20b20b6be 100644
--- a/arm_compute/runtime/CL/functions/CLLSTMLayer.h
+++ b/arm_compute/runtime/CL/functions/CLLSTMLayer.h
@@ -33,7 +33,6 @@
#include "arm_compute/core/CL/kernels/CLPixelWiseMultiplicationKernel.h"
#include "arm_compute/core/CL/kernels/CLWidthConcatenate2TensorsKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLConcatenateLayer.h"
#include "arm_compute/runtime/CL/functions/CLElementwiseOperations.h"
@@ -41,6 +40,7 @@
#include "arm_compute/runtime/CL/functions/CLGEMM.h"
#include "arm_compute/runtime/CL/functions/CLMeanStdDevNormalizationLayer.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/runtime/common/LSTMParams.h"
#include <memory>
@@ -154,7 +154,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLFullyConnectedLayer _fully_connected_input_gate;
CLArithmeticAddition _accum_input_gate1;
CLSaturatedArithmeticOperationKernel _subtract_input_gate;
diff --git a/arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h b/arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h
index e2d164c39..12040a915 100644
--- a/arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h
+++ b/arm_compute/runtime/CL/functions/CLLSTMLayerQuantized.h
@@ -132,7 +132,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
// Functions used
CLGEMMLowpMatrixMultiplyCore _gemmlowp;
diff --git a/arm_compute/runtime/CL/functions/CLLocallyConnectedLayer.h b/arm_compute/runtime/CL/functions/CLLocallyConnectedLayer.h
index c2bb47c55..36228bdb9 100644
--- a/arm_compute/runtime/CL/functions/CLLocallyConnectedLayer.h
+++ b/arm_compute/runtime/CL/functions/CLLocallyConnectedLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -31,9 +31,9 @@
#include "arm_compute/core/CL/kernels/CLLocallyConnectedMatrixMultiplyKernel.h"
#include "arm_compute/core/CL/kernels/CLWeightsReshapeKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -93,7 +93,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLIm2ColKernel _input_im2col_kernel;
CLWeightsReshapeKernel _weights_reshape_kernel;
CLLocallyConnectedMatrixMultiplyKernel _mm_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLMeanStdDev.h b/arm_compute/runtime/CL/functions/CLMeanStdDev.h
index 2e4656342..2e4e88422 100644
--- a/arm_compute/runtime/CL/functions/CLMeanStdDev.h
+++ b/arm_compute/runtime/CL/functions/CLMeanStdDev.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,10 +27,10 @@
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
#include "arm_compute/core/CL/kernels/CLMeanStdDevKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/functions/CLReductionOperation.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -75,7 +75,7 @@ private:
void run_float();
void run_int();
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
DataType _data_type; /**< Input data type. */
unsigned int _num_pixels; /**< Number of image's pixels. */
bool _run_stddev; /**< Flag for knowing if we should run stddev reduction function. */
diff --git a/arm_compute/runtime/CL/functions/CLOpticalFlow.h b/arm_compute/runtime/CL/functions/CLOpticalFlow.h
index a0a947188..f57752062 100644
--- a/arm_compute/runtime/CL/functions/CLOpticalFlow.h
+++ b/arm_compute/runtime/CL/functions/CLOpticalFlow.h
@@ -29,11 +29,11 @@
#include "arm_compute/core/IArray.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/CLArray.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/functions/CLScharr3x3.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstddef>
#include <cstdint>
@@ -96,7 +96,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
std::vector<CLLKTrackerInitKernel> _tracker_init_kernel;
std::vector<CLLKTrackerStage0Kernel> _tracker_stage0_kernel;
std::vector<CLLKTrackerStage1Kernel> _tracker_stage1_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLRNNLayer.h b/arm_compute/runtime/CL/functions/CLRNNLayer.h
index fc86992bd..47b8cd43e 100644
--- a/arm_compute/runtime/CL/functions/CLRNNLayer.h
+++ b/arm_compute/runtime/CL/functions/CLRNNLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -72,7 +72,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLGEMM _gemm_state_f;
CLSaturatedArithmeticOperationKernel _add_kernel;
CLActivationLayerKernel _activation_kernel;
diff --git a/arm_compute/runtime/CL/functions/CLReduceMean.h b/arm_compute/runtime/CL/functions/CLReduceMean.h
index 9c087eadf..168b56c6d 100644
--- a/arm_compute/runtime/CL/functions/CLReduceMean.h
+++ b/arm_compute/runtime/CL/functions/CLReduceMean.h
@@ -67,7 +67,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
std::vector<CLReductionOperation> _reduction_kernels;
std::vector<CLTensor> _reduced_outs;
CLReshapeLayer _reshape;
diff --git a/arm_compute/runtime/CL/functions/CLReductionOperation.h b/arm_compute/runtime/CL/functions/CLReductionOperation.h
index 4b0adc243..f71313f23 100644
--- a/arm_compute/runtime/CL/functions/CLReductionOperation.h
+++ b/arm_compute/runtime/CL/functions/CLReductionOperation.h
@@ -27,10 +27,10 @@
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
#include "arm_compute/core/CL/kernels/CLReductionOperationKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -75,7 +75,7 @@ public:
void run() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
std::vector<CLTensor> _results_vector;
std::vector<CLReductionOperationKernel> _reduction_kernels_vector;
std::vector<CLFillBorderKernel> _border_handlers_vector;
diff --git a/arm_compute/runtime/CL/functions/CLSobel5x5.h b/arm_compute/runtime/CL/functions/CLSobel5x5.h
index 2b5807b54..7b62066bd 100644
--- a/arm_compute/runtime/CL/functions/CLSobel5x5.h
+++ b/arm_compute/runtime/CL/functions/CLSobel5x5.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,10 +27,10 @@
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
#include "arm_compute/core/CL/kernels/CLSobel5x5Kernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -70,7 +70,7 @@ public:
void run() override;
protected:
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
CLSobel5x5HorKernel _sobel_hor; /**< Sobel Horizontal 5x5 kernel */
CLSobel5x5VertKernel _sobel_vert; /**< Sobel Vertical 5x5 kernel */
CLFillBorderKernel _border_handler; /**< Kernel to handle image borders */
diff --git a/arm_compute/runtime/CL/functions/CLSobel7x7.h b/arm_compute/runtime/CL/functions/CLSobel7x7.h
index 65b3cf2da..d7c34765d 100644
--- a/arm_compute/runtime/CL/functions/CLSobel7x7.h
+++ b/arm_compute/runtime/CL/functions/CLSobel7x7.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,10 +27,10 @@
#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h"
#include "arm_compute/core/CL/kernels/CLSobel7x7Kernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -70,7 +70,7 @@ public:
void run() override;
protected:
- CLMemoryGroup _memory_group; /**< Function's memory group */
+ MemoryGroup _memory_group; /**< Function's memory group */
CLSobel7x7HorKernel _sobel_hor; /**< Sobel Horizontal 7x7 kernel */
CLSobel7x7VertKernel _sobel_vert; /**< Sobel Vertical 7x7 kernel */
CLFillBorderKernel _border_handler; /**< Kernel to handle image borders */
diff --git a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h
index 8d2c03f93..407827087 100644
--- a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h
+++ b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,10 +27,10 @@
#include "arm_compute/core/CL/kernels/CLFlattenLayerKernel.h"
#include "arm_compute/core/CL/kernels/CLReshapeLayerKernel.h"
#include "arm_compute/core/CL/kernels/CLSoftmaxLayerKernel.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/IFunction.h"
#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -94,7 +94,7 @@ private:
*/
void configure_reshape_input_kernel(const ICLTensor *input, const ICLTensor *output, size_t axis);
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLLogits1DMaxShiftExpSumKernel _max_shift_exp_sum_kernel;
CLLogits1DNormKernel _norm_kernel;
std::unique_ptr<ICLKernel> _flatten_kernel_ptr;
diff --git a/arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h
index e2ce9d7ec..d887bca73 100644
--- a/arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h
+++ b/arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h
@@ -102,7 +102,7 @@ public:
void prepare() override;
private:
- CLMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
CLGEMM _batched_mm;
CLWinogradInputTransform _input_transform;
CLWinogradFilterTransformKernel _filter_transform;
diff --git a/arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h b/arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h
deleted file mode 100644
index 10f4fc6b0..000000000
--- a/arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GCMEMORYGROUP_H__
-#define __ARM_COMPUTE_GCMEMORYGROUP_H__
-
-#include "arm_compute/runtime/MemoryGroupBase.h"
-
-#include "arm_compute/core/GLES_COMPUTE/OpenGLES.h"
-#include "arm_compute/core/utils/misc/Cast.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
-
-namespace arm_compute
-{
-using GCMemoryGroup = MemoryGroupBase<GCTensor>;
-
-template <>
-inline void MemoryGroupBase<GCTensor>::associate_memory_group(GCTensor *obj)
-{
- ARM_COMPUTE_ERROR_ON(obj == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<GCTensorAllocator *>(obj->allocator()) == nullptr);
-
- auto allocator = arm_compute::utils::cast::polymorphic_downcast<GCTensorAllocator *>(obj->allocator());
- ARM_COMPUTE_ERROR_ON(allocator == nullptr);
- allocator->set_associated_memory_group(this);
-}
-} // namespace arm_compute
-#endif /*__ARM_COMPUTE_GCMEMORYGROUP_H__ */
diff --git a/arm_compute/runtime/GLES_COMPUTE/GCTensor.h b/arm_compute/runtime/GLES_COMPUTE/GCTensor.h
index 05305f9b1..344c78852 100644
--- a/arm_compute/runtime/GLES_COMPUTE/GCTensor.h
+++ b/arm_compute/runtime/GLES_COMPUTE/GCTensor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -34,7 +34,7 @@ class ITensorAllocator;
class ITensorInfo;
/** Interface for OpenGL ES tensor */
-class GCTensor : public IGCTensor
+class GCTensor : public IGCTensor, public IMemoryManageable
{
public:
/** Default constructor */
@@ -84,6 +84,7 @@ public:
TensorInfo *info() override;
uint8_t *buffer() const override;
GLuint gc_buffer() const override;
+ void associate_memory_group(IMemoryGroup *memory_group) override;
protected:
// Inherited methods overridden:
@@ -96,6 +97,5 @@ private:
/** OpenGL ES Image */
using GCImage = GCTensor;
-}
-
+} // namespace arm_compute
#endif /*__ARM_COMPUTE_GCTENSOR_H__ */
diff --git a/arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h b/arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h
index b7067664f..2cd842942 100644
--- a/arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h
+++ b/arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,23 +28,20 @@
#include "arm_compute/core/GLES_COMPUTE/OpenGLES.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCMemory.h"
#include "arm_compute/runtime/ITensorAllocator.h"
-#include "arm_compute/runtime/MemoryGroupBase.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
namespace arm_compute
{
class GCTensor;
-template <typename>
-class MemoryGroupBase;
-using GCMemoryGroup = MemoryGroupBase<GCTensor>;
/** Basic implementation of a GLES memory tensor allocator. */
class GCTensorAllocator : public ITensorAllocator
{
public:
/** Default constructor. */
- GCTensorAllocator(GCTensor *owner = nullptr);
+ GCTensorAllocator(IMemoryManageable *owner = nullptr);
/** Prevent instances of this class from being copied (As this class contains pointers) */
GCTensorAllocator(const GCTensorAllocator &) = delete;
@@ -109,7 +106,7 @@ public:
*
* @param[in] associated_memory_group Memory group to associate the tensor with
*/
- void set_associated_memory_group(GCMemoryGroup *associated_memory_group);
+ void set_associated_memory_group(IMemoryGroup *associated_memory_group);
protected:
/** Call map() on the SSBO.
@@ -122,10 +119,10 @@ protected:
void unlock() override;
private:
- GCMemoryGroup *_associated_memory_group; /**< Registered memory group */
- GCMemory _memory; /**< OpenGL ES memory */
- uint8_t *_mapping; /**< Pointer to the CPU mapping of the OpenGL ES buffer. */
- GCTensor *_owner; /**< Owner of the allocator */
+ IMemoryManageable *_owner; /**< Owner of the allocator */
+ IMemoryGroup *_associated_memory_group; /**< Registered memory group */
+ GCMemory _memory; /**< OpenGL ES memory */
+ uint8_t *_mapping; /**< Pointer to the CPU mapping of the OpenGL ES buffer. */
};
} // namespace arm_compute
#endif /* __ARM_COMPUTE_GCTENSORALLOCATOR_H__ */
diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h
index 4fac95e72..74b875fcc 100644
--- a/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h
+++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCConvolutionLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -30,11 +30,11 @@
#include "arm_compute/core/GLES_COMPUTE/kernels/GCIm2ColKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCWeightsReshapeKernel.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
#include "arm_compute/runtime/GLES_COMPUTE/functions/GCActivationLayer.h"
#include "arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h"
#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <memory>
@@ -130,7 +130,7 @@ private:
static Status validate_mm(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *output);
private:
- GCMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
GCConvolutionLayerReshapeWeights _reshape_weights;
GCIm2ColKernel _input_im2col_kernel;
GCGEMM _mm_gemm;
diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h
index 63565df1a..6fcebd63b 100644
--- a/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h
+++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,9 +28,9 @@
#include "arm_compute/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCIm2ColKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCTransposeKernel.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
#include "arm_compute/runtime/GLES_COMPUTE/IGCSimpleFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -92,7 +92,7 @@ private:
void configure_fc_fc(const IGCTensor *input, const IGCTensor *weights, IGCTensor *output);
void configure_conv_fc(const IGCTensor *input, const IGCTensor *weights, IGCTensor *output);
- GCMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
GCIm2ColKernel _im2col_kernel;
GCFullyConnectedLayerReshapeWeights _reshape_weights_kernel;
GCGEMMMatrixMultiplyKernel _mm_kernel;
diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h
index 2db254527..75531b342 100644
--- a/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h
+++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCGEMM.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -29,9 +29,9 @@
#include "arm_compute/core/GLES_COMPUTE/kernels/GCGEMMMatrixAdditionKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCGEMMMatrixMultiplyKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCGEMMTranspose1xWKernel.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -96,7 +96,7 @@ public:
void prepare() override;
private:
- GCMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
GCGEMMInterleave4x4Kernel _interleave_kernel;
GCGEMMTranspose1xWKernel _transpose_kernel;
GCGEMMMatrixMultiplyKernel _mm_kernel;
diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.h
index adc8157f0..2e68f8edb 100644
--- a/arm_compute/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.h
+++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCNormalizationLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -29,8 +29,8 @@
#include "arm_compute/core/GLES_COMPUTE/kernels/GCFillBorderKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCNormalizationLayerKernel.h"
#include "arm_compute/core/GLES_COMPUTE/kernels/GCPixelWiseMultiplicationKernel.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/core/Types.h"
@@ -63,7 +63,7 @@ public:
void run() override;
private:
- GCMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
GCTensor _squared_input; /**< The intermediate buffer which stores results of squaring input*/
GCNormalizationLayerKernel _norm_kernel; /**< Normalization layer kernel to run */
GCPixelWiseMultiplicationKernel _multiply_kernel; /**< Pixel multiplication kernel to run */
diff --git a/arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h b/arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h
index f6c6edb6a..ec7c8d8a2 100644
--- a/arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h
+++ b/arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,9 +25,9 @@
#define __ARM_COMPUTE_GCSOFTMAXLAYER_H__
#include "arm_compute/core/GLES_COMPUTE/kernels/GCSoftmaxLayerKernel.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
#include "arm_compute/runtime/IFunction.h"
+#include "arm_compute/runtime/MemoryGroup.h"
namespace arm_compute
{
@@ -65,7 +65,7 @@ public:
void run() override;
private:
- GCMemoryGroup _memory_group;
+ MemoryGroup _memory_group;
GCLogits1DMaxKernel _max_kernel;
GCLogits1DShiftExpSumKernel _shift_exp_sum_kernel;
GCLogits1DNormKernel _norm_kernel;
@@ -73,5 +73,5 @@ private:
GCTensor _sum;
GCTensor _tmp;
};
-}
+} // namespace arm_compute
#endif /* __ARM_COMPUTE_GCSOFTMAXLAYER_H__ */
diff --git a/arm_compute/runtime/IMemoryGroup.h b/arm_compute/runtime/IMemoryGroup.h
index 159e99aeb..4736acb55 100644
--- a/arm_compute/runtime/IMemoryGroup.h
+++ b/arm_compute/runtime/IMemoryGroup.h
@@ -24,16 +24,39 @@
#ifndef __ARM_COMPUTE_IMEMORYGROUP_H__
#define __ARM_COMPUTE_IMEMORYGROUP_H__
+#include "arm_compute/runtime/IMemory.h"
#include "arm_compute/runtime/Types.h"
namespace arm_compute
{
+// Forward declarations
+class IMemoryGroup;
+class IMemoryManageable;
+
/** Memory group interface */
class IMemoryGroup
{
public:
/** Default virtual destructor */
virtual ~IMemoryGroup() = default;
+ /** Sets a object to be managed by the given memory group
+ *
+ * @note Manager must not be finalized
+ *
+ * @param[in] obj Object to be managed
+ */
+ virtual void manage(IMemoryManageable *obj) = 0;
+ /** Finalizes memory for a given object
+ *
+ * @note Manager must not be finalized
+ *
+ * @param[in, out] obj Object to request memory for
+ * @param[in, out] obj_memory Object's memory handling interface which can be used to alter the underlying memory
+ * that is used by the object.
+ * @param[in] size Size of memory to allocate
+ * @param[in] alignment (Optional) Alignment to use
+ */
+ virtual void finalize_memory(IMemoryManageable *obj, IMemory &obj_memory, size_t size, size_t alignment) = 0;
/** Acquires backing memory for the whole group */
virtual void acquire() = 0;
/** Releases backing memory of the whole group */
@@ -42,6 +65,19 @@ public:
virtual MemoryMappings &mappings() = 0;
};
+/** Interface of an object than can be memory managed */
+class IMemoryManageable
+{
+public:
+ /** Default virtual destructor */
+ virtual ~IMemoryManageable() = default;
+ /** Associates a memory managable object with the memory group that manages it
+ *
+ * @param[in] memory_group Memory group that manages the object.
+ */
+ virtual void associate_memory_group(IMemoryGroup *memory_group) = 0;
+};
+
/** Memory group resources scope handling class */
class MemoryGroupResourceScope
{
diff --git a/arm_compute/runtime/MemoryGroup.h b/arm_compute/runtime/MemoryGroup.h
index 9127d0849..6cc948d31 100644
--- a/arm_compute/runtime/MemoryGroup.h
+++ b/arm_compute/runtime/MemoryGroup.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,22 +24,109 @@
#ifndef __ARM_COMPUTE_MEMORYGROUP_H__
#define __ARM_COMPUTE_MEMORYGROUP_H__
-#include "arm_compute/runtime/MemoryGroupBase.h"
+#include "arm_compute/runtime/IMemoryGroup.h"
-#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/core/Error.h"
+#include "arm_compute/core/utils/misc/Macros.h"
+#include "arm_compute/runtime/IMemoryManager.h"
+#include "arm_compute/runtime/IMemoryPool.h"
+
+#include <cstddef>
+#include <memory>
namespace arm_compute
{
-/** Memory Group */
-using MemoryGroup = MemoryGroupBase<Tensor>;
+// Forward declarations
+class IMemory;
+
+/** Memory group */
+class MemoryGroup final : public IMemoryGroup
+{
+public:
+ /** Default Constructor */
+ MemoryGroup(IMemoryManager *memory_manager);
+ /** Default Constructor */
+ MemoryGroup(std::shared_ptr<IMemoryManager> = nullptr);
+ /** Default destructor */
+ ~MemoryGroup() = default;
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ MemoryGroup(const MemoryGroup &) = delete;
+ /** Prevent instances of this class from being copy assigned (As this class contains pointers) */
+ MemoryGroup &operator=(const MemoryGroup &) = delete;
+ /** Allow instances of this class to be moved */
+ MemoryGroup(MemoryGroup &&) = default;
+ /** Allow instances of this class to be moved */
+ MemoryGroup &operator=(MemoryGroup &&) = default;
+
+ // Inherited methods overridden:
+ void manage(IMemoryManageable *obj) override;
+ void finalize_memory(IMemoryManageable *obj, IMemory &obj_memory, size_t size, size_t alignment) override;
+ void acquire() override;
+ void release() override;
+ MemoryMappings &mappings() override;
+
+private:
+ std::shared_ptr<IMemoryManager> _memory_manager; /**< Memory manager to be used by the group */
+ IMemoryPool *_pool; /**< Memory pool that the group is scheduled with */
+ MemoryMappings _mappings; /**< Memory mappings of the group */
+};
+
+inline MemoryGroup::MemoryGroup(std::shared_ptr<IMemoryManager> memory_manager)
+ : _memory_manager(memory_manager), _pool(nullptr), _mappings()
+{
+}
+
+inline void MemoryGroup::manage(IMemoryManageable *obj)
+{
+ if(_memory_manager && (obj != nullptr))
+ {
+ ARM_COMPUTE_ERROR_ON(!_memory_manager->lifetime_manager());
+
+ // Defer registration to the first managed object
+ _memory_manager->lifetime_manager()->register_group(this);
+
+ // Associate this memory group with the tensor
+ obj->associate_memory_group(this);
+
+ // Start object lifetime
+ _memory_manager->lifetime_manager()->start_lifetime(obj);
+ }
+}
+
+inline void MemoryGroup::finalize_memory(IMemoryManageable *obj, IMemory &obj_memory, size_t size, size_t alignment)
+{
+ if(_memory_manager)
+ {
+ ARM_COMPUTE_ERROR_ON(!_memory_manager->lifetime_manager());
+ _memory_manager->lifetime_manager()->end_lifetime(obj, obj_memory, size, alignment);
+ }
+}
+
+inline void MemoryGroup::acquire()
+{
+ if(!_mappings.empty())
+ {
+ ARM_COMPUTE_ERROR_ON(!_memory_manager->pool_manager());
+ _pool = _memory_manager->pool_manager()->lock_pool();
+ _pool->acquire(_mappings);
+ }
+}
+
+inline void MemoryGroup::release()
+{
+ if(_pool != nullptr)
+ {
+ ARM_COMPUTE_ERROR_ON(!_memory_manager->pool_manager());
+ ARM_COMPUTE_ERROR_ON(_mappings.empty());
+ _pool->release(_mappings);
+ _memory_manager->pool_manager()->unlock_pool(_pool);
+ _pool = nullptr;
+ }
+}
-template <>
-inline void MemoryGroupBase<Tensor>::associate_memory_group(Tensor *obj)
+inline MemoryMappings &MemoryGroup::mappings()
{
- ARM_COMPUTE_ERROR_ON(obj == nullptr);
- auto allocator = dynamic_cast<TensorAllocator *>(obj->allocator());
- ARM_COMPUTE_ERROR_ON(allocator == nullptr);
- allocator->set_associated_memory_group(this);
+ return _mappings;
}
} // arm_compute
#endif /*__ARM_COMPUTE_MEMORYGROUP_H__ */
diff --git a/arm_compute/runtime/MemoryGroupBase.h b/arm_compute/runtime/MemoryGroupBase.h
deleted file mode 100644
index e3f38f7cf..000000000
--- a/arm_compute/runtime/MemoryGroupBase.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2017-2019 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_MEMORYGROUPBASE_H__
-#define __ARM_COMPUTE_MEMORYGROUPBASE_H__
-
-#include "arm_compute/runtime/IMemoryGroup.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/runtime/IMemoryManager.h"
-#include "arm_compute/runtime/IMemoryPool.h"
-
-#include <cstddef>
-#include <memory>
-
-namespace arm_compute
-{
-// Forward declarations
-class IMemory;
-
-/** Memory group */
-template <typename TensorType>
-class MemoryGroupBase : public IMemoryGroup
-{
-public:
- /** Default Constructor */
- MemoryGroupBase(std::shared_ptr<IMemoryManager> memory_manager = nullptr);
- /** Default destructor */
- ~MemoryGroupBase() = default;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- MemoryGroupBase(const MemoryGroupBase &) = delete;
- /** Prevent instances of this class from being copy assigned (As this class contains pointers) */
- MemoryGroupBase &operator=(const MemoryGroupBase &) = delete;
- /** Allow instances of this class to be moved */
- MemoryGroupBase(MemoryGroupBase &&) = default;
- /** Allow instances of this class to be moved */
- MemoryGroupBase &operator=(MemoryGroupBase &&) = default;
- /** Sets a object to be managed by the given memory group
- *
- * @note Manager must not be finalized
- *
- * @param[in] obj Object to be managed
- */
- void manage(TensorType *obj);
- /** Finalizes memory for a given object
- *
- * @note Manager must not be finalized
- *
- * @param[in, out] obj Object to request memory for
- * @param[in, out] obj_memory Object's memory handling interface which can be used to alter the underlying memory
- * that is used by the object.
- * @param[in] size Size of memory to allocate
- * @param[in] alignment (Optional) Alignment to use
- */
- void finalize_memory(TensorType *obj, IMemory &obj_memory, size_t size, size_t alignment = 0);
-
- // Inherited methods overridden:
- void acquire() override;
- void release() override;
- MemoryMappings &mappings() override;
-
-private:
- void associate_memory_group(TensorType *obj);
-
-private:
- std::shared_ptr<IMemoryManager> _memory_manager; /**< Memory manager to be used by the group */
- IMemoryPool *_pool; /**< Memory pool that the group is scheduled with */
- MemoryMappings _mappings; /**< Memory mappings of the group */
-};
-
-template <typename TensorType>
-inline MemoryGroupBase<TensorType>::MemoryGroupBase(std::shared_ptr<IMemoryManager> memory_manager)
- : _memory_manager(std::move(memory_manager)), _pool(nullptr), _mappings()
-{
- if(_memory_manager)
- {
- ARM_COMPUTE_ERROR_ON(!_memory_manager->lifetime_manager());
- }
-}
-
-template <typename TensorType>
-inline void MemoryGroupBase<TensorType>::manage(TensorType *obj)
-{
- if(_memory_manager)
- {
- ARM_COMPUTE_ERROR_ON(!_memory_manager->lifetime_manager());
-
- // Defer registration to the first managed object
- _memory_manager->lifetime_manager()->register_group(this);
-
- // Associate this memory group with the tensor
- associate_memory_group(obj);
-
- // Start object lifetime
- _memory_manager->lifetime_manager()->start_lifetime(obj);
- }
-}
-
-template <typename TensorType>
-inline void MemoryGroupBase<TensorType>::finalize_memory(TensorType *obj, IMemory &obj_memory, size_t size, size_t alignment)
-{
- if(_memory_manager)
- {
- ARM_COMPUTE_ERROR_ON(!_memory_manager->lifetime_manager());
- _memory_manager->lifetime_manager()->end_lifetime(obj, obj_memory, size, alignment);
- }
-}
-
-template <typename TensorType>
-inline void MemoryGroupBase<TensorType>::acquire()
-{
- if(!_mappings.empty())
- {
- ARM_COMPUTE_ERROR_ON(!_memory_manager->pool_manager());
- _pool = _memory_manager->pool_manager()->lock_pool();
- _pool->acquire(_mappings);
- }
-}
-
-template <typename TensorType>
-inline void MemoryGroupBase<TensorType>::release()
-{
- if(_pool != nullptr)
- {
- ARM_COMPUTE_ERROR_ON(!_memory_manager->pool_manager());
- ARM_COMPUTE_ERROR_ON(_mappings.empty());
- _pool->release(_mappings);
- _memory_manager->pool_manager()->unlock_pool(_pool);
- _pool = nullptr;
- }
-}
-
-template <typename TensorType>
-inline MemoryMappings &MemoryGroupBase<TensorType>::mappings()
-{
- return _mappings;
-}
-
-template <typename TensorType>
-inline void MemoryGroupBase<TensorType>::associate_memory_group(TensorType *)
-{
- ARM_COMPUTE_ERROR("Must be implemented by child class");
-}
-} // arm_compute
-#endif /*__ARM_COMPUTE_MEMORYGROUPBASE_H__ */
diff --git a/arm_compute/runtime/NEON/functions/NEReduceMean.h b/arm_compute/runtime/NEON/functions/NEReduceMean.h
index fdd8edfe8..9df71f273 100644
--- a/arm_compute/runtime/NEON/functions/NEReduceMean.h
+++ b/arm_compute/runtime/NEON/functions/NEReduceMean.h
@@ -31,11 +31,10 @@
#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/runtime/NEON/functions/NEReductionOperation.h"
#include "arm_compute/runtime/NEON/functions/NEReshapeLayer.h"
+#include "arm_compute/runtime/Tensor.h"
namespace arm_compute
{
-class ITensor;
-
/** Basic function to perform reduce operation */
class NEReduceMean : public IFunction
{
diff --git a/arm_compute/runtime/Tensor.h b/arm_compute/runtime/Tensor.h
index 7022afff8..6fa7c8ca0 100644
--- a/arm_compute/runtime/Tensor.h
+++ b/arm_compute/runtime/Tensor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -34,7 +34,7 @@ namespace arm_compute
class ITensorInfo;
/** Basic implementation of the tensor interface */
-class Tensor : public ITensor
+class Tensor : public ITensor, public IMemoryManageable
{
public:
/** Constructor */
@@ -55,6 +55,7 @@ public:
ITensorInfo *info() const override;
ITensorInfo *info() override;
uint8_t *buffer() const override;
+ void associate_memory_group(IMemoryGroup *memory_group) override;
private:
mutable TensorAllocator _allocator; /**< Instance of the basic CPU allocator.*/
@@ -62,5 +63,5 @@ private:
/** Image */
using Image = Tensor;
-}
+} // namespace arm_compute
#endif /*__ARM_COMPUTE_TENSOR_H__ */
diff --git a/arm_compute/runtime/TensorAllocator.h b/arm_compute/runtime/TensorAllocator.h
index 28141134c..b33a8f878 100644
--- a/arm_compute/runtime/TensorAllocator.h
+++ b/arm_compute/runtime/TensorAllocator.h
@@ -23,9 +23,10 @@
*/
#ifndef __ARM_COMPUTE_TENSORALLOCATOR_H__
#define __ARM_COMPUTE_TENSORALLOCATOR_H__
-
#include "arm_compute/runtime/ITensorAllocator.h"
+
#include "arm_compute/runtime/Memory.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include <cstdint>
#include <memory>
@@ -33,12 +34,9 @@
namespace arm_compute
{
+// Forward declaration
class Coordinates;
class TensorInfo;
-class Tensor;
-template <typename>
-class MemoryGroupBase;
-using MemoryGroup = MemoryGroupBase<Tensor>;
/** Basic implementation of a CPU memory tensor allocator. */
class TensorAllocator : public ITensorAllocator
@@ -46,9 +44,9 @@ class TensorAllocator : public ITensorAllocator
public:
/** Default constructor.
*
- * @param[in] owner Owner of the tensor allocator.
+ * @param[in] owner Memory manageable owner
*/
- TensorAllocator(Tensor *owner = nullptr);
+ TensorAllocator(IMemoryManageable *owner);
/** Default destructor */
~TensorAllocator();
/** Prevent instances of this class from being copied (As this class contains pointers) */
@@ -111,7 +109,7 @@ public:
*
* @param[in] associated_memory_group Memory group to associate the tensor with
*/
- void set_associated_memory_group(MemoryGroup *associated_memory_group);
+ void set_associated_memory_group(IMemoryGroup *associated_memory_group);
protected:
/** No-op for CPU memory
@@ -124,9 +122,9 @@ protected:
void unlock() override;
private:
- MemoryGroup *_associated_memory_group; /**< Registered memory manager */
- Memory _memory; /**< CPU memory */
- Tensor *_owner; /**< Owner of the allocator */
+ IMemoryManageable *_owner; /**< Memory manageable object that owns the allocator */
+ IMemoryGroup *_associated_memory_group; /**< Registered memory manager */
+ Memory _memory; /**< CPU memory */
};
-}
+} // namespace arm_compute
#endif /* __ARM_COMPUTE_TENSORALLOCATOR_H__ */
diff --git a/docs/01_library.dox b/docs/01_library.dox
index 85af8a0de..37ac397dd 100644
--- a/docs/01_library.dox
+++ b/docs/01_library.dox
@@ -349,10 +349,6 @@ MemoryGroup binds a number of objects to a bucket of memory requirements that ne
Requesting backing memory for a specific group can be done using @ref IMemoryGroup::acquire and releasing the memory back using @ref IMemoryGroup::release.
-@note Two types of memory groups are currently implemented:
-- @ref MemoryGroup that manages @ref Tensor objects
-- @ref CLMemoryGroup that manages @ref CLTensor objects.
-
@subsubsection S4_7_1_2_memory_pool MemoryPool
@ref IMemoryPool defines a pool of memory that can be used to provide backing memory to a memory group.
diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp
index 0666ec0cc..9971e4fc9 100644
--- a/src/graph/backends/CL/CLDeviceBackend.cpp
+++ b/src/graph/backends/CL/CLDeviceBackend.cpp
@@ -37,8 +37,8 @@
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/runtime/BlobLifetimeManager.h"
#include "arm_compute/runtime/CL/CLBufferAllocator.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/runtime/MemoryManagerOnDemand.h"
#include "arm_compute/runtime/PoolManager.h"
@@ -132,7 +132,7 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx)
mm_ctx.target = Target::CL;
mm_ctx.intra_mm = create_memory_manager(MemoryManagerAffinity::Buffer);
mm_ctx.cross_mm = create_memory_manager(MemoryManagerAffinity::Buffer);
- mm_ctx.cross_group = std::make_shared<CLMemoryGroup>(mm_ctx.cross_mm);
+ mm_ctx.cross_group = std::make_shared<MemoryGroup>(mm_ctx.cross_mm);
mm_ctx.allocator = _allocator.get();
ctx.insert_memory_management_ctx(std::move(mm_ctx));
diff --git a/src/graph/backends/CL/CLTensorHandle.cpp b/src/graph/backends/CL/CLTensorHandle.cpp
index 219d9d030..891c784cb 100644
--- a/src/graph/backends/CL/CLTensorHandle.cpp
+++ b/src/graph/backends/CL/CLTensorHandle.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,8 +23,7 @@
*/
#include "arm_compute/graph/backends/CL/CLTensorHandle.h"
-#include "arm_compute/core/utils/misc/Cast.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
+#include "arm_compute/runtime/IMemoryGroup.h"
namespace arm_compute
{
@@ -52,8 +51,7 @@ void CLTensorHandle::manage(IMemoryGroup *mg)
{
if(mg != nullptr)
{
- auto *cl_mg = arm_compute::utils::cast::polymorphic_downcast<CLMemoryGroup *>(mg);
- cl_mg->manage(&_tensor);
+ mg->manage(&_tensor);
}
}
diff --git a/src/graph/backends/GLES/GCDeviceBackend.cpp b/src/graph/backends/GLES/GCDeviceBackend.cpp
index 5f0bf3f26..058f7792e 100644
--- a/src/graph/backends/GLES/GCDeviceBackend.cpp
+++ b/src/graph/backends/GLES/GCDeviceBackend.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -36,8 +36,8 @@
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/runtime/BlobLifetimeManager.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCScheduler.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/runtime/MemoryManagerOnDemand.h"
#include "arm_compute/runtime/PoolManager.h"
@@ -85,7 +85,7 @@ void GCDeviceBackend::setup_backend_context(GraphContext &ctx)
mm_ctx.target = Target::GC;
mm_ctx.intra_mm = create_memory_manager(MemoryManagerAffinity::Buffer);
mm_ctx.cross_mm = create_memory_manager(MemoryManagerAffinity::Buffer);
- mm_ctx.cross_group = std::make_shared<GCMemoryGroup>(mm_ctx.cross_mm);
+ mm_ctx.cross_group = std::make_shared<MemoryGroup>(mm_ctx.cross_mm);
mm_ctx.allocator = &_allocator;
ctx.insert_memory_management_ctx(std::move(mm_ctx));
diff --git a/src/graph/backends/GLES/GCTensorHandle.cpp b/src/graph/backends/GLES/GCTensorHandle.cpp
index 4e5c65212..8f592625d 100644
--- a/src/graph/backends/GLES/GCTensorHandle.cpp
+++ b/src/graph/backends/GLES/GCTensorHandle.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,8 +23,7 @@
*/
#include "arm_compute/graph/backends/GLES/GCTensorHandle.h"
-#include "arm_compute/core/utils/misc/Cast.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
+#include "arm_compute/runtime/IMemoryGroup.h"
namespace arm_compute
{
@@ -52,8 +51,7 @@ void GCTensorHandle::manage(IMemoryGroup *mg)
{
if(mg != nullptr)
{
- auto *gc_mg = arm_compute::utils::cast::polymorphic_downcast<GCMemoryGroup *>(mg);
- gc_mg->manage(&_tensor);
+ mg->manage(&_tensor);
}
}
diff --git a/src/graph/backends/NEON/NETensorHandle.cpp b/src/graph/backends/NEON/NETensorHandle.cpp
index 5892116ca..d58c45b7e 100644
--- a/src/graph/backends/NEON/NETensorHandle.cpp
+++ b/src/graph/backends/NEON/NETensorHandle.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -52,8 +52,7 @@ void NETensorHandle::manage(IMemoryGroup *mg)
{
if(mg != nullptr)
{
- auto *ne_mg = arm_compute::utils::cast::polymorphic_downcast<MemoryGroup *>(mg);
- ne_mg->manage(&_tensor);
+ mg->manage(&_tensor);
}
}
diff --git a/src/runtime/CL/CLTensor.cpp b/src/runtime/CL/CLTensor.cpp
index 732689e7e..9bbf926b5 100644
--- a/src/runtime/CL/CLTensor.cpp
+++ b/src/runtime/CL/CLTensor.cpp
@@ -25,8 +25,8 @@
#include "arm_compute/runtime/CL/CLScheduler.h"
-using namespace arm_compute;
-
+namespace arm_compute
+{
CLTensor::CLTensor()
: _allocator(this)
{
@@ -76,3 +76,9 @@ void CLTensor::do_unmap(cl::CommandQueue &q)
{
_allocator.unmap(q, buffer());
}
+
+void CLTensor::associate_memory_group(arm_compute::IMemoryGroup *memory_group)
+{
+ _allocator.set_associated_memory_group(memory_group);
+}
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/runtime/CL/CLTensorAllocator.cpp b/src/runtime/CL/CLTensorAllocator.cpp
index 72b5854c5..60e1ca8df 100644
--- a/src/runtime/CL/CLTensorAllocator.cpp
+++ b/src/runtime/CL/CLTensorAllocator.cpp
@@ -25,7 +25,6 @@
#include "arm_compute/core/Error.h"
#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
namespace arm_compute
@@ -104,8 +103,8 @@ void populate_quantization_info(CLFloatArray &scale, CLInt32Array &offset, const
}
} // namespace
-CLTensorAllocator::CLTensorAllocator(CLTensor *owner)
- : _associated_memory_group(nullptr), _memory(), _mapping(nullptr), _owner(owner), _scale(), _offset()
+CLTensorAllocator::CLTensorAllocator(IMemoryManageable *owner)
+ : _owner(owner), _associated_memory_group(nullptr), _memory(), _mapping(nullptr), _scale(), _offset()
{
}
@@ -143,7 +142,7 @@ void CLTensorAllocator::allocate()
}
else
{
- _associated_memory_group->finalize_memory(_owner, _memory, info().total_size());
+ _associated_memory_group->finalize_memory(_owner, _memory, info().total_size(), alignment());
}
// Allocate and fill the quantization parameter arrays
@@ -178,7 +177,7 @@ Status CLTensorAllocator::import_memory(cl::Buffer buffer)
return Status{};
}
-void CLTensorAllocator::set_associated_memory_group(CLMemoryGroup *associated_memory_group)
+void CLTensorAllocator::set_associated_memory_group(IMemoryGroup *associated_memory_group)
{
ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr);
ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group);
diff --git a/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp b/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp
index 63a45aae8..eaf7c6608 100644
--- a/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp
+++ b/src/runtime/CL/functions/CLDeconvolutionLayerUpsample.cpp
@@ -26,6 +26,7 @@
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Utils.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
namespace arm_compute
{
diff --git a/src/runtime/CL/functions/CLSoftmaxLayer.cpp b/src/runtime/CL/functions/CLSoftmaxLayer.cpp
index 7e41dba8a..73add97ef 100644
--- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp
+++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp
@@ -30,7 +30,6 @@
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Utils.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
namespace arm_compute
diff --git a/src/runtime/GLES_COMPUTE/GCTensor.cpp b/src/runtime/GLES_COMPUTE/GCTensor.cpp
index e193d26f0..66c1abdb6 100644
--- a/src/runtime/GLES_COMPUTE/GCTensor.cpp
+++ b/src/runtime/GLES_COMPUTE/GCTensor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,8 +24,8 @@
#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
-using namespace arm_compute;
-
+namespace arm_compute
+{
GCTensor::GCTensor()
: _allocator(this)
{
@@ -56,6 +56,11 @@ GLuint GCTensor::gc_buffer() const
return _allocator.get_gl_ssbo_name();
}
+void GCTensor::associate_memory_group(arm_compute::IMemoryGroup *memory_group)
+{
+ _allocator.set_associated_memory_group(memory_group);
+}
+
void GCTensor::map(bool blocking)
{
IGCTensor::map(blocking);
@@ -74,4 +79,5 @@ uint8_t *GCTensor::do_map(bool blocking)
void GCTensor::do_unmap()
{
_allocator.unmap();
-} \ No newline at end of file
+}
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp b/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp
index 9a5d13951..cccc6a75c 100644
--- a/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp
+++ b/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp
@@ -32,8 +32,8 @@
using namespace arm_compute;
-GCTensorAllocator::GCTensorAllocator(GCTensor *owner)
- : _associated_memory_group(nullptr), _memory(), _mapping(nullptr), _owner(owner)
+GCTensorAllocator::GCTensorAllocator(IMemoryManageable *owner)
+ : _owner(owner), _associated_memory_group(nullptr), _memory(), _mapping(nullptr)
{
}
@@ -50,7 +50,7 @@ void GCTensorAllocator::allocate()
}
else
{
- _associated_memory_group->finalize_memory(_owner, _memory, info().total_size());
+ _associated_memory_group->finalize_memory(_owner, _memory, info().total_size(), alignment());
}
info().set_is_resizable(false);
}
@@ -62,7 +62,7 @@ void GCTensorAllocator::free()
info().set_is_resizable(true);
}
-void GCTensorAllocator::set_associated_memory_group(GCMemoryGroup *associated_memory_group)
+void GCTensorAllocator::set_associated_memory_group(IMemoryGroup *associated_memory_group)
{
ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr);
ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group);
diff --git a/src/runtime/Tensor.cpp b/src/runtime/Tensor.cpp
index a76c37e3d..de08efd73 100644
--- a/src/runtime/Tensor.cpp
+++ b/src/runtime/Tensor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,8 +23,8 @@
*/
#include "arm_compute/runtime/Tensor.h"
-using namespace arm_compute;
-
+namespace arm_compute
+{
Tensor::Tensor()
: _allocator(this)
{
@@ -49,3 +49,9 @@ TensorAllocator *Tensor::allocator()
{
return &_allocator;
}
+
+void Tensor::associate_memory_group(IMemoryGroup *memory_group)
+{
+ _allocator.set_associated_memory_group(memory_group);
+}
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/runtime/TensorAllocator.cpp b/src/runtime/TensorAllocator.cpp
index dfe239c58..7352932ac 100644
--- a/src/runtime/TensorAllocator.cpp
+++ b/src/runtime/TensorAllocator.cpp
@@ -66,8 +66,8 @@ bool validate_subtensor_shape(const TensorInfo &parent_info, const TensorInfo &c
}
} // namespace
-TensorAllocator::TensorAllocator(Tensor *owner)
- : _associated_memory_group(nullptr), _memory(), _owner(owner)
+TensorAllocator::TensorAllocator(IMemoryManageable *owner)
+ : _owner(owner), _associated_memory_group(nullptr), _memory()
{
}
@@ -78,28 +78,28 @@ TensorAllocator::~TensorAllocator()
TensorAllocator::TensorAllocator(TensorAllocator &&o) noexcept
: ITensorAllocator(std::move(o)),
+ _owner(o._owner),
_associated_memory_group(o._associated_memory_group),
- _memory(std::move(o._memory)),
- _owner(o._owner)
+ _memory(std::move(o._memory))
{
+ o._owner = nullptr;
o._associated_memory_group = nullptr;
o._memory = Memory();
- o._owner = nullptr;
}
TensorAllocator &TensorAllocator::operator=(TensorAllocator &&o) noexcept
{
if(&o != this)
{
+ _owner = o._owner;
+ o._owner = nullptr;
+
_associated_memory_group = o._associated_memory_group;
o._associated_memory_group = nullptr;
_memory = std::move(o._memory);
o._memory = Memory();
- _owner = o._owner;
- o._owner = nullptr;
-
ITensorAllocator::operator=(std::move(o));
}
return *this;
@@ -161,7 +161,7 @@ Status TensorAllocator::import_memory(void *memory)
return Status{};
}
-void TensorAllocator::set_associated_memory_group(MemoryGroup *associated_memory_group)
+void TensorAllocator::set_associated_memory_group(IMemoryGroup *associated_memory_group)
{
ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr);
ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group);
diff --git a/tests/validation/CL/UNIT/MemoryManager.cpp b/tests/validation/CL/UNIT/MemoryManager.cpp
index 2129c0324..9f581b7f7 100644
--- a/tests/validation/CL/UNIT/MemoryManager.cpp
+++ b/tests/validation/CL/UNIT/MemoryManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -22,9 +22,9 @@
* SOFTWARE.
*/
#include "arm_compute/runtime/CL/CLBufferAllocator.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLTensorAllocator.h"
#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "support/ToolchainSupport.h"
#include "tests/AssetsLibrary.h"
#include "tests/CL/CLAccessor.h"
diff --git a/tests/validation/CL/UNIT/TensorAllocator.cpp b/tests/validation/CL/UNIT/TensorAllocator.cpp
index d91f4dd02..a3aabf9bc 100644
--- a/tests/validation/CL/UNIT/TensorAllocator.cpp
+++ b/tests/validation/CL/UNIT/TensorAllocator.cpp
@@ -24,9 +24,9 @@
#include "arm_compute/runtime/CL/CLTensorAllocator.h"
#include "arm_compute/core/utils/misc/MMappedFile.h"
-#include "arm_compute/runtime/CL/CLMemoryGroup.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "tests/CL/CLAccessor.h"
#include "tests/Globals.h"
#include "tests/framework/Asserts.h"
@@ -83,8 +83,8 @@ TEST_CASE(ImportMemoryBuffer, framework::DatasetMode::ALL)
ARM_COMPUTE_EXPECT(t1.info()->is_resizable(), framework::LogLevel::ERRORS);
// Negative case : Import memory to a tensor that is memory managed
- CLTensor t2;
- CLMemoryGroup mg;
+ CLTensor t2;
+ MemoryGroup mg;
t2.allocator()->set_associated_memory_group(&mg);
ARM_COMPUTE_EXPECT(!bool(t2.allocator()->import_memory(buf)), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(t2.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/GLES_COMPUTE/UNIT/MemoryManager.cpp b/tests/validation/GLES_COMPUTE/UNIT/MemoryManager.cpp
index 8f59a05b8..50bd9f565 100644
--- a/tests/validation/GLES_COMPUTE/UNIT/MemoryManager.cpp
+++ b/tests/validation/GLES_COMPUTE/UNIT/MemoryManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -22,10 +22,10 @@
* SOFTWARE.
*/
#include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h"
-#include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h"
#include "arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h"
#include "arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h"
+#include "arm_compute/runtime/MemoryGroup.h"
#include "support/ToolchainSupport.h"
#include "tests/AssetsLibrary.h"
#include "tests/GLES_COMPUTE/GCAccessor.h"