From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- 21.02/_ref_memory_manager_8cpp_source.xhtml | 133 ++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 21.02/_ref_memory_manager_8cpp_source.xhtml (limited to '21.02/_ref_memory_manager_8cpp_source.xhtml') diff --git a/21.02/_ref_memory_manager_8cpp_source.xhtml b/21.02/_ref_memory_manager_8cpp_source.xhtml new file mode 100644 index 0000000000..9b63e16b9a --- /dev/null +++ b/21.02/_ref_memory_manager_8cpp_source.xhtml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + +ArmNN: src/backends/reference/RefMemoryManager.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
RefMemoryManager.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "RefMemoryManager.hpp"
6 
8 
9 #include <algorithm>
10 
11 namespace armnn
12 {
13 
15 {}
16 
18 {}
19 
21 {
22  if (!m_FreePools.empty())
23  {
24  Pool* res = m_FreePools.back();
25  m_FreePools.pop_back();
26  res->Reserve(numBytes);
27  return res;
28  }
29  else
30  {
31  m_Pools.push_front(Pool(numBytes));
32  return &m_Pools.front();
33  }
34 }
35 
37 {
38  ARMNN_ASSERT(pool);
39  m_FreePools.push_back(pool);
40 }
41 
43 {
44  return pool->GetPointer();
45 }
46 
48 {
49  for (Pool &pool: m_Pools)
50  {
51  pool.Acquire();
52  }
53 }
54 
56 {
57  for (Pool &pool: m_Pools)
58  {
59  pool.Release();
60  }
61 }
62 
63 RefMemoryManager::Pool::Pool(unsigned int numBytes)
64  : m_Size(numBytes),
65  m_Pointer(nullptr)
66 {}
67 
69 {
70  if (m_Pointer)
71  {
72  Release();
73  }
74 }
75 
77 {
78  ARMNN_ASSERT_MSG(m_Pointer, "RefMemoryManager::Pool::GetPointer() called when memory not acquired");
79  return m_Pointer;
80 }
81 
82 void RefMemoryManager::Pool::Reserve(unsigned int numBytes)
83 {
84  ARMNN_ASSERT_MSG(!m_Pointer, "RefMemoryManager::Pool::Reserve() cannot be called after memory acquired");
85  m_Size = std::max(m_Size, numBytes);
86 }
87 
89 {
90  ARMNN_ASSERT_MSG(!m_Pointer, "RefMemoryManager::Pool::Acquire() called when memory already acquired");
91  m_Pointer = ::operator new(size_t(m_Size));
92 }
93 
95 {
96  ARMNN_ASSERT_MSG(m_Pointer, "RefMemoryManager::Pool::Release() called when memory not acquired");
97  ::operator delete(m_Pointer);
98  m_Pointer = nullptr;
99 }
100 
101 }
+
RefMemoryManager::Pool Pool
+ +
Copyright (c) 2021 ARM Limited and Contributors.
+ + + +
Pool * Manage(unsigned int numBytes)
+ +
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
+
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+ + +
void Reserve(unsigned int numBytes)
+ + +
Pool(unsigned int numBytes)
+ + +
void * GetPointer(Pool *pool)
+
+
+ + + + -- cgit v1.2.1