aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/TensorAllocator.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2019-09-09 19:00:57 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-09-17 11:37:02 +0000
commit26014cf4d0519aef280c8444c60ec34c4e37e3b6 (patch)
tree7f4b3cb8589c10e95288a722498c9256e8bf5e22 /src/runtime/TensorAllocator.cpp
parentcaa7deedfe1b0d0020c6099d8f616ec92b1bd5e9 (diff)
downloadComputeLibrary-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 'src/runtime/TensorAllocator.cpp')
-rw-r--r--src/runtime/TensorAllocator.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/runtime/TensorAllocator.cpp b/src/runtime/TensorAllocator.cpp
index dfe239c586..7352932ac7 100644
--- a/src/runtime/TensorAllocator.cpp
+++ b/src/runtime/TensorAllocator.cpp
@@ -66,8 +66,8 @@ bool validate_subtensor_shape(const TensorInfo &parent_info, const TensorInfo &c
}
} // namespace
-TensorAllocator::TensorAllocator(Tensor *owner)
- : _associated_memory_group(nullptr), _memory(), _owner(owner)
+TensorAllocator::TensorAllocator(IMemoryManageable *owner)
+ : _owner(owner), _associated_memory_group(nullptr), _memory()
{
}
@@ -78,28 +78,28 @@ TensorAllocator::~TensorAllocator()
TensorAllocator::TensorAllocator(TensorAllocator &&o) noexcept
: ITensorAllocator(std::move(o)),
+ _owner(o._owner),
_associated_memory_group(o._associated_memory_group),
- _memory(std::move(o._memory)),
- _owner(o._owner)
+ _memory(std::move(o._memory))
{
+ o._owner = nullptr;
o._associated_memory_group = nullptr;
o._memory = Memory();
- o._owner = nullptr;
}
TensorAllocator &TensorAllocator::operator=(TensorAllocator &&o) noexcept
{
if(&o != this)
{
+ _owner = o._owner;
+ o._owner = nullptr;
+
_associated_memory_group = o._associated_memory_group;
o._associated_memory_group = nullptr;
_memory = std::move(o._memory);
o._memory = Memory();
- _owner = o._owner;
- o._owner = nullptr;
-
ITensorAllocator::operator=(std::move(o));
}
return *this;
@@ -161,7 +161,7 @@ Status TensorAllocator::import_memory(void *memory)
return Status{};
}
-void TensorAllocator::set_associated_memory_group(MemoryGroup *associated_memory_group)
+void TensorAllocator::set_associated_memory_group(IMemoryGroup *associated_memory_group)
{
ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr);
ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group);