aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2019-01-21 18:38:21 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-01-23 11:45:28 +0000
commit734151d20bef56cbedce2ae67945f42cb4e265c8 (patch)
treeb51f5fb5ead440e0f7a5f38785f2f2564442d0f5 /arm_compute
parente8c0c4397a508169282e5859410d5d6cdc87edbe (diff)
downloadComputeLibrary-734151d20bef56cbedce2ae67945f42cb4e265c8.tar.gz
COMPMID-1848: Account alignment in Offset-based pool allocations
Change-Id: I061d612341bf951a7d0e7ddd04a42139c8400d41 Reviewed-on: https://review.mlplatform.org/554 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/runtime/BlobLifetimeManager.h7
-rw-r--r--arm_compute/runtime/BlobMemoryPool.h13
-rw-r--r--arm_compute/runtime/OffsetLifetimeManager.h6
-rw-r--r--arm_compute/runtime/OffsetMemoryPool.h9
-rw-r--r--arm_compute/runtime/Types.h14
5 files changed, 26 insertions, 23 deletions
diff --git a/arm_compute/runtime/BlobLifetimeManager.h b/arm_compute/runtime/BlobLifetimeManager.h
index 2dbe92d7b6..586ad10fa0 100644
--- a/arm_compute/runtime/BlobLifetimeManager.h
+++ b/arm_compute/runtime/BlobLifetimeManager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -26,15 +26,16 @@
#include "arm_compute/runtime/ISimpleLifetimeManager.h"
-#include "arm_compute/runtime/BlobMemoryPool.h"
#include "arm_compute/runtime/Types.h"
-#include <cstddef>
#include <memory>
#include <vector>
namespace arm_compute
{
+// Forward declarations
+class IMemoryPool;
+
/** Concrete class that tracks the lifetime of registered tensors and
* calculates the systems memory requirements in terms of blobs */
class BlobLifetimeManager : public ISimpleLifetimeManager
diff --git a/arm_compute/runtime/BlobMemoryPool.h b/arm_compute/runtime/BlobMemoryPool.h
index ba97dbd94e..c2e0902493 100644
--- a/arm_compute/runtime/BlobMemoryPool.h
+++ b/arm_compute/runtime/BlobMemoryPool.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -38,17 +38,6 @@ 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
{
diff --git a/arm_compute/runtime/OffsetLifetimeManager.h b/arm_compute/runtime/OffsetLifetimeManager.h
index e39d6a0d6a..26aeb1ef6a 100644
--- a/arm_compute/runtime/OffsetLifetimeManager.h
+++ b/arm_compute/runtime/OffsetLifetimeManager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,12 +28,12 @@
#include "arm_compute/runtime/Types.h"
-#include <cstddef>
#include <map>
#include <vector>
namespace arm_compute
{
+// Forward declarations
class IMemoryPool;
/** Concrete class that tracks the lifetime of registered tensors and
@@ -61,7 +61,7 @@ private:
void update_blobs_and_mappings() override;
private:
- size_t _blob; /**< Memory blob size */
+ BlobInfo _blob; /**< Memory blob size */
};
} // namespace arm_compute
#endif /* __ARM_COMPUTE_OFFSETLIFETIMEMANAGER_H__ */
diff --git a/arm_compute/runtime/OffsetMemoryPool.h b/arm_compute/runtime/OffsetMemoryPool.h
index 480d424b5b..bc09de6a14 100644
--- a/arm_compute/runtime/OffsetMemoryPool.h
+++ b/arm_compute/runtime/OffsetMemoryPool.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -30,6 +30,7 @@
#include "arm_compute/runtime/Types.h"
#include <cstddef>
+#include <memory>
namespace arm_compute
{
@@ -44,9 +45,9 @@ public:
* @note allocator should outlive the memory pool
*
* @param[in] allocator Backing memory allocator
- * @param[in] blob_size Size of the memory be allocated
+ * @param[in] blob_info Configuration information of the blob to be allocated
*/
- OffsetMemoryPool(IAllocator *allocator, size_t blob_size);
+ OffsetMemoryPool(IAllocator *allocator, BlobInfo blob_info);
/** Default Destructor */
~OffsetMemoryPool() = default;
/** Prevent instances of this class to be copy constructed */
@@ -67,7 +68,7 @@ public:
private:
IAllocator *_allocator; /**< Allocator to use for internal allocation */
std::unique_ptr<IMemoryRegion> _blob; /**< Memory blob */
- size_t _blob_size; /**< Sizes of the allocated memory blob */
+ BlobInfo _blob_info; /**< Information for the blob to allocate */
};
} // namespace arm_compute
#endif /* __ARM_COMPUTE_OFFSETMEMORYPOOL_H__ */
diff --git a/arm_compute/runtime/Types.h b/arm_compute/runtime/Types.h
index f2607c0204..fece5137f7 100644
--- a/arm_compute/runtime/Types.h
+++ b/arm_compute/runtime/Types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,5 +46,17 @@ using MemoryMappings = std::map<IMemory *, size_t>;
/** A map of the groups and memory mappings */
using GroupMappings = std::map<size_t, MemoryMappings>;
+
+/** Meta-data information for each blob */
+struct BlobInfo
+{
+ BlobInfo(size_t size_ = 0, size_t alignment_ = 0, size_t owners_ = 1)
+ : size(size_), alignment(alignment_), owners(owners_)
+ {
+ }
+ size_t size; /**< Blob size */
+ size_t alignment; /**< Blob alignment */
+ size_t owners; /**< Number of owners in parallel of the blob */
+};
} // namespace arm_compute
#endif /* __ARM_COMPUTE_RUNTIME_TYPES_H__ */