<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Beignet [mailto:beignet-bounces@lists.freedesktop.org]
<b>On Behalf Of </b>Dehuan Xin<br>
<b>Sent:</b> Sunday, November 15, 2015 5:50 PM<br>
<b>To:</b> beignet@lists.freedesktop.org<br>
<b>Subject:</b> [Beignet] Question on some implementation details: async copy and vector functions<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi, <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have two questions on the implementation detail of Beignet:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
1. I see in this file that async copy is implemented as a for-loop. Does this mean async copy is currently a processor copy and is not offloaded to hardware like DMA and it's not truly `async`, either?
<o:p></o:p></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><a href="http://cgit.freedesktop.org/beignet/tree/backend/src/libocl/src/ocl_async.cl">http://cgit.freedesktop.org/beignet/tree/backend/src/libocl/src/ocl_async.cl</a><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">async_copy is done through GPU I/O read/write messages. AFAIK, this is not DMA like transfer.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">2. In this source file, I see vector load is scalarized to scalar load, is this behavior disabled when `__attribute__((vec_type_hint(<type<em>n</em>>)))` is used?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><a href="http://cgit.freedesktop.org/beignet/tree/backend/src/libocl/src/ocl_vload.cl">http://cgit.freedesktop.org/beignet/tree/backend/src/libocl/src/ocl_vload.cl</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#1F497D">generally vload is not recommended. The problem is take vload4(uchar *) as an example, the pointer passed in is only guaranteed to be 1 aligned.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">But a uchar4* read access will ensure the pointer is 4 aligned. That is a big difference to compiler. The hardware performance is quite different.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">So, the guide is try to use uchar4* pointer which cl programmer need to make sure the pointer is 4 aligned. If you cannot guarantee the pointer is 4 aligned,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">you can choose to use vload which is easy to program and . We will re-merge the scalarized load in compiler backend. Don’t worry. See llvm_loadstore_merge.cpp.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">There is no performance difference between vload4(int/float*, ) and int/float4* read. Because they are both 4 aligned<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">We haven’t done anything special to
</span>`__attribute__((vec_type_hint(<type<em>n</em>>)))`.<span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Ruiling<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">Regards<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Dehuan<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>