aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/MemoryManager.hpp
diff options
context:
space:
mode:
authorFinn Williams <finn.williams@arm.com>2021-10-28 19:07:32 +0100
committerFinn Williams <finn.williams@arm.com>2021-11-08 14:33:17 +0000
commitb1aad4270fa8ad5c4aa62e27d564baf723b2cee5 (patch)
tree98b19ba85b50e2c730d5d2e3822cd2b1438bd149 /src/backends/backendsCommon/MemoryManager.hpp
parent3f22d27f51c493e37b9da0692b6bf776f4430dcf (diff)
downloadarmnn-b1aad4270fa8ad5c4aa62e27d564baf723b2cee5.tar.gz
IVGCVSW-6527 Support the new memory API in loaded network
* enable external memory management for neon and ref backends * change m_TensorMemoryVector to hold shared pointers * change input layer backend Id to match backend id of connected layer Signed-off-by: Finn Williams <finn.williams@arm.com> Change-Id: I2216a724028312eb101b290df3f224177826b1a0
Diffstat (limited to 'src/backends/backendsCommon/MemoryManager.hpp')
-rw-r--r--src/backends/backendsCommon/MemoryManager.hpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backends/backendsCommon/MemoryManager.hpp b/src/backends/backendsCommon/MemoryManager.hpp
index cbd6fcf9bc..5113b231d3 100644
--- a/src/backends/backendsCommon/MemoryManager.hpp
+++ b/src/backends/backendsCommon/MemoryManager.hpp
@@ -2,6 +2,7 @@
// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
+#pragma once
#include <armnn/backends/ICustomAllocator.hpp>
@@ -10,7 +11,7 @@ namespace armnn
struct Allocator
{
/// Pointer to @ICustomAllocator.
- ICustomAllocator* m_CustomAllocator{};
+ std::shared_ptr<ICustomAllocator> m_CustomAllocator{};
/// Value which the size of each buffer (actual data size + padding) has to be a multiple of.
size_t m_Alignment = 0 ;
};
@@ -19,16 +20,16 @@ struct TensorMemory
{
/// Number of bytes the value is away from the @BufferStorage.m_Buffer.
size_t m_Offset{};
- /// Pointer to the tensor value.
- void* m_Data = nullptr;
/// Identifier to be used by the @LoadedNetwork to order the tensors.
unsigned int m_OutputSlotId{};
+ /// Pointer to the tensor value.
+ void* m_Data = nullptr;
};
struct BufferStorage
{
/// Vector of pointer to @TensorMemory.
- std::vector<TensorMemory*> m_TensorMemoryVector;
+ std::vector<std::shared_ptr<TensorMemory>> m_TensorMemoryVector;
/// Total size of the buffer.
size_t m_BufferSize;
/// Pointer to the first element of the buffer.
@@ -43,7 +44,7 @@ public:
/// @param[in] customAllocator - Pointer to @ICustomAllocator.
/// @param[in] typeAlignment - Optional parameter. Value of which the size of each value has to be multiple of.
void StoreMemToAllocate(std::vector<BufferStorage> bufferStorageVector,
- ICustomAllocator* customAllocator,
+ std::shared_ptr<ICustomAllocator> customAllocator,
size_t typeAlignment = 0);
/// Allocate the amount of memory indicated by @m_BufferSize, and