aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/CLTensorAllocator.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-04-23 16:26:46 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:50:15 +0000
commit99d40951df87790fb884ce1c42d5e2a7a0009ee0 (patch)
tree774e2c6d0849a7fb3f13c7cc4773f7cbfea448fb /arm_compute/runtime/CL/CLTensorAllocator.h
parentcda0c38373b2f114509392ba16ef04e8c1e0f819 (diff)
downloadComputeLibrary-99d40951df87790fb884ce1c42d5e2a7a0009ee0.tar.gz
COMPMID-1023: Import memory for OpenCL
Change-Id: I201bc00a1261814737e6b6878ecfe9904bae0cc1 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128212 Tested-by: Jenkins <bsgcomp@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.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/arm_compute/runtime/CL/CLTensorAllocator.h b/arm_compute/runtime/CL/CLTensorAllocator.h
index 6929d551fb..a372195555 100644
--- a/arm_compute/runtime/CL/CLTensorAllocator.h
+++ b/arm_compute/runtime/CL/CLTensorAllocator.h
@@ -24,10 +24,11 @@
#ifndef __ARM_COMPUTE_CLTENSORALLOCATOR_H__
#define __ARM_COMPUTE_CLTENSORALLOCATOR_H__
+#include "arm_compute/runtime/CL/CLMemory.h"
#include "arm_compute/runtime/ITensorAllocator.h"
#include "arm_compute/core/CL/OpenCL.h"
-#include "arm_compute/runtime/CL/SVMMemory.h"
+
#include <cstdint>
namespace arm_compute
@@ -47,8 +48,6 @@ public:
* @param[in] owner (Optional) Owner of the allocator.
*/
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) */
@@ -68,8 +67,6 @@ public:
* @return pointer to the CL data.
*/
const cl::Buffer &cl_data() const;
- /** SVM memory */
- void *svm_ptr();
/** Enqueue a map operation of the allocated buffer on the given queue.
*
@@ -104,6 +101,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 CLMemory 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::Status import_memory(CLMemory memory);
/** Associates the tensor with a memory group
*
* @param[in] associated_memory_group Memory group to associate the tensor with
@@ -121,10 +131,8 @@ protected:
private:
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. */
+ CLMemory _memory; /**< OpenCL memory */
CLTensor *_owner; /**< Owner of the allocator */
- SVMMemory _svm_memory; /**< Svm memory */
};
-}
+} // namespace arm_compute
#endif /* __ARM_COMPUTE_CLTENSORALLOCATOR_H__ */