blob: 4e0a07fae5f312e1fec3683aaaebfcbc90ef0cbd [file] [log] [blame]
<!-- HTML header for doxygen 1.8.9.1-->
<!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.11"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
<title>Compute Library: src/core/CL/cl_kernels/gemm.cl File Reference</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);
$(window).load(resizeHeight);
</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/javascript">
$(document).ready(function() { init_search(); });
</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" />
</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;">
<td style="padding-left: 0.5em;">
<div id="projectname">Compute Library
&#160;<span id="projectnumber">v17.06</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
<li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
<li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
<li class="current"><a href="files.xhtml"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.xhtml"><span>File&#160;List</span></a></li>
<li><a href="globals.xhtml"><span>Globals</span></a></li>
</ul>
</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('gemm_8cl.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="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">gemm.cl File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>&quot;</code><br />
</div>
<p><a href="gemm_8cl_source.xhtml">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a21d7061f36aec78824e368f2ef1cafc1"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a21d7061f36aec78824e368f2ef1cafc1">gemm_transpose1x4_f32</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, 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)</td></tr>
<tr class="memdesc:a21d7061f36aec78824e368f2ef1cafc1"><td class="mdescLeft">&#160;</td><td class="mdescRight">This OpenCL kernel computes the "vector" 1x4 transposition of input matrix. <a href="#a21d7061f36aec78824e368f2ef1cafc1">More...</a><br /></td></tr>
<tr class="separator:a21d7061f36aec78824e368f2ef1cafc1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11d87ecaf1388b4f57404e062265b374"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a11d87ecaf1388b4f57404e062265b374">gemm_transpose1x8_f16</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, 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)</td></tr>
<tr class="memdesc:a11d87ecaf1388b4f57404e062265b374"><td class="mdescLeft">&#160;</td><td class="mdescRight">This OpenCL kernel computes the "vector" 1x8 transposition of input matrix. <a href="#a11d87ecaf1388b4f57404e062265b374">More...</a><br /></td></tr>
<tr class="separator:a11d87ecaf1388b4f57404e062265b374"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a675879eb72964ddbd5f71155da3b0cc3"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a675879eb72964ddbd5f71155da3b0cc3">gemm_transpose1x16_u8</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, 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)</td></tr>
<tr class="memdesc:a675879eb72964ddbd5f71155da3b0cc3"><td class="mdescLeft">&#160;</td><td class="mdescRight">This OpenCL kernel computes the "vector" 1x16 transposition of input matrix. <a href="#a675879eb72964ddbd5f71155da3b0cc3">More...</a><br /></td></tr>
<tr class="separator:a675879eb72964ddbd5f71155da3b0cc3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a560b2d50aa886edc0f5daf4fe729717f"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a560b2d50aa886edc0f5daf4fe729717f">gemm_interleave4x4_32bit</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, 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)</td></tr>
<tr class="memdesc:a560b2d50aa886edc0f5daf4fe729717f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This OpenCL kernel reshapes the input matrix transposing each 4x4 block and interleaving the values. <a href="#a560b2d50aa886edc0f5daf4fe729717f">More...</a><br /></td></tr>
<tr class="separator:a560b2d50aa886edc0f5daf4fe729717f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f32d740e780059f68da8aa589ed0a5b"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a2f32d740e780059f68da8aa589ed0a5b">gemm_interleave4x4_16bit</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, 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)</td></tr>
<tr class="memdesc:a2f32d740e780059f68da8aa589ed0a5b"><td class="mdescLeft">&#160;</td><td class="mdescRight">This OpenCL kernel reshapes the input matrix transposing each 4x4 block and interleaving the values. <a href="#a2f32d740e780059f68da8aa589ed0a5b">More...</a><br /></td></tr>
<tr class="separator:a2f32d740e780059f68da8aa589ed0a5b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa66a7b6b0420e54ec173743e6c5bfc45"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#aa66a7b6b0420e54ec173743e6c5bfc45">gemm_interleave4x4_8bit</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, 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)</td></tr>
<tr class="memdesc:aa66a7b6b0420e54ec173743e6c5bfc45"><td class="mdescLeft">&#160;</td><td class="mdescRight">This OpenCL kernel reshapes the input matrix transposing each 4x4 block and interleaving the values. <a href="#aa66a7b6b0420e54ec173743e6c5bfc45">More...</a><br /></td></tr>
<tr class="separator:aa66a7b6b0420e54ec173743e6c5bfc45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7c619984bc9c31f5f6c19ecc88b56581"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a7c619984bc9c31f5f6c19ecc88b56581">gemm_accumulate_biases_f32</a> (__global uchar *accum_ptr, uint accum_stride_x, uint accum_step_x, uint accum_stride_y, uint accum_step_y, uint accum_offset_first_element_in_bytes, __global uchar *biases_ptr, uint biases_stride_x, uint biases_step_x, uint biases_offset_first_element_in_bytes)</td></tr>
<tr class="memdesc:a7c619984bc9c31f5f6c19ecc88b56581"><td class="mdescLeft">&#160;</td><td class="mdescRight">This kernel accumulates each row with the biases vector. <a href="#a7c619984bc9c31f5f6c19ecc88b56581">More...</a><br /></td></tr>
<tr class="separator:a7c619984bc9c31f5f6c19ecc88b56581"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76295c333dfa3c9bb20975579dce87e8"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gemm_8cl.xhtml#a76295c333dfa3c9bb20975579dce87e8">gemm_accumulate_biases_f16</a> (__global uchar *accum_ptr, uint accum_stride_x, uint accum_step_x, uint accum_stride_y, uint accum_step_y, uint accum_offset_first_element_in_bytes, __global uchar *biases_ptr, uint biases_stride_x, uint biases_step_x, uint biases_offset_first_element_in_bytes)</td></tr>
<tr class="memdesc:a76295c333dfa3c9bb20975579dce87e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">This kernel accumulates each row with the biases vector. <a href="#a76295c333dfa3c9bb20975579dce87e8">More...</a><br /></td></tr>
<tr class="separator:a76295c333dfa3c9bb20975579dce87e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a76295c333dfa3c9bb20975579dce87e8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_accumulate_biases_f16 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>accum_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>biases_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>biases_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>biases_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>biases_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This kernel accumulates each row with the biases vector. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in,out]</td><td class="paramname">accum_ptr</td><td>Pointer to the accumulate tensor. Supported data type: F16 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_stride_x</td><td>Stride of the accumulate tensor in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_step_x</td><td>accum_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_stride_y</td><td>Stride of the accumlulate tensor in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_offset_first_element_in_bytes</td><td>The offset of the first element in the accumulate tensor </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_ptr</td><td>Pointer to the biases vector. Same as input. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00290">290</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00067">CONVERT_TO_VECTOR_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00049">IMAGE_DECLARATION</a>, <a class="el" href="helpers_8h_source.xhtml#l00201">offset()</a>, <a class="el" href="helpers_8h_source.xhtml#l00089">Vector::ptr</a>, <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>, and <a class="el" href="helpers_8h_source.xhtml#l00057">TENSOR3D_DECLARATION</a>.</p>
<div class="fragment"><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160;{</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> accum = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(accum);</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; <a class="code" href="struct_vector.xhtml">Vector</a> biases = <a class="code" href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a>(biases);</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160;</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; half8 accum_value = vload8(0, (__global half *)accum.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; half8 biases_value = vload8(0, (__global half *)biases.<a class="code" href="struct_vector.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; accum_value = biases_value + accum_value;</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160;</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; <span class="comment">// Store result in the accummulate buffer</span></div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; vstore8(accum_value, 0, (__global half *)accum.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160;}</div><div class="ttc" id="struct_vector_xhtml"><div class="ttname"><a href="struct_vector.xhtml">Vector</a></div><div class="ttdoc">Structure to hold Vector information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00087">helpers.h:87</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_a527bfdf5eeb306f1cf01c4a8e29f38e0"><div class="ttname"><a href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_VECTOR_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00067">helpers.h:67</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_vector_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_vector.xhtml#acf52c23cbd7424606c10a606524e3e32">Vector::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#l00089">helpers.h:89</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
<div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a7c619984bc9c31f5f6c19ecc88b56581"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_accumulate_biases_f32 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>accum_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>accum_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>biases_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>biases_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>biases_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>biases_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This kernel accumulates each row with the biases vector. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in,out]</td><td class="paramname">accum_ptr</td><td>Pointer to the accumulate tensor. Supported data type: F32 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_stride_x</td><td>Stride of the accmulate tensor in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_step_x</td><td>accum_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_stride_y</td><td>Stride of the accumlulate tensor in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">accum_offset_first_element_in_bytes</td><td>The offset of the first element in the accumulate tensor </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_ptr</td><td>Pointer to the biases vector. Same as input. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_stride_x</td><td>Stride of the destination tensor in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_step_x</td><td>dst_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">biases_offset_first_element_in_bytes</td><td>The offset of the first element in the destination tensor </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00262">262</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00067">CONVERT_TO_VECTOR_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00089">Vector::ptr</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160;{</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> accum = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(accum);</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; <a class="code" href="struct_vector.xhtml">Vector</a> biases = <a class="code" href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a>(biases);</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; float4 accum_value = vload4(0, (__global <span class="keywordtype">float</span> *)accum.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; float4 biases_value = vload4(0, (__global <span class="keywordtype">float</span> *)biases.<a class="code" href="struct_vector.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; accum_value = biases_value + accum_value;</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="comment">// Store result in the accummulate buffer</span></div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; vstore4(accum_value, 0, (__global <span class="keywordtype">float</span> *)accum.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160;}</div><div class="ttc" id="struct_vector_xhtml"><div class="ttname"><a href="struct_vector.xhtml">Vector</a></div><div class="ttdoc">Structure to hold Vector information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00087">helpers.h:87</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_a527bfdf5eeb306f1cf01c4a8e29f38e0"><div class="ttname"><a href="helpers_8h.xhtml#a527bfdf5eeb306f1cf01c4a8e29f38e0">CONVERT_TO_VECTOR_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_VECTOR_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00067">helpers.h:67</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_vector_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_vector.xhtml#acf52c23cbd7424606c10a606524e3e32">Vector::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#l00089">helpers.h:89</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
<div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a2f32d740e780059f68da8aa589ed0a5b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_interleave4x4_16bit </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>src_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>dst_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This OpenCL kernel reshapes the input matrix transposing each 4x4 block and interleaving the values. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source matrix. Supported data types: U16/S16/F16 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source matrix in X dimension (in bytes) </td></tr>
<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>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source matrix in Y dimension (in bytes) </td></tr>
<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>
<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 matrix </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination matrix Supported data types: U16/S16/F16 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination matrix in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_gx_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination matrix in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_gx_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<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 matrix </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00178">178</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00201">offset()</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160;{</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="comment">/* Compute source and destination addresses */</span></div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> dst = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(dst);</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="comment">/* Load values from Matrix A */</span></div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; half8 a0 = vload8(0, (__global half *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 0)));</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; half8 a1 = vload8(0, (__global half *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 1)));</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; half8 a2 = vload8(0, (__global half *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 2)));</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; half8 a3 = vload8(0, (__global half *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 3)));</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160;</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; half8 val0 = (half8)((half4)(a0.s0, a1.s0, a2.s0, a3.s0), (half4)(a0.s1, a1.s1, a2.s1, a3.s1));</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; vstore8(val0, 0, ((__global half *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 0);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; val0 = (half8)((half4)(a0.s2, a1.s2, a2.s2, a3.s2), (half4)(a0.s3, a1.s3, a2.s3, a3.s3));</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; vstore8(val0, 0, ((__global half *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 8);</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; val0 = (half8)((half4)(a0.s4, a1.s4, a2.s4, a3.s4), (half4)(a0.s5, a1.s5, a2.s5, a3.s5));</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; vstore8(val0, 0, ((__global half *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 16);</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; val0 = (half8)((half4)(a0.s6, a1.s6, a2.s6, a3.s6), (half4)(a0.s7, a1.s7, a2.s7, a3.s7));</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; vstore8(val0, 0, ((__global half *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 24);</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;}</div><div class="ttc" id="helpers_8h_xhtml_a009469e4d9b8fce3b6d5e97d2077827d"><div class="ttname"><a href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a></div><div class="ttdeci">__global uchar * offset(const Image *img, int x, int y)</div><div class="ttdoc">Get the pointer position of a Image. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00201">helpers.h:201</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
<div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a560b2d50aa886edc0f5daf4fe729717f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_interleave4x4_32bit </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>src_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>dst_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This OpenCL kernel reshapes the input matrix transposing each 4x4 block and interleaving the values. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source matrix. Supported data types: U32/S32/F32 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source matrix in X dimension (in bytes) </td></tr>
<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>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source matrix in Y dimension (in bytes) </td></tr>
<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>
<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 matrix </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination matrix Supported data types: U32/S32/F32 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination matrix in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_gx_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination matrix in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_gx_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<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 matrix </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00137">137</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00201">offset()</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160;{</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="comment">/* Compute source and destination addresses */</span></div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> dst = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(dst);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="comment">/* Load values from Matrix A */</span></div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; float4 a0 = vload4(0, (__global <span class="keywordtype">float</span> *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 0)));</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; float4 a1 = vload4(0, (__global <span class="keywordtype">float</span> *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 1)));</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; float4 a2 = vload4(0, (__global <span class="keywordtype">float</span> *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 2)));</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; float4 a3 = vload4(0, (__global <span class="keywordtype">float</span> *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 3)));</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; float4 val0 = (float4)(a0.s0, a1.s0, a2.s0, a3.s0);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; vstore4(val0, 0, ((__global <span class="keywordtype">float</span> *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 0);</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; val0 = (float4)(a0.s1, a1.s1, a2.s1, a3.s1);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; vstore4(val0, 0, ((__global <span class="keywordtype">float</span> *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 4);</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; val0 = (float4)(a0.s2, a1.s2, a2.s2, a3.s2);</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; vstore4(val0, 0, ((__global <span class="keywordtype">float</span> *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 8);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; val0 = (float4)(a0.s3, a1.s3, a2.s3, a3.s3);</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; vstore4(val0, 0, ((__global <span class="keywordtype">float</span> *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 12);</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;}</div><div class="ttc" id="helpers_8h_xhtml_a009469e4d9b8fce3b6d5e97d2077827d"><div class="ttname"><a href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a></div><div class="ttdeci">__global uchar * offset(const Image *img, int x, int y)</div><div class="ttdoc">Get the pointer position of a Image. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00201">helpers.h:201</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
<div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aa66a7b6b0420e54ec173743e6c5bfc45"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_interleave4x4_8bit </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>src_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>dst_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This OpenCL kernel reshapes the input matrix transposing each 4x4 block and interleaving the values. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source matrix. Supported data types: U8/S8 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source matrix in X dimension (in bytes) </td></tr>
<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>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source matrix in Y dimension (in bytes) </td></tr>
<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>
<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 matrix </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination matrix Supported data types: U8/S8 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination matrix in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_gx_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination matrix in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_gx_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<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 matrix </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00219">219</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="helpers_8h_source.xhtml#l00201">offset()</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;{</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="comment">/* Compute source and destination addresses */</span></div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> dst = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(dst);</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160;</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="comment">/* Load values from Matrix A */</span></div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; uchar16 a0 = vload16(0, (__global uchar *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 0)));</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; uchar16 a1 = vload16(0, (__global uchar *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 1)));</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; uchar16 a2 = vload16(0, (__global uchar *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 2)));</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; uchar16 a3 = vload16(0, (__global uchar *)(<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, 0, 3)));</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uchar16 val0 = (uchar16)((uchar4)(a0.s0, a1.s0, a2.s0, a3.s0), (uchar4)(a0.s1, a1.s1, a2.s1, a3.s1),</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; (uchar4)(a0.s2, a1.s2, a2.s2, a3.s2), (uchar4)(a0.s3, a1.s3, a2.s3, a3.s3));</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; vstore16(val0, 0, ((__global uchar *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 0);</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; val0 = (uchar16)((uchar4)(a0.s4, a1.s4, a2.s4, a3.s4), (uchar4)(a0.s5, a1.s5, a2.s5, a3.s5),</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; (uchar4)(a0.s6, a1.s6, a2.s6, a3.s6), (uchar4)(a0.s7, a1.s7, a2.s7, a3.s7));</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; vstore16(val0, 0, ((__global uchar *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 16);</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; val0 = (uchar16)((uchar4)(a0.s8, a1.s8, a2.s8, a3.s8), (uchar4)(a0.s9, a1.s9, a2.s9, a3.s9),</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; (uchar4)(a0.sA, a1.sA, a2.sA, a3.sA), (uchar4)(a0.sB, a1.sB, a2.sB, a3.sB));</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; vstore16(val0, 0, ((__global uchar *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 32);</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; val0 = (uchar16)((uchar4)(a0.sC, a1.sC, a2.sC, a3.sC), (uchar4)(a0.sD, a1.sD, a2.sD, a3.sD),</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; (uchar4)(a0.sE, a1.sE, a2.sE, a3.sE), (uchar4)(a0.sF, a1.sF, a2.sF, a3.sF));</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; vstore16(val0, 0, ((__global uchar *)dst.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) + 48);</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;}</div><div class="ttc" id="helpers_8h_xhtml_a009469e4d9b8fce3b6d5e97d2077827d"><div class="ttname"><a href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a></div><div class="ttdeci">__global uchar * offset(const Image *img, int x, int y)</div><div class="ttdoc">Get the pointer position of a Image. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00201">helpers.h:201</a></div></div>
<div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
<div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::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#l00097">helpers.h:97</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a675879eb72964ddbd5f71155da3b0cc3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_transpose1x16_u8 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>src_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>dst_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This OpenCL kernel computes the "vector" 1x16 transposition of input matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source matrix. Supported data types: U8 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source matrix in X dimension (in bytes) </td></tr>
<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>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source matrix in Y dimension (in bytes) </td></tr>
<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>
<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 matrix </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination matrix Supported data types: U8 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination matrix in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_gx_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination matrix in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_gx_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<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 matrix </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00105">105</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;{</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; uint x = get_global_id(0);</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; uint y = get_global_id(1);</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="comment">/* Compute address for Matrix B - source */</span></div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="comment">/* Compute address for Matrix B transposed - destination. X and Y are swapped */</span></div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; uint dst_addr_in_bytes = y * 16 + ((x * dst_stride_y + dst_offset_first_element_in_bytes));</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; uchar16 b0 = vload16(0, (__global uchar *)src.ptr);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; vstore16(b0, 0, (__global uchar *)(dst_ptr + dst_addr_in_bytes));</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;}</div><div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a21d7061f36aec78824e368f2ef1cafc1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_transpose1x4_f32 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>src_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>dst_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This OpenCL kernel computes the "vector" 1x4 transposition of input matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source matrix. Supported data types: F32 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source matrix in X dimension (in bytes) </td></tr>
<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>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source matrix in Y dimension (in bytes) </td></tr>
<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>
<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 matrix </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination matrix Supported data types: F32 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination matrix in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_gx_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination matrix in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_gx_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<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 matrix </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00041">41</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;{</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; uint x = get_global_id(0);</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; uint y = get_global_id(1);</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="comment">/* Compute address for Matrix B - source */</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="comment">/* Compute address for Matrix B transposed - destination. X and Y are swapped */</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; uint dst_addr_in_bytes = y * 16 + ((x * dst_stride_y + dst_offset_first_element_in_bytes));</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; float4 b0 = vload4(0, (__global <span class="keywordtype">float</span> *)src.ptr);</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; vstore4(b0, 0, (__global <span class="keywordtype">float</span> *)(dst_ptr + dst_addr_in_bytes));</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;}</div><div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a11d87ecaf1388b4f57404e062265b374"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">__kernel void gemm_transpose1x8_f16 </td>
<td>(</td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>src_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">__global uchar *&#160;</td>
<td class="paramname"><em>dst_ptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_stride_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_step_y</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>dst_offset_first_element_in_bytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This OpenCL kernel computes the "vector" 1x8 transposition of input matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the source matrix. Supported data types: F16 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source matrix in X dimension (in bytes) </td></tr>
<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>
<tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source matrix in Y dimension (in bytes) </td></tr>
<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>
<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 matrix </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dst_ptr</td><td>Pointer to the destination matrix Supported data types: F16 </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_x</td><td>Stride of the destination matrix in X dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_x</td><td>dst_gx_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_stride_y</td><td>Stride of the destination matrix in Y dimension (in bytes) </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dst_step_y</td><td>dst_gx_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
<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 matrix </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="gemm_8cl_source.xhtml#l00073">73</a> of file <a class="el" href="gemm_8cl_source.xhtml">gemm.cl</a>.</p>
<p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
<div class="fragment"><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;{</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; uint x = get_global_id(0);</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; uint y = get_global_id(1);</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="comment">/* Compute address for Matrix B - source */</span></div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <a class="code" href="struct_image.xhtml">Image</a> src = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src);</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <span class="comment">/* Compute address for Matrix B transposed - destination. X and Y are swapped */</span></div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; uint dst_addr_in_bytes = y * 16 + ((x * dst_stride_y + dst_offset_first_element_in_bytes));</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; half8 b0 = vload8(0, (__global half *)src.ptr);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; vstore8(b0, 0, (__global half *)(dst_ptr + dst_addr_in_bytes));</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;}</div><div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00073">helpers.h:73</a></div></div>
<div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00095">helpers.h:95</a></div></div>
</div><!-- fragment -->
</div>
</div>
</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_aebb8dcc11953d78e620bbef0b9e2183.xhtml">core</a></li><li class="navelem"><a class="el" href="dir_8c278f79c760e5c5fbd911f9870614c1.xhtml">CL</a></li><li class="navelem"><a class="el" href="dir_25885286e9dad4fa105b7b25a8031bbf.xhtml">cl_kernels</a></li><li class="navelem"><a class="el" href="gemm_8cl.xhtml">gemm.cl</a></li>
<li class="footer">Generated on Fri Jun 23 2017 15:44:34 for Compute Library by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>