aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm_compute/runtime/BlobMemoryPool.h12
-rw-r--r--src/runtime/BlobLifetimeManager.cpp9
-rw-r--r--src/runtime/BlobMemoryPool.cpp3
3 files changed, 15 insertions, 9 deletions
diff --git a/arm_compute/runtime/BlobMemoryPool.h b/arm_compute/runtime/BlobMemoryPool.h
index f2be2dd8df..f703bf0b82 100644
--- a/arm_compute/runtime/BlobMemoryPool.h
+++ b/arm_compute/runtime/BlobMemoryPool.h
@@ -26,19 +26,27 @@
#include "arm_compute/runtime/IMemoryPool.h"
-#include "arm_compute/runtime/IAllocator.h"
#include "arm_compute/runtime/Types.h"
#include <cstddef>
+#include <memory>
#include <vector>
namespace arm_compute
{
+class IAllocator;
+
/** Blob memory pool */
class BlobMemoryPool : public IMemoryPool
{
public:
- /** Default Constructor */
+ /** Default Constructor
+ *
+ * @note allocator should outlive the memory pool
+ *
+ * @param[in] allocator Backing memory allocator
+ * @param[in] blob_sizes Sizes of the blobs to be allocated
+ */
BlobMemoryPool(IAllocator *allocator, std::vector<size_t> blob_sizes);
/** Default Destructor */
~BlobMemoryPool();
diff --git a/src/runtime/BlobLifetimeManager.cpp b/src/runtime/BlobLifetimeManager.cpp
index c60d8c14ef..69292b9319 100644
--- a/src/runtime/BlobLifetimeManager.cpp
+++ b/src/runtime/BlobLifetimeManager.cpp
@@ -118,14 +118,13 @@ void BlobLifetimeManager::update_blobs_and_mappings()
ARM_COMPUTE_ERROR_ON(!are_all_finalized());
ARM_COMPUTE_ERROR_ON(_active_group == nullptr);
- // Sort finalized group requirements in descending order
- auto group = _finalized_groups[_active_group];
- std::sort(std::begin(group), std::end(group), [](const Element & a, const Element & b)
+ // Sort active group requirements in descending order
+ std::sort(std::begin(_active_elements), std::end(_active_elements), [](const Element & a, const Element & b)
{
return a.size > b.size;
});
std::vector<size_t> group_sizes;
- std::transform(std::begin(group), std::end(group), std::back_inserter(group_sizes), [](const Element & e)
+ std::transform(std::begin(_active_elements), std::end(_active_elements), std::back_inserter(group_sizes), [](const Element & e)
{
return e.size;
});
@@ -142,7 +141,7 @@ void BlobLifetimeManager::update_blobs_and_mappings()
// Calculate group mappings
auto &group_mappings = _active_group->mappings();
int blob_idx = 0;
- for(auto &e : group)
+ for(auto &e : _active_elements)
{
group_mappings[e.handle] = blob_idx++;
}
diff --git a/src/runtime/BlobMemoryPool.cpp b/src/runtime/BlobMemoryPool.cpp
index 6571c75fe7..29505e57fc 100644
--- a/src/runtime/BlobMemoryPool.cpp
+++ b/src/runtime/BlobMemoryPool.cpp
@@ -24,6 +24,7 @@
#include "arm_compute/runtime/BlobMemoryPool.h"
#include "arm_compute/core/Error.h"
+#include "arm_compute/runtime/IAllocator.h"
#include "arm_compute/runtime/IMemoryPool.h"
#include "arm_compute/runtime/Types.h"
#include "support/ToolchainSupport.h"
@@ -47,8 +48,6 @@ BlobMemoryPool::~BlobMemoryPool()
void BlobMemoryPool::acquire(MemoryMappings &handles)
{
- ARM_COMPUTE_ERROR_ON(handles.size() > _blobs.size());
-
// Set memory to handlers
for(auto &handle : handles)
{