From 84b51ad1aaa530d397761f2b6da65add9dc8a6b0 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 7 Nov 2017 13:24:57 +0000 Subject: COMPMID-666: Adds the ability to import backing memory in a Tensor(CPU). Change-Id: I62b843b544fe9048837fd64c22e970fc6a0aaf23 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94881 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- arm_compute/runtime/TensorAllocator.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'arm_compute/runtime/TensorAllocator.h') diff --git a/arm_compute/runtime/TensorAllocator.h b/arm_compute/runtime/TensorAllocator.h index 40704c0a17..5e00cc0cc7 100644 --- a/arm_compute/runtime/TensorAllocator.h +++ b/arm_compute/runtime/TensorAllocator.h @@ -25,6 +25,7 @@ #define __ARM_COMPUTE_TENSORALLOCATOR_H__ #include "arm_compute/runtime/ITensorAllocator.h" +#include "arm_compute/runtime/Memory.h" #include #include @@ -86,6 +87,19 @@ public: * */ void free() override; + /** Import an existing memory as a tensor's backing memory + * + * @warning If the tensor is flagged to be managed by a memory manager, + * this call will lead to an error. + * @warning Ownership of memory depends on the way the @ref Memory object was constructed + * @note Calling free on a tensor with imported memory will just clear + * the internal pointer value. + * + * @param[in] memory Memory to import + * + * @return error status + */ + arm_compute::Error import_memory(Memory memory); /** Associates the tensor with a memory group * * @param[in] associated_memory_group Memory group to associate the tensor with @@ -104,7 +118,7 @@ protected: private: MemoryGroup *_associated_memory_group; /**< Registered memory manager */ - uint8_t *_buffer; /**< CPU memory allocation. */ + Memory _memory; /**< CPU memory */ Tensor *_owner; /**< Owner of the allocator */ }; } -- cgit v1.2.1