diff options
author | David Monahan <david.monahan@arm.com> | 2023-03-22 16:48:58 +0000 |
---|---|---|
committer | David Monahan <david.monahan@arm.com> | 2023-03-22 16:48:58 +0000 |
commit | ae050524109f1ce827962665436ef7430f2ac479 (patch) | |
tree | a087fe0c77570971dd7979f2757426c24e91afc7 /latest/_cl_context_control_8cpp_source.xhtml | |
parent | 8d2ca734165a068478df7cffa46185680b05cd20 (diff) | |
download | armnn-ae050524109f1ce827962665436ef7430f2ac479.tar.gz |
IVGCVSW-7255 Update Doxygen Documentation and publish on GitHub.
* Updating Doxygen documentation for 23.02 release.
Signed-off-by: David Monahan <david.monahan@arm.com>
Change-Id: I545574ff7664b4595d2fe6a91a3c35d2ad55df82
Diffstat (limited to 'latest/_cl_context_control_8cpp_source.xhtml')
-rw-r--r-- | latest/_cl_context_control_8cpp_source.xhtml | 300 |
1 files changed, 300 insertions, 0 deletions
diff --git a/latest/_cl_context_control_8cpp_source.xhtml b/latest/_cl_context_control_8cpp_source.xhtml new file mode 100644 index 0000000000..cc0df8cdd8 --- /dev/null +++ b/latest/_cl_context_control_8cpp_source.xhtml @@ -0,0 +1,300 @@ +<!-- 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.17"/> +<meta name="robots" content="NOINDEX, NOFOLLOW" /> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>ArmNN: src/backends/cl/ClContextControl.cpp 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> +<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" async="async" 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"> +  <span id="projectnumber">23.02</span> + </div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.17 --> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +/* @license-end */ +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +/* @license-end */</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"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(document).ready(function(){initNavTree('_cl_context_control_8cpp_source.xhtml',''); initResizable(); }); +/* @license-end */ +</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">ClContextControl.cpp</div> </div> +</div><!--header--> +<div class="contents"> +<a href="_cl_context_control_8cpp.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//</span></div> +<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright © 2017, 2023 Arm Ltd and Contributors. All rights reserved.</span></div> +<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// SPDX-License-Identifier: MIT</span></div> +<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div> +<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>  </div> +<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "<a class="code" href="_cl_context_control_8hpp.xhtml">ClContextControl.hpp</a>"</span></div> +<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  </div> +<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <<a class="code" href="_exceptions_8hpp.xhtml">armnn/Exceptions.hpp</a>></span></div> +<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>  </div> +<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <<a class="code" href="_leak_checking_8hpp.xhtml">LeakChecking.hpp</a>></span></div> +<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  </div> +<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include <<a class="code" href="_assert_8hpp.xhtml">armnn/utility/Assert.hpp</a>></span></div> +<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <<a class="code" href="_ignore_unused_8hpp.xhtml">armnn/utility/IgnoreUnused.hpp</a>></span></div> +<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  </div> +<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <arm_compute/core/CL/CLKernelLibrary.h></span></div> +<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <arm_compute/runtime/CL/CLScheduler.h></span></div> +<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  </div> +<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <fmt/format.h></span></div> +<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  </div> +<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="keyword">namespace </span>cl</div> +<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> {</div> +<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">class </span>Context;</div> +<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">class </span>CommandQueue;</div> +<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">class </span>Device;</div> +<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> }</div> +<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  </div> +<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="keyword">namespace </span><a class="code" href="namespacearmnn.xhtml">armnn</a></div> +<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> {</div> +<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  </div> +<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classarmnn_1_1_cl_context_control.xhtml#a743aa7675f0efe29e0d3b9ec9971fc7c"> 30</a></span> <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a743aa7675f0efe29e0d3b9ec9971fc7c">ClContextControl::ClContextControl</a>(arm_compute::CLTuner *tuner,</div> +<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  arm_compute::CLGEMMHeuristicsHandle* heuristicsHandle,</div> +<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keywordtype">bool</span> profilingEnabled)</div> +<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  : m_Tuner(tuner)</div> +<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  , m_HeuristicsHandle(heuristicsHandle)</div> +<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  , m_ProfilingEnabled(profilingEnabled)</div> +<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> {</div> +<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="comment">// Ignore m_ProfilingEnabled if unused to avoid compiling problems when ArmCompute is disabled.</span></div> +<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="code" href="namespacearmnn.xhtml#a44affeeb090c3c6a3062830562672e84">IgnoreUnused</a>(m_ProfilingEnabled);</div> +<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  </div> +<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">try</span></div> +<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  {</div> +<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  std::vector<cl::Platform> platforms;</div> +<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  cl::Platform::get(&platforms);</div> +<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  </div> +<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="comment">// Selects default platform for the first element.</span></div> +<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  cl::Platform::setDefault(platforms[0]);</div> +<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  </div> +<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  std::vector<cl::Device> devices;</div> +<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  platforms[0].getDevices(CL_DEVICE_TYPE_GPU, &devices);</div> +<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  </div> +<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="comment">// Selects default device for the first element.</span></div> +<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  cl::Device::setDefault(devices[0]);</div> +<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  }</div> +<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> cl::Error& clError)</div> +<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  {</div> +<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_cl_runtime_unavailable_exception.xhtml">ClRuntimeUnavailableException</a>(fmt::format(</div> +<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="stringliteral">"Could not initialize the CL runtime. Error description: {0}. CL error code: {1}"</span>,</div> +<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  clError.what(), clError.err()));</div> +<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  }</div> +<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  </div> +<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="comment">// Removes the use of global CL context.</span></div> +<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  cl::Context::setDefault(cl::Context{});</div> +<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <a class="code" href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a>(cl::Context::getDefault()() == NULL);</div> +<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  </div> +<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Removes the use of global CL command queue.</span></div> +<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  cl::CommandQueue::setDefault(cl::CommandQueue{});</div> +<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a>(cl::CommandQueue::getDefault()() == NULL);</div> +<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  </div> +<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="comment">// Always load the OpenCL runtime.</span></div> +<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a80ef362b80b514620da9fd8f6a3ba518">LoadOpenClRuntime</a>();</div> +<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> }</div> +<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  </div> +<div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="classarmnn_1_1_cl_context_control.xhtml#a9d4f5387dafdafbb86aac00586c58a79"> 73</a></span> <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a9d4f5387dafdafbb86aac00586c58a79">ClContextControl::~ClContextControl</a>()</div> +<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> {</div> +<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="comment">// Load the OpencCL runtime without the tuned parameters to free the memory for them.</span></div> +<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">try</span></div> +<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  {</div> +<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a48f639543a69fe342fec2021b9dfd1d4">UnloadOpenClRuntime</a>();</div> +<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div> +<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> cl::Error& clError)</div> +<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  {</div> +<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="comment">// This should not happen, it is ignored if it does.</span></div> +<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  </div> +<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="comment">// Coverity fix: BOOST_LOG_TRIVIAL (previously used here to report the error) may throw an</span></div> +<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="comment">// exception of type std::length_error.</span></div> +<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="comment">// Using stderr instead in this context as there is no point in nesting try-catch blocks here.</span></div> +<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  std::cerr << <span class="stringliteral">"A CL error occurred unloading the runtime tuner parameters: "</span></div> +<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  << clError.what() << <span class="stringliteral">". CL error code is: "</span> << clError.err() << std::endl;</div> +<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  }</div> +<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> }</div> +<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  </div> +<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="classarmnn_1_1_cl_context_control.xhtml#a80ef362b80b514620da9fd8f6a3ba518"> 92</a></span> <span class="keywordtype">void</span> <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a80ef362b80b514620da9fd8f6a3ba518">ClContextControl::LoadOpenClRuntime</a>()</div> +<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> {</div> +<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  DoLoadOpenClRuntime(<span class="keyword">true</span>);</div> +<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> }</div> +<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  </div> +<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classarmnn_1_1_cl_context_control.xhtml#a48f639543a69fe342fec2021b9dfd1d4"> 97</a></span> <span class="keywordtype">void</span> <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a48f639543a69fe342fec2021b9dfd1d4">ClContextControl::UnloadOpenClRuntime</a>()</div> +<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> {</div> +<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  DoLoadOpenClRuntime(<span class="keyword">false</span>);</div> +<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> }</div> +<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  </div> +<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="keywordtype">void</span> ClContextControl::DoLoadOpenClRuntime(<span class="keywordtype">bool</span> updateTunedParameters)</div> +<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> {</div> +<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  cl::Device device = cl::Device::getDefault();</div> +<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  cl::Context context;</div> +<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  cl::CommandQueue commandQueue;</div> +<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  </div> +<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">if</span> (arm_compute::CLScheduler::get().is_initialised() && arm_compute::CLScheduler::get().context()() != NULL)</div> +<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  {</div> +<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="comment">// Wait for all queued CL requests to finish before reinitialising it.</span></div> +<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  arm_compute::CLScheduler::get().sync();</div> +<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  }</div> +<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  </div> +<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordflow">try</span></div> +<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  {</div> +<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  arm_compute::CLKernelLibrary::get().clear_programs_cache();</div> +<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="comment">// Initialise the scheduler with a dummy context to release the LLVM data (which only happens when there are no</span></div> +<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="comment">// context references); it is initialised again, with a proper context, later.</span></div> +<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  arm_compute::CLScheduler::get().init(context, commandQueue, device);</div> +<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  arm_compute::CLKernelLibrary::get().init(<span class="stringliteral">"."</span>, context, device);</div> +<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  </div> +<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  {</div> +<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="comment">//</span></div> +<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="comment">// Here we replace the context with a new one in which</span></div> +<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="comment">// the memory leak checks show it as an extra allocation but</span></div> +<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">// because of the scope of the leak checks, it doesn't count</span></div> +<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">// the disposal of the original object. On the other hand it</span></div> +<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="comment">// does count the creation of this context which it flags</span></div> +<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="comment">// as a memory leak. By adding the following line we prevent</span></div> +<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="comment">// this to happen.</span></div> +<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="comment">//</span></div> +<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <a class="code" href="_leak_checking_8hpp.xhtml#a9aaa2dcae10ed75233b511c29bccc086">ARMNN_DISABLE_LEAK_CHECKING_IN_SCOPE</a>();</div> +<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  context = cl::Context(device);</div> +<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  }</div> +<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  </div> +<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="comment">// NOTE: In this specific case profiling has to be enabled on the command queue</span></div> +<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="comment">// in order for the CLTuner to work.</span></div> +<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordtype">bool</span> profilingNeededForClTuner = updateTunedParameters && m_Tuner &&</div> +<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  m_Tuner->tune_new_kernels();</div> +<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  </div> +<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordflow">if</span> (m_ProfilingEnabled || profilingNeededForClTuner)</div> +<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  {</div> +<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="comment">// Create a new queue with profiling enabled.</span></div> +<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  commandQueue = cl::CommandQueue(context, device, CL_QUEUE_PROFILING_ENABLE);</div> +<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  }</div> +<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keywordflow">else</span></div> +<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  {</div> +<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="comment">// Use default queue.</span></div> +<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  commandQueue = cl::CommandQueue(context, device);</div> +<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  }</div> +<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  }</div> +<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> cl::Error& clError)</div> +<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  {</div> +<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordflow">throw</span> ClRuntimeUnavailableException(fmt::format(</div> +<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="stringliteral">"Could not initialize the CL runtime. Error description: {0}. CL error code: {1}"</span>,</div> +<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  clError.what(), clError.err()));</div> +<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  }</div> +<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  </div> +<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="comment">// Note the first argument (path to cl source code) will be ignored as they should be embedded in the armcompute.</span></div> +<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  arm_compute::CLKernelLibrary::get().init(<span class="stringliteral">"."</span>, context, device);</div> +<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  arm_compute::CLScheduler::get().init(context, commandQueue, device, m_Tuner, m_HeuristicsHandle);</div> +<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> }</div> +<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  </div> +<div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="classarmnn_1_1_cl_context_control.xhtml#a8f6d5a750a23d418fee0210de4e85c13"> 164</a></span> <span class="keywordtype">void</span> <a class="code" href="classarmnn_1_1_cl_context_control.xhtml#a8f6d5a750a23d418fee0210de4e85c13">ClContextControl::ClearClCache</a>()</div> +<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> {</div> +<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  DoLoadOpenClRuntime(<span class="keyword">true</span>);</div> +<div class="line"><a name="l00167"></a><span class="lineno"> 167</span> }</div> +<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  </div> +<div class="line"><a name="l00169"></a><span class="lineno"> 169</span> } <span class="comment">// namespace armnn</span></div> +</div><!-- fragment --></div><!-- contents --> +</div><!-- doc-content --> +<div class="ttc" id="aclassarmnn_1_1_cl_context_control_xhtml_a743aa7675f0efe29e0d3b9ec9971fc7c"><div class="ttname"><a href="classarmnn_1_1_cl_context_control.xhtml#a743aa7675f0efe29e0d3b9ec9971fc7c">armnn::ClContextControl::ClContextControl</a></div><div class="ttdeci">ClContextControl(arm_compute::CLTuner *=nullptr, arm_compute::CLGEMMHeuristicsHandle *=nullptr, bool profilingEnabled=false)</div><div class="ttdef"><b>Definition:</b> <a href="_cl_context_control_8cpp_source.xhtml#l00030">ClContextControl.cpp:30</a></div></div> +<div class="ttc" id="anamespacearmnn_xhtml_a44affeeb090c3c6a3062830562672e84"><div class="ttname"><a href="namespacearmnn.xhtml#a44affeeb090c3c6a3062830562672e84">armnn::IgnoreUnused</a></div><div class="ttdeci">void IgnoreUnused(Ts &&...)</div><div class="ttdef"><b>Definition:</b> <a href="_ignore_unused_8hpp_source.xhtml#l00014">IgnoreUnused.hpp:14</a></div></div> +<div class="ttc" id="a_assert_8hpp_xhtml"><div class="ttname"><a href="_assert_8hpp.xhtml">Assert.hpp</a></div></div> +<div class="ttc" id="anamespacearmnn_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="aclassarmnn_1_1_cl_runtime_unavailable_exception_xhtml"><div class="ttname"><a href="classarmnn_1_1_cl_runtime_unavailable_exception.xhtml">armnn::ClRuntimeUnavailableException</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.xhtml#l00074">Exceptions.hpp:74</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_cl_context_control_xhtml_a8f6d5a750a23d418fee0210de4e85c13"><div class="ttname"><a href="classarmnn_1_1_cl_context_control.xhtml#a8f6d5a750a23d418fee0210de4e85c13">armnn::ClContextControl::ClearClCache</a></div><div class="ttdeci">void ClearClCache()</div><div class="ttdef"><b>Definition:</b> <a href="_cl_context_control_8cpp_source.xhtml#l00164">ClContextControl.cpp:164</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_cl_context_control_xhtml_a9d4f5387dafdafbb86aac00586c58a79"><div class="ttname"><a href="classarmnn_1_1_cl_context_control.xhtml#a9d4f5387dafdafbb86aac00586c58a79">armnn::ClContextControl::~ClContextControl</a></div><div class="ttdeci">virtual ~ClContextControl()</div><div class="ttdef"><b>Definition:</b> <a href="_cl_context_control_8cpp_source.xhtml#l00073">ClContextControl.cpp:73</a></div></div> +<div class="ttc" id="a_leak_checking_8hpp_xhtml"><div class="ttname"><a href="_leak_checking_8hpp.xhtml">LeakChecking.hpp</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_cl_context_control_xhtml_a48f639543a69fe342fec2021b9dfd1d4"><div class="ttname"><a href="classarmnn_1_1_cl_context_control.xhtml#a48f639543a69fe342fec2021b9dfd1d4">armnn::ClContextControl::UnloadOpenClRuntime</a></div><div class="ttdeci">void UnloadOpenClRuntime()</div><div class="ttdef"><b>Definition:</b> <a href="_cl_context_control_8cpp_source.xhtml#l00097">ClContextControl.cpp:97</a></div></div> +<div class="ttc" id="a_cl_context_control_8hpp_xhtml"><div class="ttname"><a href="_cl_context_control_8hpp.xhtml">ClContextControl.hpp</a></div></div> +<div class="ttc" id="a_assert_8hpp_xhtml_a5698be69cbd5dfe6c28fcd9867e8cbed"><div class="ttname"><a href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a></div><div class="ttdeci">#define ARMNN_ASSERT(COND)</div><div class="ttdef"><b>Definition:</b> <a href="_assert_8hpp_source.xhtml#l00014">Assert.hpp:14</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_cl_context_control_xhtml_a80ef362b80b514620da9fd8f6a3ba518"><div class="ttname"><a href="classarmnn_1_1_cl_context_control.xhtml#a80ef362b80b514620da9fd8f6a3ba518">armnn::ClContextControl::LoadOpenClRuntime</a></div><div class="ttdeci">void LoadOpenClRuntime()</div><div class="ttdef"><b>Definition:</b> <a href="_cl_context_control_8cpp_source.xhtml#l00092">ClContextControl.cpp:92</a></div></div> +<div class="ttc" id="a_exceptions_8hpp_xhtml"><div class="ttname"><a href="_exceptions_8hpp.xhtml">Exceptions.hpp</a></div></div> +<div class="ttc" id="a_ignore_unused_8hpp_xhtml"><div class="ttname"><a href="_ignore_unused_8hpp.xhtml">IgnoreUnused.hpp</a></div></div> +<div class="ttc" id="a_leak_checking_8hpp_xhtml_a9aaa2dcae10ed75233b511c29bccc086"><div class="ttname"><a href="_leak_checking_8hpp.xhtml#a9aaa2dcae10ed75233b511c29bccc086">ARMNN_DISABLE_LEAK_CHECKING_IN_SCOPE</a></div><div class="ttdeci">#define ARMNN_DISABLE_LEAK_CHECKING_IN_SCOPE()</div><div class="ttdef"><b>Definition:</b> <a href="_leak_checking_8hpp_source.xhtml#l00093">LeakChecking.hpp:93</a></div></div> +<!-- 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_1ad86c6d39ab715a831555571b9e98a5.xhtml">cl</a></li><li class="navelem"><a class="el" href="_cl_context_control_8cpp.xhtml">ClContextControl.cpp</a></li> + <li class="footer">Generated on Wed Mar 22 2023 15:53:01 for ArmNN by + <a href="http://www.doxygen.org/index.html"> + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li> + </ul> +</div> +</body> +</html> |