diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-05-03 20:47:16 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:51:50 +0000 |
commit | 3d1489de593574e65ef1e64a7ae64e4e56c2978b (patch) | |
tree | f87f3df521cb5ed8bd383dad89cbeb92c49670ac /src/runtime/BlobLifetimeManager.cpp | |
parent | 54d6fae4dbb4f556cc5ec484c51681ad84c015a7 (diff) | |
download | ComputeLibrary-3d1489de593574e65ef1e64a7ae64e4e56c2978b.tar.gz |
COMPMID-605: Transition buffer memory manager
Change-Id: Ide7c6124eb19f13f15f517e62d705646a0cd1ecd
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130184
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/runtime/BlobLifetimeManager.cpp')
-rw-r--r-- | src/runtime/BlobLifetimeManager.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/runtime/BlobLifetimeManager.cpp b/src/runtime/BlobLifetimeManager.cpp index 3ca5071d91..2a4ab6ec0d 100644 --- a/src/runtime/BlobLifetimeManager.cpp +++ b/src/runtime/BlobLifetimeManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -57,15 +57,15 @@ void BlobLifetimeManager::update_blobs_and_mappings() ARM_COMPUTE_ERROR_ON(!are_all_finalized()); ARM_COMPUTE_ERROR_ON(_active_group == nullptr); - // Sort active group requirements in descending order. - std::sort(std::begin(_active_elements), std::end(_active_elements), [](const Element & a, const Element & b) + // Sort free blobs requirements in descending order. + _free_blobs.sort([](const Blob & ba, const Blob & bb) { - return a.size > b.size; + return ba.max_size > bb.max_size; }); std::vector<size_t> group_sizes; - std::transform(std::begin(_active_elements), std::end(_active_elements), std::back_inserter(group_sizes), [](const Element & e) + std::transform(std::begin(_free_blobs), std::end(_free_blobs), std::back_inserter(group_sizes), [](const Blob & b) { - return e.size; + return b.max_size; }); // Update blob sizes @@ -80,8 +80,14 @@ void BlobLifetimeManager::update_blobs_and_mappings() // Calculate group mappings auto &group_mappings = _active_group->mappings(); int blob_idx = 0; - for(auto &e : _active_elements) + for(auto &free_blob : _free_blobs) { - group_mappings[e.handle] = blob_idx++; + 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] = blob_idx; + } + ++blob_idx; } } |