MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / update_blobs_and_mappings

Method update_blobs_and_mappings

src/runtime/BlobLifetimeManager.cpp:58–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void BlobLifetimeManager::update_blobs_and_mappings()
59{
60 ARM_COMPUTE_ERROR_ON(!are_all_finalized());
61 ARM_COMPUTE_ERROR_ON(_active_group == nullptr);
62
63 // Sort free blobs requirements in descending order.
64 _free_blobs.sort([](const Blob &ba, const Blob &bb) { return ba.max_size > bb.max_size; });
65
66 // Create group sizes vector
67 std::vector<BlobInfo> group_sizes;
68 std::transform(std::begin(_free_blobs), std::end(_free_blobs), std::back_inserter(group_sizes),
69 [](const Blob &b) {
70 return BlobInfo{b.max_size, b.max_alignment, b.bound_elements.size()};
71 });
72
73 // Update blob sizes
74 size_t max_size = std::max(_blobs.size(), group_sizes.size());
75 _blobs.resize(max_size);
76 group_sizes.resize(max_size);
77 std::transform(std::begin(_blobs), std::end(_blobs), std::begin(group_sizes), std::begin(_blobs),
78 [](BlobInfo lhs, BlobInfo rhs)
79 {
80 return BlobInfo{std::max(lhs.size, rhs.size), std::max(lhs.alignment, rhs.alignment),
81 std::max(lhs.owners, rhs.owners)};
82 });
83
84 // Calculate group mappings
85 auto &group_mappings = _active_group->mappings();
86 int blob_idx = 0;
87 for (auto &free_blob : _free_blobs)
88 {
89 for (auto &bound_element_id : free_blob.bound_elements)
90 {
91 ARM_COMPUTE_ERROR_ON(_active_elements.find(bound_element_id) == std::end(_active_elements));
92 Element &bound_element = _active_elements[bound_element_id];
93 group_mappings[bound_element.handle] = blob_idx;
94 }
95 ++blob_idx;
96 }
97}
98} // namespace arm_compute

Callers

nothing calls this directly

Calls 5

transformFunction · 0.85
endFunction · 0.85
findMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected