<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">><span class="currentHitHighlight" id="0.9755705178463097" name="searchHitInReadingPane"> OpenCL</span> spec requires that a pointer should be aligned to at least the pointee type.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
So a pointer to int16 would be 64 byte aligned? Seems strange though. Can you give me the spec reference?<br>
<br>
<span>> Otherwise, __enqueue_kernel has to either allocate unaligned local buffer, which degrades performance, or allocates local buffer with extra alignment therefore wasted memory space.</span><br>
<br>
Can you explain in more details here, please.<br>
<br>
Cheer,<br>
Anastasia<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Liu, Yaxun (Sam) <Yaxun.Liu@amd.com><br>
<b>Sent:</b> 01 December 2017 19:45<br>
<b>To:</b> Anastasia Stulova; cfe-dev (cfe-dev@lists.llvm.org); Bader, Alexey (alexey.bader@intel.com)<br>
<b>Cc:</b> Sumner, Brian<br>
<b>Subject:</b> [RFC][OpenCL] Pass alignment of arguments in local addr space for device-side enqueued kernel to __enqueue_kernel functions</font>
<div> </div>
</div>
<div lang="EN-US">
<div class="x_WordSection1">
<p class="x_MsoNormal">Hi,</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">OpenCL spec requires that a pointer should be aligned to at least the pointee type. Therefore, if a device-side enqueued kernel has a local int* argument, it should be aligned to 4 bytes.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Since these buffers in local addr space are allocated by __enqueue_kernel, it needs to know the alignment of these buffers, not just their sizes.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Although such information is not passed to the original OpenCL builtin function enqueue_kernel, it can be obtained by checking the prototype of the block invoke function at compile time.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">I would like to create a patch to pass this information to  __enqueue_kernel. Otherwise, __enqueue_kernel has to either allocate unaligned local buffer, which degrades performance, or allocates local buffer with extra alignment therefore
 wasted memory space.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Any comments?</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Thanks.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Sam</p>
</div>
</div>
</div>
</div>
</body>
</html>