50 return std::make_unique<BlobMemoryPool>(
allocator, _blobs);
58 void BlobLifetimeManager::update_blobs_and_mappings()
64 _free_blobs.sort([](
const Blob & ba,
const Blob & bb)
66 return ba.max_size > bb.max_size;
70 std::vector<BlobInfo> group_sizes;
71 std::transform(std::begin(_free_blobs),
std::end(_free_blobs), std::back_inserter(group_sizes), [](
const Blob &
b)
73 return BlobInfo{ b.max_size, b.max_alignment, b.bound_elements.
size() };
77 size_t max_size = std::max(_blobs.size(), group_sizes.size());
78 _blobs.resize(max_size);
79 group_sizes.resize(max_size);
80 std::transform(std::begin(_blobs),
std::end(_blobs), std::begin(group_sizes), std::begin(_blobs), [](
BlobInfo lhs,
BlobInfo rhs)
86 auto &group_mappings = _active_group->mappings();
88 for(
auto &free_blob : _free_blobs)
90 for(
auto &bound_element_id : free_blob.bound_elements)
93 Element &bound_element = _active_elements[bound_element_id];
94 group_mappings[bound_element.handle] = blob_idx;
Meta-data information for each blob.
bool are_all_finalized() const override
Checks if the lifetime of the registered object is complete.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
BlobLifetimeManager()
Constructor.
Copyright (c) 2017-2021 Arm Limited.
Mappings are in blob granularity.
size_t alignment
Blob alignment.
std::unique_ptr< IMemoryPool > create_pool(IAllocator *allocator) override
Creates a memory pool depending on the memory requirements.
void end(TokenStream &in, bool &valid)
input allocator() -> allocate()
MappingType mapping_type() const override
Returns the type of mappings that the lifetime manager returns.
size_t owners
Number of owners in parallel of the blob.
const info_type & info() const
Accessor to the pool internal configuration meta-data.
std::vector< BlobInfo > info_type