aboutsummaryrefslogtreecommitdiff
path: root/22.02/_memory_manager_8hpp_source.xhtml
blob: c6fac48844ebd7327a397591c050aea8294cfa3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!-- Copyright (c) 2020 ARM Limited. -->
<!--                                 -->
<!-- SPDX-License-Identifier: MIT    -->
<!--                                 -->
<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ArmNN: src/backends/backendsCommon/MemoryManager.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 10rem; margin-top: .5rem; margin-left 10px"/>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">22.02</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_memory_manager_8hpp_source.xhtml','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">MemoryManager.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_memory_manager_8hpp.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_i_custom_allocator_8hpp.xhtml">armnn/backends/ICustomAllocator.hpp</a>&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacearmnn.xhtml">armnn</a></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;{</div><div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="structarmnn_1_1_allocator.xhtml">   11</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structarmnn_1_1_allocator.xhtml">Allocator</a></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;{<span class="comment"></span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">    /// Pointer to @ICustomAllocator.</span></div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="structarmnn_1_1_allocator.xhtml#a454dc02f777e9e66b9e798d4f4a647b5">   14</a></span>&#160;<span class="comment"></span>    std::shared_ptr&lt;ICustomAllocator&gt; <a class="code" href="structarmnn_1_1_allocator.xhtml#a454dc02f777e9e66b9e798d4f4a647b5">m_CustomAllocator</a>{};<span class="comment"></span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">    /// Value which the size of each buffer (actual data size + padding) has to be a multiple of.</span></div><div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="structarmnn_1_1_allocator.xhtml#a84b04a7eb9cb29c23dac4fe55eb1d78c">   16</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structarmnn_1_1_allocator.xhtml#a84b04a7eb9cb29c23dac4fe55eb1d78c">m_Alignment</a> = 0 ;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;};</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="structarmnn_1_1_tensor_memory.xhtml">   19</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structarmnn_1_1_tensor_memory.xhtml">TensorMemory</a></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;{<span class="comment"></span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">    /// Number of bytes the value is away from the @BufferStorage.m_Buffer.</span></div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="structarmnn_1_1_tensor_memory.xhtml#a7fa2df31ffac52484e0612a31fd4256d">   22</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> m_Offset{};<span class="comment"></span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">    /// Identifier to be used by the @LoadedNetwork to order the tensors.</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="structarmnn_1_1_tensor_memory.xhtml#a0948ebfd3dcfd15456e3306d13d69b95">   24</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_OutputSlotId{};<span class="comment"></span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">    /// Pointer to the tensor value.</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structarmnn_1_1_tensor_memory.xhtml#ad2b382076f26f48cd44783cfca2e3642">   26</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span>* m_Data = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;};</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structarmnn_1_1_buffer_storage.xhtml">   29</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structarmnn_1_1_buffer_storage.xhtml">BufferStorage</a></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;{<span class="comment"></span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">    /// Vector of pointer to @TensorMemory.</span></div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="structarmnn_1_1_buffer_storage.xhtml#a0d6a6b862d9630effce75d8ca18254ba">   32</a></span>&#160;<span class="comment"></span>    std::vector&lt;std::shared_ptr&lt;TensorMemory&gt;&gt; <a class="code" href="structarmnn_1_1_buffer_storage.xhtml#a0d6a6b862d9630effce75d8ca18254ba">m_TensorMemoryVector</a>;<span class="comment"></span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment">    /// Total size of the buffer.</span></div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structarmnn_1_1_buffer_storage.xhtml#afcd55b6ce066b6a3ddfcbbc1c483213f">   34</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structarmnn_1_1_buffer_storage.xhtml#afcd55b6ce066b6a3ddfcbbc1c483213f">m_BufferSize</a>;<span class="comment"></span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">    /// Pointer to the first element of the buffer.</span></div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="structarmnn_1_1_buffer_storage.xhtml#a9cf5acb7d9fb6392c16b6d642b869143">   36</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span>* m_Buffer = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;};</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classarmnn_1_1_memory_manager.xhtml">   39</a></span>&#160;<span class="keyword">class </span><a class="code" href="classarmnn_1_1_memory_manager.xhtml">MemoryManager</a></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;{</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">public</span>:<span class="comment"></span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">    /// Initialization method to store in @m_AllocatorBufferStoragePairVector all information needed.</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">    /// @param[in] bufferStorageVector - Vector of @BufferStorage.</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">    /// @param[in] customAllocator - Pointer to @ICustomAllocator.</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">    /// @param[in] typeAlignment - Optional parameter. Value of which the size of each value has to be multiple of.</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> StoreMemToAllocate(std::vector&lt;BufferStorage&gt; bufferStorageVector,</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;                            std::shared_ptr&lt;ICustomAllocator&gt; customAllocator,</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                            <span class="keywordtype">size_t</span> typeAlignment = 0);</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment">    /// Allocate the amount of memory indicated by @m_BufferSize, and</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">    /// point each @m_Data to each correspondent Tensor so that they are @m_Offset bytes separated.</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> Allocate();</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">    /// Deallocate memory</span></div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> Deallocate();</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    std::vector&lt;std::pair&lt;Allocator, std::vector&lt;BufferStorage&gt;&gt;&gt; m_AllocatorBufferStoragePairVector;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;};</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;} <span class="comment">// namespace armnn</span></div><div class="ttc" id="structarmnn_1_1_buffer_storage_xhtml_a0d6a6b862d9630effce75d8ca18254ba"><div class="ttname"><a href="structarmnn_1_1_buffer_storage.xhtml#a0d6a6b862d9630effce75d8ca18254ba">armnn::BufferStorage::m_TensorMemoryVector</a></div><div class="ttdeci">std::vector&lt; std::shared_ptr&lt; TensorMemory &gt; &gt; m_TensorMemoryVector</div><div class="ttdoc">Vector of pointer to . </div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00032">MemoryManager.hpp:32</a></div></div>
<div class="ttc" id="classarmnn_1_1_memory_manager_xhtml"><div class="ttname"><a href="classarmnn_1_1_memory_manager.xhtml">armnn::MemoryManager</a></div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00039">MemoryManager.hpp:39</a></div></div>
<div class="ttc" id="structarmnn_1_1_tensor_memory_xhtml"><div class="ttname"><a href="structarmnn_1_1_tensor_memory.xhtml">armnn::TensorMemory</a></div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00019">MemoryManager.hpp:19</a></div></div>
<div class="ttc" id="structarmnn_1_1_buffer_storage_xhtml_afcd55b6ce066b6a3ddfcbbc1c483213f"><div class="ttname"><a href="structarmnn_1_1_buffer_storage.xhtml#afcd55b6ce066b6a3ddfcbbc1c483213f">armnn::BufferStorage::m_BufferSize</a></div><div class="ttdeci">size_t m_BufferSize</div><div class="ttdoc">Total size of the buffer. </div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00034">MemoryManager.hpp:34</a></div></div>
<div class="ttc" id="structarmnn_1_1_allocator_xhtml_a84b04a7eb9cb29c23dac4fe55eb1d78c"><div class="ttname"><a href="structarmnn_1_1_allocator.xhtml#a84b04a7eb9cb29c23dac4fe55eb1d78c">armnn::Allocator::m_Alignment</a></div><div class="ttdeci">size_t m_Alignment</div><div class="ttdoc">Value which the size of each buffer (actual data size + padding) has to be a multiple of...</div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00016">MemoryManager.hpp:16</a></div></div>
<div class="ttc" id="namespacearmnn_xhtml"><div class="ttname"><a href="namespacearmnn.xhtml">armnn</a></div><div class="ttdoc">Copyright (c) 2021 ARM Limited and Contributors. </div><div class="ttdef"><b>Definition:</b> <a href="01__00__quick__start_8dox_source.xhtml#l00006">01_00_quick_start.dox:6</a></div></div>
<div class="ttc" id="structarmnn_1_1_allocator_xhtml_a454dc02f777e9e66b9e798d4f4a647b5"><div class="ttname"><a href="structarmnn_1_1_allocator.xhtml#a454dc02f777e9e66b9e798d4f4a647b5">armnn::Allocator::m_CustomAllocator</a></div><div class="ttdeci">std::shared_ptr&lt; ICustomAllocator &gt; m_CustomAllocator</div><div class="ttdoc">Pointer to . </div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00014">MemoryManager.hpp:14</a></div></div>
<div class="ttc" id="_i_custom_allocator_8hpp_xhtml"><div class="ttname"><a href="_i_custom_allocator_8hpp.xhtml">ICustomAllocator.hpp</a></div></div>
<div class="ttc" id="structarmnn_1_1_allocator_xhtml"><div class="ttname"><a href="structarmnn_1_1_allocator.xhtml">armnn::Allocator</a></div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00011">MemoryManager.hpp:11</a></div></div>
<div class="ttc" id="structarmnn_1_1_buffer_storage_xhtml"><div class="ttname"><a href="structarmnn_1_1_buffer_storage.xhtml">armnn::BufferStorage</a></div><div class="ttdef"><b>Definition:</b> <a href="_memory_manager_8hpp_source.xhtml#l00029">MemoryManager.hpp:29</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_0f3cdec46afbc61a1ded8e1687c9c9a0.xhtml">backends</a></li><li class="navelem"><a class="el" href="dir_797a213d7d01b98ef12d53b0820ea64e.xhtml">backendsCommon</a></li><li class="navelem"><a class="el" href="_memory_manager_8hpp.xhtml">MemoryManager.hpp</a></li>
    <li class="footer">Generated on Wed Mar 9 2022 12:00:56 for ArmNN by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>