diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-09-09 19:00:57 +0100 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-09-17 11:37:02 +0000 |
commit | 26014cf4d0519aef280c8444c60ec34c4e37e3b6 (patch) | |
tree | 7f4b3cb8589c10e95288a722498c9256e8bf5e22 /arm_compute/runtime/TensorAllocator.h | |
parent | caa7deedfe1b0d0020c6099d8f616ec92b1bd5e9 (diff) | |
download | ComputeLibrary-26014cf4d0519aef280c8444c60ec34c4e37e3b6.tar.gz |
COMPMID-2649: Generalize MemoryGroup.
Avoids any upcasting.
Change-Id: I2181c7c9df59a7fb8a78e11934fbd96058fd39c7
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1918
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Diffstat (limited to 'arm_compute/runtime/TensorAllocator.h')
-rw-r--r-- | arm_compute/runtime/TensorAllocator.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/arm_compute/runtime/TensorAllocator.h b/arm_compute/runtime/TensorAllocator.h index 28141134cb..b33a8f8785 100644 --- a/arm_compute/runtime/TensorAllocator.h +++ b/arm_compute/runtime/TensorAllocator.h @@ -23,9 +23,10 @@ */ #ifndef __ARM_COMPUTE_TENSORALLOCATOR_H__ #define __ARM_COMPUTE_TENSORALLOCATOR_H__ - #include "arm_compute/runtime/ITensorAllocator.h" + #include "arm_compute/runtime/Memory.h" +#include "arm_compute/runtime/MemoryGroup.h" #include <cstdint> #include <memory> @@ -33,12 +34,9 @@ namespace arm_compute { +// Forward declaration 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 @@ -46,9 +44,9 @@ class TensorAllocator : public ITensorAllocator public: /** Default constructor. * - * @param[in] owner Owner of the tensor allocator. + * @param[in] owner Memory manageable owner */ - TensorAllocator(Tensor *owner = nullptr); + TensorAllocator(IMemoryManageable *owner); /** Default destructor */ ~TensorAllocator(); /** Prevent instances of this class from being copied (As this class contains pointers) */ @@ -111,7 +109,7 @@ public: * * @param[in] associated_memory_group Memory group to associate the tensor with */ - void set_associated_memory_group(MemoryGroup *associated_memory_group); + void set_associated_memory_group(IMemoryGroup *associated_memory_group); protected: /** No-op for CPU memory @@ -124,9 +122,9 @@ protected: void unlock() override; private: - MemoryGroup *_associated_memory_group; /**< Registered memory manager */ - Memory _memory; /**< CPU memory */ - Tensor *_owner; /**< Owner of the allocator */ + IMemoryManageable *_owner; /**< Memory manageable object that owns the allocator */ + IMemoryGroup *_associated_memory_group; /**< Registered memory manager */ + Memory _memory; /**< CPU memory */ }; -} +} // namespace arm_compute #endif /* __ARM_COMPUTE_TENSORALLOCATOR_H__ */ |