<div class="gmail_quote">On Tue, Dec 13, 2011 at 3:37 PM, Villmow, Micah <span dir="ltr"><<a href="mailto:Micah.Villmow@amd.com">Micah.Villmow@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><u></u> <u></u></span></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 #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Justin Holewinski [mailto:<a href="mailto:justin.holewinski@gmail.com" target="_blank">justin.holewinski@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, December 13, 2011 10:50 AM</span></p><div class="im"><br>
<b>To:</b> Villmow, Micah<br>
<b>Cc:</b> LLVM Developers Mailing List<br>
<b>Subject:</b> Re: [LLVMdev] Changes to the PTX calling conventions<u></u><u></u></div><p></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div><div class="im">
<p class="MsoNormal">On Tue, Dec 13, 2011 at 12:54 PM, Villmow, Micah <<a href="mailto:Micah.Villmow@amd.com" target="_blank">Micah.Villmow@amd.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> </span><u></u><u></u></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 #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Justin Holewinski [mailto:<a href="mailto:justin.holewinski@gmail.com" target="_blank">justin.holewinski@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, December 13, 2011 9:48 AM<br>
<b>To:</b> Villmow, Micah<br>
<b>Cc:</b> LLVM Developers Mailing List<br>
<b>Subject:</b> Re: [LLVMdev] Changes to the PTX calling conventions</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 13, 2011 at 11:25 AM, Villmow, Micah <<a href="mailto:Micah.Villmow@amd.com" target="_blank">Micah.Villmow@amd.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Currently, PTX has its own calling conventions where they are split into kernel/device.
<u></u><u></u></p>
<p class="MsoNormal">The AMDIL backend requires very similar calling conventions and I was wondering if
<u></u><u></u></p>
<p class="MsoNormal">we could change the calling conventions from PTX_* to something more generic?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Maybe just Kernel/Device? Or would it be preferable to add a new calling convention<u></u><u></u></p>
<p class="MsoNormal">that is unique for each target, even though it duplicates functionality?<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">I don't see any reason why a generic calling convention would not work. We could do something like cl_device/cl_kernel. I hate to introduce OpenCL terms into a back-end where
OpenCL is just one consumer, but it does map cleanly to the architecture model. Or perhaps something more generic like gpu_device/gpu_global.<u></u><u></u></p>
</div>
<p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">[Villmow, Micah] Yeah, but this should apply to more than just gpu's. For example, AMD's OpenCL CPU implementation
could utilize the calling conventions, along with projects like ocelot that have the device-only vs host/device differentiation. Maybe just device/host is good enough?</span></i></b><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div><div><div class="im">
<p class="MsoNormal">Device/host just seems vague. Maybe we could create a set of specific conventions, one set for OpenCL: cl_device/cl_kernel, and another set for general accelerators, e.g. accel_device/accel_global.<u></u><u></u></p>
</div><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">[Villmow, Micah] Yeah, that is true. What about leaving the calling convention alone for 'device' and just having a calling convention for 'kernel'(i.e. functions callable
from another device). The normal calling conventions handle calls from the same device, but there is no calling convention that handles functions that are callable from a seperate device. This would handle the CPU/GPU and accelerator cases. That I believe
is the fundamental difference between the two calling conventions that OpenCL uses.</span></i></b></p></div></div></div></div></div></blockquote><div><br></div><div>You mean having no calling convention for device functions, and a new, common calling convention for kernels?</div>
<div><br></div><div>While this would work in practice, my issue with this approach is that it goes against the LLVM reference:</div><div><br></div><div><dt style="font-family:'Times New Roman';text-align:left;font-size:medium">
<b>"<tt>ccc</tt>" - The C calling convention</b>:</dt><dd style="font-family:'Times New Roman';text-align:left;font-size:medium">This calling convention (the default if no other calling convention is specified) matches the target C calling conventions. This calling convention supports varargs function calls and tolerates some mismatch in the declared prototype and implemented declaration of the function (as does normal C).</dd>
</div><div> </div><div>Our devices do not really have a "C calling convention," so the default does not make much sense. However, I have no objection to modifying the documentation to state that the C calling convention is the default for targets that support that convention.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div><div><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
</span></i></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><u></u><u></u></span></p>
</div><div class="im">
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Micah<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>
<a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><u></u><u></u></p>
</blockquote>
</div>
</div>
<p class="MsoNormal"><span style="color:#888888"><br>
<br clear="all">
<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#888888">--
<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="color:#888888">Thanks,<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">Justin Holewinski<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p>
</div>
</div>
</div>
</blockquote>
</div></div><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">-- <u></u><u></u></p>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Justin Holewinski<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></div>
</div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>