aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2019-09-18 12:04:56 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-09-27 17:20:08 +0000
commit40958adf8bad8fd9fefe591ee55a381f7bbb6fea (patch)
treec96403fb2f47908278c4d33c63fbfc856b7aa0e0 /src
parentbc166d5a8e350bed6b50d7315f8e8502fc9a17b1 (diff)
downloadComputeLibrary-40958adf8bad8fd9fefe591ee55a381f7bbb6fea.tar.gz
COMPMID-2663: Interface to unbound mappings.
Adds an interface to ILifetimeManager to unbound a list of mappings. Change-Id: I927fa1e0f83e6be778fd36794439f51d36dde408 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-on: https://review.mlplatform.org/c/1988 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/BlobLifetimeManager.cpp4
-rw-r--r--src/runtime/ISimpleLifetimeManager.cpp21
2 files changed, 20 insertions, 5 deletions
diff --git a/src/runtime/BlobLifetimeManager.cpp b/src/runtime/BlobLifetimeManager.cpp
index 7a4760a990..fb83834b5f 100644
--- a/src/runtime/BlobLifetimeManager.cpp
+++ b/src/runtime/BlobLifetimeManager.cpp
@@ -71,7 +71,7 @@ void BlobLifetimeManager::update_blobs_and_mappings()
std::vector<BlobInfo> group_sizes;
std::transform(std::begin(_free_blobs), std::end(_free_blobs), std::back_inserter(group_sizes), [](const Blob & b)
{
- return BlobInfo{ b.max_size, b.max_alignment };
+ return BlobInfo{ b.max_size, b.max_alignment, b.bound_elements.size() };
});
// Update blob sizes
@@ -80,7 +80,7 @@ void BlobLifetimeManager::update_blobs_and_mappings()
group_sizes.resize(max_size);
std::transform(std::begin(_blobs), std::end(_blobs), std::begin(group_sizes), std::begin(_blobs), [](BlobInfo lhs, BlobInfo rhs)
{
- return BlobInfo{ std::max(lhs.size, rhs.size), std::max(lhs.alignment, rhs.alignment) };
+ return BlobInfo{ std::max(lhs.size, rhs.size), std::max(lhs.alignment, rhs.alignment), std::max(lhs.owners, rhs.owners) };
});
// Calculate group mappings
diff --git a/src/runtime/ISimpleLifetimeManager.cpp b/src/runtime/ISimpleLifetimeManager.cpp
index 39a4096799..b01de57c35 100644
--- a/src/runtime/ISimpleLifetimeManager.cpp
+++ b/src/runtime/ISimpleLifetimeManager.cpp
@@ -35,8 +35,8 @@
#include <map>
#include <vector>
-using namespace arm_compute;
-
+namespace arm_compute
+{
ISimpleLifetimeManager::ISimpleLifetimeManager()
: _active_group(nullptr), _active_elements(), _free_blobs(), _occupied_blobs(), _finalized_groups()
{
@@ -51,6 +51,20 @@ void ISimpleLifetimeManager::register_group(IMemoryGroup *group)
}
}
+bool ISimpleLifetimeManager::release_group(IMemoryGroup *group)
+{
+ if(group == nullptr)
+ {
+ return false;
+ }
+ const bool status = bool(_finalized_groups.erase(group));
+ if(status)
+ {
+ group->mappings().clear();
+ }
+ return status;
+}
+
void ISimpleLifetimeManager::start_lifetime(void *obj)
{
ARM_COMPUTE_ERROR_ON(obj == nullptr);
@@ -109,7 +123,7 @@ void ISimpleLifetimeManager::end_lifetime(void *obj, IMemory &obj_memory, size_t
update_blobs_and_mappings();
// Update finalized groups
- _finalized_groups[_active_group] = std::move(_active_elements);
+ _finalized_groups[_active_group].insert(std::begin(_active_elements), std::end(_active_elements));
// Reset state
_active_elements.clear();
@@ -125,3 +139,4 @@ bool ISimpleLifetimeManager::are_all_finalized() const
return !e.second.status;
});
}
+} // namespace arm_compute