blob: 8c952f60ca4b2f991ce47482d9e0b6a5aea95f47 [file] [log] [blame]
Anthony Barbier871448e2017-03-24 14:54:29 +00001<!-- HTML header for doxygen 1.8.9.1-->
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6<meta http-equiv="X-UA-Compatible" content="IE=9"/>
Kaizen8938bd32017-09-28 14:38:23 +01007<meta name="generator" content="Doxygen 1.8.6"/>
Anthony Barbier871448e2017-03-24 14:54:29 +00008<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
Anthony Barbierdbdab852017-06-23 15:42:00 +01009<title>Compute Library: src/core/CL/cl_kernels/convolution_layer.cl File Reference</title>
Anthony Barbier871448e2017-03-24 14:54:29 +000010<link href="tabs.css" rel="stylesheet" type="text/css"/>
11<script type="text/javascript" src="jquery.js"></script>
12<script type="text/javascript" src="dynsections.js"></script>
13<link href="navtree.css" rel="stylesheet" type="text/css"/>
14<script type="text/javascript" src="resize.js"></script>
Anthony Barbier871448e2017-03-24 14:54:29 +000015<script type="text/javascript" src="navtree.js"></script>
16<script type="text/javascript">
17 $(document).ready(initResizable);
18 $(window).load(resizeHeight);
19</script>
20<link href="search/search.css" rel="stylesheet" type="text/css"/>
Anthony Barbier871448e2017-03-24 14:54:29 +000021<script type="text/javascript" src="search/search.js"></script>
22<script type="text/javascript">
Kaizen8938bd32017-09-28 14:38:23 +010023 $(document).ready(function() { searchBox.OnSelectItem(0); });
Anthony Barbier871448e2017-03-24 14:54:29 +000024</script>
25<script type="text/x-mathjax-config">
26 MathJax.Hub.Config({
27 extensions: ["tex2jax.js"],
28 jax: ["input/TeX","output/HTML-CSS"],
29});
Kaizen8938bd32017-09-28 14:38:23 +010030</script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
Anthony Barbier871448e2017-03-24 14:54:29 +000031<link href="doxygen.css" rel="stylesheet" type="text/css" />
32</head>
33<body>
34<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
35<div id="titlearea">
36<table cellspacing="0" cellpadding="0">
37 <tbody>
38 <tr style="height: 56px;">
39 <td style="padding-left: 0.5em;">
Anthony Barbierdbdab852017-06-23 15:42:00 +010040 <div id="projectname">Compute Library
Kaizenbf8b01d2017-10-12 14:26:51 +010041 &#160;<span id="projectnumber">17.10</span>
Anthony Barbier871448e2017-03-24 14:54:29 +000042 </div>
43 </td>
44 </tr>
45 </tbody>
46</table>
47</div>
48<!-- end header part -->
Kaizen8938bd32017-09-28 14:38:23 +010049<!-- Generated by Doxygen 1.8.6 -->
Anthony Barbier871448e2017-03-24 14:54:29 +000050<script type="text/javascript">
51var searchBox = new SearchBox("searchBox", "search",false,'Search');
52</script>
53 <div id="navrow1" class="tabs">
54 <ul class="tablist">
55 <li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
Anthony Barbierdbdab852017-06-23 15:42:00 +010056 <li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
Anthony Barbier871448e2017-03-24 14:54:29 +000057 <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
58 <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
59 <li class="current"><a href="files.xhtml"><span>Files</span></a></li>
60 <li>
61 <div id="MSearchBox" class="MSearchBoxInactive">
62 <span class="left">
63 <img id="MSearchSelect" src="search/mag_sel.png"
64 onmouseover="return searchBox.OnSearchSelectShow()"
65 onmouseout="return searchBox.OnSearchSelectHide()"
66 alt=""/>
67 <input type="text" id="MSearchField" value="Search" accesskey="S"
68 onfocus="searchBox.OnSearchFieldFocus(true)"
69 onblur="searchBox.OnSearchFieldFocus(false)"
70 onkeyup="searchBox.OnSearchFieldChange(event)"/>
71 </span><span class="right">
72 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
73 </span>
74 </div>
75 </li>
76 </ul>
77 </div>
78 <div id="navrow2" class="tabs2">
79 <ul class="tablist">
80 <li><a href="files.xhtml"><span>File&#160;List</span></a></li>
81 <li><a href="globals.xhtml"><span>Globals</span></a></li>
82 </ul>
83 </div>
84</div><!-- top -->
85<div id="side-nav" class="ui-resizable side-nav-resizable">
86 <div id="nav-tree">
87 <div id="nav-tree-contents">
88 <div id="nav-sync" class="sync"></div>
89 </div>
90 </div>
91 <div id="splitbar" style="-moz-user-select:none;"
92 class="ui-resizable-handle">
93 </div>
94</div>
95<script type="text/javascript">
96$(document).ready(function(){initNavTree('convolution__layer_8cl.xhtml','');});
97</script>
98<div id="doc-content">
99<!-- window showing the filter options -->
100<div id="MSearchSelectWindow"
101 onmouseover="return searchBox.OnSearchSelectShow()"
102 onmouseout="return searchBox.OnSearchSelectHide()"
103 onkeydown="return searchBox.OnSearchSelectKey(event)">
Kaizen8938bd32017-09-28 14:38:23 +0100104<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark">&#160;</span>Pages</a></div>
Anthony Barbier871448e2017-03-24 14:54:29 +0000105
106<!-- iframe showing the search results (closed by default) -->
107<div id="MSearchResultsWindow">
108<iframe src="javascript:void(0)" frameborder="0"
109 name="MSearchResults" id="MSearchResults">
110</iframe>
111</div>
112
113<div class="header">
114 <div class="summary">
115<a href="#func-members">Functions</a> </div>
116 <div class="headertitle">
117<div class="title">convolution_layer.cl File Reference</div> </div>
118</div><!--header-->
119<div class="contents">
Kaizen8938bd32017-09-28 14:38:23 +0100120<div class="textblock"><code>#include &quot;<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>&quot;</code><br/>
Anthony Barbier871448e2017-03-24 14:54:29 +0000121</div>
122<p><a href="convolution__layer_8cl_source.xhtml">Go to the source code of this file.</a></p>
123<table class="memberdecls">
124<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
125Functions</h2></td></tr>
Anthony Barbierdbdab852017-06-23 15:42:00 +0100126<tr class="memitem:ab6358b28d1e7bc946950075d94412013"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#ab6358b28d1e7bc946950075d94412013">reshape_to_columns</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_stride_z, uint src_step_z, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes, __global uchar *bias_ptr, uint bias_stride_x, uint bias_step_x, uint bias_offset_first_element_in_bytes, uint width, uint height, uint depth, uint total_filters)</td></tr>
Kaizen8938bd32017-09-28 14:38:23 +0100127<tr class="memdesc:ab6358b28d1e7bc946950075d94412013"><td class="mdescLeft">&#160;</td><td class="mdescRight">This kernel reshapes the tensor's low three dimensions to single column. <a href="#ab6358b28d1e7bc946950075d94412013">More...</a><br/></td></tr>
Anthony Barbierdbdab852017-06-23 15:42:00 +0100128<tr class="separator:ab6358b28d1e7bc946950075d94412013"><td class="memSeparator" colspan="2">&#160;</td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000129<tr class="memitem:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="convolution__layer_8cl.xhtml#a6f31f2c8d606e1b57d9bdfacd416024c">im2col_reduced</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_stride_z, uint src_step_z, uint src_offset_first_element_in_bytes, __global uchar *dst_ptr, uint dst_stride_x, uint dst_step_x, uint dst_offset_first_element_in_bytes, uint width, uint height)</td></tr>
Kaizen8938bd32017-09-28 14:38:23 +0100130<tr class="memdesc:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This kernel reshapes the tensor's low three dimensions to single row for GEMM operation. <a href="#a6f31f2c8d606e1b57d9bdfacd416024c">More...</a><br/></td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000131<tr class="separator:a6f31f2c8d606e1b57d9bdfacd416024c"><td class="memSeparator" colspan="2">&#160;</td></tr>
132</table>
133<h2 class="groupheader">Function Documentation</h2>
Anthony Barbier871448e2017-03-24 14:54:29 +0000134<a class="anchor" id="a6f31f2c8d606e1b57d9bdfacd416024c"></a>
135<div class="memitem">
136<div class="memproto">
137 <table class="memname">
138 <tr>
139 <td class="memname">__kernel void im2col_reduced </td>
140 <td>(</td>
141 <td class="paramtype">__global uchar *&#160;</td>
142 <td class="paramname"><em>src_ptr</em>, </td>
143 </tr>
144 <tr>
145 <td class="paramkey"></td>
146 <td></td>
147 <td class="paramtype">uint&#160;</td>
148 <td class="paramname"><em>src_stride_x</em>, </td>
149 </tr>
150 <tr>
151 <td class="paramkey"></td>
152 <td></td>
153 <td class="paramtype">uint&#160;</td>
154 <td class="paramname"><em>src_step_x</em>, </td>
155 </tr>
156 <tr>
157 <td class="paramkey"></td>
158 <td></td>
159 <td class="paramtype">uint&#160;</td>
160 <td class="paramname"><em>src_stride_y</em>, </td>
161 </tr>
162 <tr>
163 <td class="paramkey"></td>
164 <td></td>
165 <td class="paramtype">uint&#160;</td>
166 <td class="paramname"><em>src_step_y</em>, </td>
167 </tr>
168 <tr>
169 <td class="paramkey"></td>
170 <td></td>
171 <td class="paramtype">uint&#160;</td>
172 <td class="paramname"><em>src_stride_z</em>, </td>
173 </tr>
174 <tr>
175 <td class="paramkey"></td>
176 <td></td>
177 <td class="paramtype">uint&#160;</td>
178 <td class="paramname"><em>src_step_z</em>, </td>
179 </tr>
180 <tr>
181 <td class="paramkey"></td>
182 <td></td>
183 <td class="paramtype">uint&#160;</td>
184 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
185 </tr>
186 <tr>
187 <td class="paramkey"></td>
188 <td></td>
189 <td class="paramtype">__global uchar *&#160;</td>
190 <td class="paramname"><em>dst_ptr</em>, </td>
191 </tr>
192 <tr>
193 <td class="paramkey"></td>
194 <td></td>
195 <td class="paramtype">uint&#160;</td>
196 <td class="paramname"><em>dst_stride_x</em>, </td>
197 </tr>
198 <tr>
199 <td class="paramkey"></td>
200 <td></td>
201 <td class="paramtype">uint&#160;</td>
202 <td class="paramname"><em>dst_step_x</em>, </td>
203 </tr>
204 <tr>
205 <td class="paramkey"></td>
206 <td></td>
207 <td class="paramtype">uint&#160;</td>
208 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
209 </tr>
210 <tr>
211 <td class="paramkey"></td>
212 <td></td>
213 <td class="paramtype">uint&#160;</td>
214 <td class="paramname"><em>width</em>, </td>
215 </tr>
216 <tr>
217 <td class="paramkey"></td>
218 <td></td>
219 <td class="paramtype">uint&#160;</td>
220 <td class="paramname"><em>height</em>&#160;</td>
221 </tr>
222 <tr>
223 <td></td>
224 <td>)</td>
225 <td></td><td></td>
226 </tr>
227 </table>
228</div><div class="memdoc">
229
230<p>This kernel reshapes the tensor's low three dimensions to single row for GEMM operation. </p>
231<dl class="section note"><dt>Note</dt><dd>Datatype should be given as a preprocessor argument using -DDATA_TYPE=type. e.g. -DDATA_TYPE=float </dd>
232<dd>
233In case biases will be added in late stage, -DHAS_BIAS has to be passed to append the final matrix with 1 in each row.</dd></dl>
234<dl class="params"><dt>Parameters</dt><dd>
235 <table class="params">
Kaizen8938bd32017-09-28 14:38:23 +0100236 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: QS8/F16/F32 </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000237 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
238 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
239 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source tensor in Y dimension (in bytes) </td></tr>
240 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
241 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
242 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_z</td><td>src_stride_z * number of elements along Y processed per workitem(in bytes) </td></tr>
243 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
Kaizen8938bd32017-09-28 14:38:23 +0100244 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Same as <code>src_ptr</code> </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000245 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
246 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
247 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
248 <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the input tensor </td></tr>
249 <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the input tensor </td></tr>
250 </table>
251 </dd>
252</dl>
253
Kaizen8938bd32017-09-28 14:38:23 +0100254<p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00309">309</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p>
Anthony Barbier871448e2017-03-24 14:54:29 +0000255
Kaizenbf8b01d2017-10-12 14:26:51 +0100256<p>References <a class="el" href="helpers_8h_source.xhtml#l00111">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, and <a class="el" href="helpers_8h_source.xhtml#l00145">Tensor3D::ptr</a>.</p>
Kaizen8938bd32017-09-28 14:38:23 +0100257<div class="fragment"><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160;{</div>
258<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> src = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(src);</div>
259<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;</div>
260<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; <span class="keyword">const</span> uint image_size = width * height;</div>
261<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;</div>
262<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; __global uchar *tmp_out_ptr = dst_ptr + dst_offset_first_element_in_bytes + (get_global_id(0) + get_global_id(1) * width + get_global_id(2) * image_size) * dst_stride_x;</div>
263<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160;</div>
264<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)src.ptr);</div>
265<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160;</div>
266<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160;<span class="preprocessor">#ifdef HAS_BIAS</span></div>
267<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160;<span class="preprocessor"></span> <span class="comment">// If it is the last thread in the 3 dimensional workgroup</span></div>
268<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; <span class="keywordflow">if</span>(get_global_id(0) == (get_global_size(0) - 1) &amp;&amp; get_global_id(1) == (get_global_size(1) - 1) &amp;&amp; get_global_id(2) == (get_global_size(2) - 1))</div>
269<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; {</div>
270<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; tmp_out_ptr += dst_stride_x;</div>
271<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;<span class="preprocessor">#ifdef FIXED_POINT_POSITION</span></div>
272<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160;<span class="preprocessor"></span> *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = (<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>)(1 &lt;&lt; FIXED_POINT_POSITION);</div>
273<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160;<span class="preprocessor">#else // FIXED_POINT_POSITION</span></div>
274<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160;<span class="preprocessor"></span> *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_out_ptr) = (<a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a>)1;</div>
275<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160;<span class="preprocessor">#endif // FIXED_POINT_POSITION</span></div>
276<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160;<span class="preprocessor"></span> }</div>
277<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160;<span class="preprocessor">#endif // HAS_BIAS</span></div>
278<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160;<span class="preprocessor"></span>}</div>
Kaizenbf8b01d2017-10-12 14:26:51 +0100279<div class="ttc" id="helpers_8h_xhtml_a31c8c760f08fb1a331b16b7c204321dc"><div class="ttname"><a href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_TENSOR3D_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00111">helpers.h:111</a></div></div>
Anthony Barbier871448e2017-03-24 14:54:29 +0000280<div class="ttc" id="convolution3x3_8cl_xhtml_afb8c72ce35c4a1f4a2588d6573e54aa1"><div class="ttname"><a href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a></div><div class="ttdeci">#define DATA_TYPE</div><div class="ttdef"><b>Definition:</b> <a href="convolution3x3_8cl_source.xhtml#l00027">convolution3x3.cl:27</a></div></div>
Kaizenbf8b01d2017-10-12 14:26:51 +0100281<div class="ttc" id="struct_tensor3_d_xhtml"><div class="ttname"><a href="struct_tensor3_d.xhtml">Tensor3D</a></div><div class="ttdoc">Structure to hold 3D tensor information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00143">helpers.h:143</a></div></div>
Anthony Barbier871448e2017-03-24 14:54:29 +0000282</div><!-- fragment -->
283</div>
284</div>
Anthony Barbierdbdab852017-06-23 15:42:00 +0100285<a class="anchor" id="ab6358b28d1e7bc946950075d94412013"></a>
Anthony Barbier871448e2017-03-24 14:54:29 +0000286<div class="memitem">
287<div class="memproto">
288 <table class="memname">
289 <tr>
290 <td class="memname">__kernel void reshape_to_columns </td>
291 <td>(</td>
292 <td class="paramtype">__global uchar *&#160;</td>
293 <td class="paramname"><em>src_ptr</em>, </td>
294 </tr>
295 <tr>
296 <td class="paramkey"></td>
297 <td></td>
298 <td class="paramtype">uint&#160;</td>
299 <td class="paramname"><em>src_stride_x</em>, </td>
300 </tr>
301 <tr>
302 <td class="paramkey"></td>
303 <td></td>
304 <td class="paramtype">uint&#160;</td>
305 <td class="paramname"><em>src_step_x</em>, </td>
306 </tr>
307 <tr>
308 <td class="paramkey"></td>
309 <td></td>
310 <td class="paramtype">uint&#160;</td>
311 <td class="paramname"><em>src_stride_y</em>, </td>
312 </tr>
313 <tr>
314 <td class="paramkey"></td>
315 <td></td>
316 <td class="paramtype">uint&#160;</td>
317 <td class="paramname"><em>src_step_y</em>, </td>
318 </tr>
319 <tr>
320 <td class="paramkey"></td>
321 <td></td>
322 <td class="paramtype">uint&#160;</td>
323 <td class="paramname"><em>src_stride_z</em>, </td>
324 </tr>
325 <tr>
326 <td class="paramkey"></td>
327 <td></td>
328 <td class="paramtype">uint&#160;</td>
329 <td class="paramname"><em>src_step_z</em>, </td>
330 </tr>
331 <tr>
332 <td class="paramkey"></td>
333 <td></td>
334 <td class="paramtype">uint&#160;</td>
335 <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
336 </tr>
337 <tr>
338 <td class="paramkey"></td>
339 <td></td>
340 <td class="paramtype">__global uchar *&#160;</td>
341 <td class="paramname"><em>dst_ptr</em>, </td>
342 </tr>
343 <tr>
344 <td class="paramkey"></td>
345 <td></td>
346 <td class="paramtype">uint&#160;</td>
347 <td class="paramname"><em>dst_stride_x</em>, </td>
348 </tr>
349 <tr>
350 <td class="paramkey"></td>
351 <td></td>
352 <td class="paramtype">uint&#160;</td>
353 <td class="paramname"><em>dst_step_x</em>, </td>
354 </tr>
355 <tr>
356 <td class="paramkey"></td>
357 <td></td>
358 <td class="paramtype">uint&#160;</td>
359 <td class="paramname"><em>dst_stride_y</em>, </td>
360 </tr>
361 <tr>
362 <td class="paramkey"></td>
363 <td></td>
364 <td class="paramtype">uint&#160;</td>
365 <td class="paramname"><em>dst_step_y</em>, </td>
366 </tr>
367 <tr>
368 <td class="paramkey"></td>
369 <td></td>
370 <td class="paramtype">uint&#160;</td>
371 <td class="paramname"><em>dst_offset_first_element_in_bytes</em>, </td>
372 </tr>
373 <tr>
374 <td class="paramkey"></td>
375 <td></td>
376 <td class="paramtype">__global uchar *&#160;</td>
377 <td class="paramname"><em>bias_ptr</em>, </td>
378 </tr>
379 <tr>
380 <td class="paramkey"></td>
381 <td></td>
382 <td class="paramtype">uint&#160;</td>
383 <td class="paramname"><em>bias_stride_x</em>, </td>
384 </tr>
385 <tr>
386 <td class="paramkey"></td>
387 <td></td>
388 <td class="paramtype">uint&#160;</td>
389 <td class="paramname"><em>bias_step_x</em>, </td>
390 </tr>
391 <tr>
392 <td class="paramkey"></td>
393 <td></td>
394 <td class="paramtype">uint&#160;</td>
Anthony Barbier871448e2017-03-24 14:54:29 +0000395 <td class="paramname"><em>bias_offset_first_element_in_bytes</em>, </td>
396 </tr>
397 <tr>
398 <td class="paramkey"></td>
399 <td></td>
400 <td class="paramtype">uint&#160;</td>
401 <td class="paramname"><em>width</em>, </td>
402 </tr>
403 <tr>
404 <td class="paramkey"></td>
405 <td></td>
406 <td class="paramtype">uint&#160;</td>
Anthony Barbierdbdab852017-06-23 15:42:00 +0100407 <td class="paramname"><em>height</em>, </td>
408 </tr>
409 <tr>
410 <td class="paramkey"></td>
411 <td></td>
412 <td class="paramtype">uint&#160;</td>
413 <td class="paramname"><em>depth</em>, </td>
414 </tr>
415 <tr>
416 <td class="paramkey"></td>
417 <td></td>
418 <td class="paramtype">uint&#160;</td>
419 <td class="paramname"><em>total_filters</em>&#160;</td>
Anthony Barbier871448e2017-03-24 14:54:29 +0000420 </tr>
421 <tr>
422 <td></td>
423 <td>)</td>
424 <td></td><td></td>
425 </tr>
426 </table>
427</div><div class="memdoc">
428
429<p>This kernel reshapes the tensor's low three dimensions to single column. </p>
430<dl class="section note"><dt>Note</dt><dd>Datatype should be given as a preprocessor argument using -DDATA_TYPE=type. e.g. -DDATA_TYPE=short</dd></dl>
431<dl class="params"><dt>Parameters</dt><dd>
432 <table class="params">
Kaizen8938bd32017-09-28 14:38:23 +0100433 <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source tensor. Supported data types: F16/F32 </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000434 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source tensor in X dimension (in bytes) </td></tr>
435 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
436 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source tensor in Y dimension (in bytes) </td></tr>
437 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
438 <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_z</td><td>Stride of the source tensor in Z dimension (in bytes) </td></tr>
439 <tr><td class="paramdir">[in]</td><td class="paramname">src_step_z</td><td>src_stride_z * number of elements along Y processed per workitem(in bytes) </td></tr>
440 <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
Kaizen8938bd32017-09-28 14:38:23 +0100441 <tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination tensor. Same as <code>src_ptr</code> </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000442 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
443 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
444 <tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination tensor in Y dimension (in bytes) </td></tr>
445 <tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
446 <tr><td class="paramdir">[in]</td><td class="paramname">dst_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
Kaizen8938bd32017-09-28 14:38:23 +0100447 <tr><td class="paramdir">[in]</td><td class="paramname">bias_ptr</td><td>Pointer to the bias tensor. Same as <code>src_ptr</code> </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000448 <tr><td class="paramdir">[in]</td><td class="paramname">bias_stride_x</td><td>Stride of the bias tensor in X dimension (in bytes) </td></tr>
449 <tr><td class="paramdir">[in]</td><td class="paramname">bias_step_x</td><td>bias_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000450 <tr><td class="paramdir">[in]</td><td class="paramname">bias_offset_first_element_in_bytes</td><td>The offset of the first element in the source tensor </td></tr>
451 <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the input tensor </td></tr>
452 <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the input tensor </td></tr>
Anthony Barbierdbdab852017-06-23 15:42:00 +0100453 <tr><td class="paramdir">[in]</td><td class="paramname">depth</td><td>The depth of the input tensor </td></tr>
454 <tr><td class="paramdir">[in]</td><td class="paramname">total_filters</td><td>Total number of filters. 4th dimension of the weights matrix </td></tr>
Anthony Barbier871448e2017-03-24 14:54:29 +0000455 </table>
456 </dd>
457</dl>
458
Kaizen8938bd32017-09-28 14:38:23 +0100459<p>Definition at line <a class="el" href="convolution__layer_8cl_source.xhtml#l00057">57</a> of file <a class="el" href="convolution__layer_8cl_source.xhtml">convolution_layer.cl</a>.</p>
Anthony Barbier871448e2017-03-24 14:54:29 +0000460
Kaizenbf8b01d2017-10-12 14:26:51 +0100461<p>References <a class="el" href="helpers_8h_source.xhtml#l00111">CONVERT_TO_TENSOR3D_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00027">DATA_TYPE</a>, and <a class="el" href="helpers_8h_source.xhtml#l00145">Tensor3D::ptr</a>.</p>
Kaizen8938bd32017-09-28 14:38:23 +0100462<div class="fragment"><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;{</div>
463<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <a class="code" href="struct_tensor3_d.xhtml">Tensor3D</a> src = <a class="code" href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a>(src);</div>
464<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keywordtype">bool</span> is_last_thread = (get_global_id(0) == (get_global_size(0) - 1) &amp;&amp; get_global_id(1) == (get_global_size(1) - 1) &amp;&amp; get_global_id(2) == (get_global_size(2) - 1));</div>
465<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;</div>
466<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; __global uchar *tmp_src_ptr = src.<a class="code" href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>;</div>
467<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; __global uchar *tmp_dst_ptr = dst_ptr + dst_offset_first_element_in_bytes + get_global_id(0) * dst_stride_y + get_global_id(1) * width * dst_stride_y + get_global_id(</div>
468<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; 2) * width * height * dst_stride_y;</div>
469<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="preprocessor">#ifdef HAS_BIAS</span></div>
470<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor"></span> __global uchar *tmp_bias_ptr = bias_ptr + bias_offset_first_element_in_bytes;</div>
471<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* HAS_BIAS */</span><span class="preprocessor"></span></div>
472<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="preprocessor"></span></div>
473<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordflow">if</span>(is_last_thread)</div>
474<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; {</div>
475<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordflow">for</span>(uint i = 0; i &lt; total_filters; ++i)</div>
476<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; {</div>
477<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_dst_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_src_ptr);</div>
478<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;</div>
479<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="preprocessor">#ifdef HAS_BIAS</span></div>
480<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="preprocessor"></span> *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(tmp_dst_ptr + dst_stride_y)) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)(tmp_bias_ptr));</div>
481<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; tmp_bias_ptr += bias_stride_x;</div>
482<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* HAS_BIAS */</span><span class="preprocessor"></span></div>
483<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;<span class="preprocessor"></span> tmp_src_ptr += depth * src_stride_z;</div>
484<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; tmp_dst_ptr += dst_stride_x;</div>
485<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; }</div>
486<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; }</div>
487<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <span class="keywordflow">else</span></div>
488<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; {</div>
489<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="keywordflow">for</span>(uint i = 0; i &lt; total_filters; ++i)</div>
490<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; {</div>
491<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_dst_ptr) = *((__global <a class="code" href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a> *)tmp_src_ptr);</div>
492<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; tmp_src_ptr += depth * src_stride_z;</div>
493<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; tmp_dst_ptr += dst_stride_x;</div>
494<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; }</div>
495<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; }</div>
496<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;}</div>
Kaizenbf8b01d2017-10-12 14:26:51 +0100497<div class="ttc" id="helpers_8h_xhtml_a31c8c760f08fb1a331b16b7c204321dc"><div class="ttname"><a href="helpers_8h.xhtml#a31c8c760f08fb1a331b16b7c204321dc">CONVERT_TO_TENSOR3D_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_TENSOR3D_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00111">helpers.h:111</a></div></div>
Anthony Barbier871448e2017-03-24 14:54:29 +0000498<div class="ttc" id="convolution3x3_8cl_xhtml_afb8c72ce35c4a1f4a2588d6573e54aa1"><div class="ttname"><a href="convolution3x3_8cl.xhtml#afb8c72ce35c4a1f4a2588d6573e54aa1">DATA_TYPE</a></div><div class="ttdeci">#define DATA_TYPE</div><div class="ttdef"><b>Definition:</b> <a href="convolution3x3_8cl_source.xhtml#l00027">convolution3x3.cl:27</a></div></div>
Kaizenbf8b01d2017-10-12 14:26:51 +0100499<div class="ttc" id="struct_tensor3_d_xhtml"><div class="ttname"><a href="struct_tensor3_d.xhtml">Tensor3D</a></div><div class="ttdoc">Structure to hold 3D tensor information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00143">helpers.h:143</a></div></div>
500<div class="ttc" id="struct_tensor3_d_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_tensor3_d.xhtml#acf52c23cbd7424606c10a606524e3e32">Tensor3D::ptr</a></div><div class="ttdeci">__global uchar * ptr</div><div class="ttdoc">Pointer to the starting postion of the buffer. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00145">helpers.h:145</a></div></div>
Anthony Barbier871448e2017-03-24 14:54:29 +0000501</div><!-- fragment -->
502</div>
503</div>
504</div><!-- contents -->
505</div><!-- doc-content -->
506<!-- start footer part -->
507<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
508 <ul>
Kaizen8938bd32017-09-28 14:38:23 +0100509 <li class="navelem"><a class="el" href="dir_55b5a5006e943fb664ff8cff3cfe7768.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_f6c3ae42d7e27145d0a3c3e38ca1c000.xhtml">core</a></li><li class="navelem"><a class="el" href="dir_1b7ae9123c88e650426d50d95c19d414.xhtml">CL</a></li><li class="navelem"><a class="el" href="dir_b7c3d80b0dadb2139bc73b7161751c12.xhtml">cl_kernels</a></li><li class="navelem"><a class="el" href="convolution__layer_8cl.xhtml">convolution_layer.cl</a></li>
Kaizenbf8b01d2017-10-12 14:26:51 +0100510 <li class="footer">Generated on Thu Oct 12 2017 14:26:35 for Compute Library by
Anthony Barbier871448e2017-03-24 14:54:29 +0000511 <a href="http://www.doxygen.org/index.html">
Kaizen8938bd32017-09-28 14:38:23 +0100512 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
Anthony Barbier871448e2017-03-24 14:54:29 +0000513 </ul>
514</div>
515</body>
516</html>