aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/BlobMemoryPool.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-12-14 17:11:20 +0000
committerMichele Di Giorgio <michele.digiorgio@arm.com>2018-12-14 19:45:00 +0000
commit555f1c2241d6fa8c84926a72a0c54e4158817df4 (patch)
tree0ec5da469c28559d8c5df9848cfa3ada6e0646e8 /arm_compute/runtime/BlobMemoryPool.h
parentb4af2c6738614850aaca3754904f0e8e3b17f0b2 (diff)
downloadComputeLibrary-555f1c2241d6fa8c84926a72a0c54e4158817df4.tar.gz
COMPMID-1710: Account alignment for blob-base allocations
Change-Id: I290d33e25a5966d25a91df39ebc01c28bfa31f78 Reviewed-on: https://review.mlplatform.org/402 Reviewed-by: Anthony Barbier <Anthony.barbier@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/runtime/BlobMemoryPool.h')
-rw-r--r--arm_compute/runtime/BlobMemoryPool.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/arm_compute/runtime/BlobMemoryPool.h b/arm_compute/runtime/BlobMemoryPool.h
index c9c4da0f54..ba97dbd94e 100644
--- a/arm_compute/runtime/BlobMemoryPool.h
+++ b/arm_compute/runtime/BlobMemoryPool.h
@@ -35,8 +35,20 @@
namespace arm_compute
{
+// Forward declaration
class IAllocator;
+/** Meta-data information for each blob */
+struct BlobInfo
+{
+ BlobInfo(size_t size_ = 0, size_t alignment_ = 0)
+ : size(size_), alignment(alignment_)
+ {
+ }
+ size_t size; /**< Blob size */
+ size_t alignment; /**< Blob alignment */
+};
+
/** Blob memory pool */
class BlobMemoryPool : public IMemoryPool
{
@@ -45,10 +57,10 @@ public:
*
* @note allocator should outlive the memory pool
*
- * @param[in] allocator Backing memory allocator
- * @param[in] blob_sizes Sizes of the blobs to be allocated
+ * @param[in] allocator Backing memory allocator
+ * @param[in] blob_info Configuration information of the blobs to be allocated
*/
- BlobMemoryPool(IAllocator *allocator, std::vector<size_t> blob_sizes);
+ BlobMemoryPool(IAllocator *allocator, std::vector<BlobInfo> blob_info);
/** Default Destructor */
~BlobMemoryPool();
/** Prevent instances of this class to be copy constructed */
@@ -69,16 +81,16 @@ public:
private:
/** Allocates internal blobs
*
- * @param sizes Size of each blob
+ * @param blob_info Size of each blob
*/
- void allocate_blobs(const std::vector<size_t> &sizes);
+ void allocate_blobs(const std::vector<BlobInfo> &blob_info);
/** Frees blobs **/
void free_blobs();
private:
- IAllocator *_allocator; /**< Allocator to use for internal allocation */
- std::vector<std::unique_ptr<IMemoryRegion>> _blobs; /**< Vector holding all the memory blobs */
- std::vector<size_t> _blob_sizes; /**< Sizes of each blob */
+ IAllocator *_allocator; /**< Allocator to use for internal allocation */
+ std::vector<std::unique_ptr<IMemoryRegion>> _blobs; /**< Vector holding all the memory blobs */
+ std::vector<BlobInfo> _blob_info; /**< Information of each blob */
};
} // namespace arm_compute
#endif /* __ARM_COMPUTE_BLOBMEMORYPOOL_H__ */