From baf174e85ddb5399355281cd34d0f459d92124a7 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 8 Sep 2017 19:47:30 +0100 Subject: COMPMID-485: Memory Manager Change-Id: Ib421b7622838f050038cd81e7426bb1413a7d6e6 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87376 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- arm_compute/runtime/TensorAllocator.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'arm_compute/runtime/TensorAllocator.h') diff --git a/arm_compute/runtime/TensorAllocator.h b/arm_compute/runtime/TensorAllocator.h index 450323b3ab..40704c0a17 100644 --- a/arm_compute/runtime/TensorAllocator.h +++ b/arm_compute/runtime/TensorAllocator.h @@ -34,13 +34,27 @@ namespace arm_compute { class Coordinates; class TensorInfo; +class Tensor; +template +class MemoryGroupBase; +using MemoryGroup = MemoryGroupBase; /** Basic implementation of a CPU memory tensor allocator. */ class TensorAllocator : public ITensorAllocator { public: /** Default constructor. */ - TensorAllocator(); + TensorAllocator(Tensor *owner = nullptr); + /** Default destructor */ + ~TensorAllocator(); + /** Prevent instances of this class from being copied (As this class contains pointers). */ + TensorAllocator(const TensorAllocator &) = delete; + /** Prevent instances of this class from being copy assigned (As this class contains pointers). */ + TensorAllocator &operator=(const TensorAllocator &) = delete; + /** Allow instances of this class to be moved */ + TensorAllocator(TensorAllocator &&) noexcept; + /** Allow instances of this class to be moved */ + TensorAllocator &operator=(TensorAllocator &&) noexcept; /** Make ITensorAllocator's init methods available */ using ITensorAllocator::init; @@ -72,6 +86,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(MemoryGroup *associated_memory_group); protected: /** No-op for CPU memory @@ -84,7 +103,9 @@ protected: void unlock() override; private: - std::shared_ptr> _buffer; /**< CPU memory allocation. */ + MemoryGroup *_associated_memory_group; /**< Registered memory manager */ + uint8_t *_buffer; /**< CPU memory allocation. */ + Tensor *_owner; /**< Owner of the allocator */ }; } #endif /* __ARM_COMPUTE_TENSORALLOCATOR_H__ */ -- cgit v1.2.1