aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/TensorAllocator.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-11-07 13:24:57 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit84b51ad1aaa530d397761f2b6da65add9dc8a6b0 (patch)
tree4f0150ef15c6bbff287658c517e3257513e4dc3e /arm_compute/runtime/TensorAllocator.h
parentc5d54397f6da490442f93ae880b361c45969f6b1 (diff)
downloadComputeLibrary-84b51ad1aaa530d397761f2b6da65add9dc8a6b0.tar.gz
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 <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'arm_compute/runtime/TensorAllocator.h')
-rw-r--r--arm_compute/runtime/TensorAllocator.h16
1 files changed, 15 insertions, 1 deletions
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 <cstdint>
#include <memory>
@@ -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 */
};
}