From 3d1489de593574e65ef1e64a7ae64e4e56c2978b Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 3 May 2018 20:47:16 +0100 Subject: COMPMID-605: Transition buffer memory manager Change-Id: Ide7c6124eb19f13f15f517e62d705646a0cd1ecd Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130184 Reviewed-by: Georgios Pinitas Tested-by: Jenkins Reviewed-by: Anthony Barbier --- src/runtime/OffsetLifetimeManager.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/runtime/OffsetLifetimeManager.cpp') diff --git a/src/runtime/OffsetLifetimeManager.cpp b/src/runtime/OffsetLifetimeManager.cpp index 4540aeab28..d0b3bde724 100644 --- a/src/runtime/OffsetLifetimeManager.cpp +++ b/src/runtime/OffsetLifetimeManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -58,19 +58,24 @@ void OffsetLifetimeManager::update_blobs_and_mappings() ARM_COMPUTE_ERROR_ON(_active_group == nullptr); // Update blob size - size_t max_group_size = std::accumulate(std::begin(_active_elements), std::end(_active_elements), static_cast(0), [](size_t s, const Element & e) + size_t max_group_size = std::accumulate(std::begin(_free_blobs), std::end(_free_blobs), static_cast(0), [](size_t s, const Blob & b) { - return s + e.size; + return s + b.max_size; }); _blob = std::max(_blob, max_group_size); // Calculate group mappings auto &group_mappings = _active_group->mappings(); size_t offset = 0; - for(auto &e : _active_elements) + for(auto &free_blob : _free_blobs) { - group_mappings[e.handle] = offset; - offset += e.size; + for(auto &bound_element_id : free_blob.bound_elements) + { + ARM_COMPUTE_ERROR_ON(_active_elements.find(bound_element_id) == std::end(_active_elements)); + Element &bound_element = _active_elements[bound_element_id]; + group_mappings[bound_element.handle] = offset; + } + offset += free_blob.max_size; ARM_COMPUTE_ERROR_ON(offset > _blob); } } -- cgit v1.2.1