aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/CLTensorAllocator.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-09-08 19:47:30 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitbaf174e85ddb5399355281cd34d0f459d92124a7 (patch)
treed69904df66f7e5ad55edd268d16735542445f36f /arm_compute/runtime/CL/CLTensorAllocator.h
parent1c8409d7ce90ea449437076574c98a4ea90d9368 (diff)
downloadComputeLibrary-baf174e85ddb5399355281cd34d0f459d92124a7.tar.gz
COMPMID-485: Memory Manager
Change-Id: Ib421b7622838f050038cd81e7426bb1413a7d6e6 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87376 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/runtime/CL/CLTensorAllocator.h')
-rw-r--r--arm_compute/runtime/CL/CLTensorAllocator.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/arm_compute/runtime/CL/CLTensorAllocator.h b/arm_compute/runtime/CL/CLTensorAllocator.h
index ed371e0642..682de174a8 100644
--- a/arm_compute/runtime/CL/CLTensorAllocator.h
+++ b/arm_compute/runtime/CL/CLTensorAllocator.h
@@ -24,19 +24,27 @@
#ifndef __ARM_COMPUTE_CLTENSORALLOCATOR_H__
#define __ARM_COMPUTE_CLTENSORALLOCATOR_H__
-#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/runtime/ITensorAllocator.h"
+#include "arm_compute/core/CL/OpenCL.h"
+
#include <cstdint>
namespace arm_compute
{
+class CLTensor;
+template <typename>
+class MemoryGroupBase;
+using CLMemoryGroup = MemoryGroupBase<CLTensor>;
+
/** Basic implementation of a CL memory tensor allocator. */
class CLTensorAllocator : public ITensorAllocator
{
public:
/** Default constructor. */
- CLTensorAllocator();
+ CLTensorAllocator(CLTensor *owner = nullptr);
+ /** Default destructor */
+ ~CLTensorAllocator();
/** 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). */
@@ -45,8 +53,6 @@ public:
CLTensorAllocator(CLTensorAllocator &&) = default;
/** Allow instances of this class to be moved */
CLTensorAllocator &operator=(CLTensorAllocator &&) = default;
- /** Default destructor */
- ~CLTensorAllocator() = default;
/** Interface to be implemented by the child class to return the pointer to the mapped data. */
uint8_t *data();
@@ -85,6 +91,11 @@ public:
*
*/
void free() override;
+ /** Associates the tensor with a memory group
+ *
+ * @param[in] associated_memory_group Memory group to associate the tensor with
+ */
+ void set_associated_memory_group(CLMemoryGroup *associated_memory_group);
protected:
/** Call map() on the OpenCL buffer.
@@ -96,8 +107,10 @@ protected:
void unlock() override;
private:
- cl::Buffer _buffer; /**< OpenCL buffer containing the tensor data. */
- uint8_t *_mapping; /**< Pointer to the CPU mapping of the OpenCL buffer. */
+ CLMemoryGroup *_associated_memory_group; /**< Registered memory manager */
+ cl::Buffer _buffer; /**< OpenCL buffer containing the tensor data. */
+ uint8_t *_mapping; /**< Pointer to the CPU mapping of the OpenCL buffer. */
+ CLTensor *_owner; /**< Owner of the allocator */
};
}
#endif /* __ARM_COMPUTE_CLTENSORALLOCATOR_H__ */