aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/TensorAllocator.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/TensorAllocator.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/TensorAllocator.h')
-rw-r--r--arm_compute/runtime/TensorAllocator.h25
1 files changed, 23 insertions, 2 deletions
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 <typename>
+class MemoryGroupBase;
+using MemoryGroup = MemoryGroupBase<Tensor>;
/** 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<std::vector<uint8_t>> _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__ */