<div dir="ltr">Hi Jeroen,<div>Correct me if I am mistaken (there is a good chance of that :) ), but I think the issue here is that ptx32 and ptx23 appear to refer to completely different things.  ptx32 is the 32-bit version of the PTX assembly, and ptx23 appears to refer to the version of the PTX assembly from a feature point of view (see <a href="http://llvm.org/devmtg/2011-11/Holewinski_PTXBackend.pdf">http://llvm.org/devmtg/2011-11/Holewinski_PTXBackend.pdf</a> slide 9/37).</div><div><br></div><div>I'm a bit perplexed by all of this given that it appears that clang used to be able to compile OpenCL to ptx23.  For instance, I found some old slides by Justin Holewinski showing how one used to be able to compile to ptx23 circa 2011 (<a href="http://llvm.org/devmtg/2011-11/Holewinski_PTXBackend.pdf">http://llvm.org/devmtg/2011-11/Holewinski_PTXBackend.pdf</a>).  Below is an example from slide 10/37:</div><div> <b><i>clang -ccc-host-triple ptx32 -Xclang -target-feature -Xclang +ptx23 -Xclang -target-feature -Xclang +sm20 -I$LIBCLC/include/generic -I$LIBCLC/include/ptx  -include clc/clc.h -Dcl_clang_storage_class_specifiers -O3 SOURCE.cl -S</i></b><br></div><div><b><i><br></i></b></div><div>I tried generating the code this way, but it doesn't work for me.  Is this syntax out of date?  Are the slides referring to something else?  If not, what would be the equivalent for llvm 3.4?</div><div><br></div><div>-Alex</div><div><b><i><br></i></b></div><div><b><i><br></i></b></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 24, 2015 at 3:39 PM, Jeroen Ketema <span dir="ltr"><<a href="mailto:j.ketema@imperial.ac.uk" target="_blank">j.ketema@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Hi Alex,</div><div><br></div><div>I think this question might be more appropriate for the cfe-dev list, but to answer your question: looking at lib/Target/NVPTX/NVPTX.td and its history, it seems that the llvm NVPTX backend at present (llvm trunk) only supports ptx32 and up, and never supported anything below ptx30.</div><div><br></div><div>Jeroen</div><br><div><blockquote type="cite"><div><div class="h5"><div>On 24 Aug 2015, at 23:24, Alex Breslow via Libclc-dev <<a href="mailto:libclc-dev@lists.llvm.org" target="_blank">libclc-dev@lists.llvm.org</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">Hi there,<div><br></div><div>I'm using clang to compile OpenCL kernels to PTX so that they can be run on an architectural simulator.  The simulator is only compatible with ptx23 not ptx30 or ptx31.</div><div><br></div><div>I'm compiling the kernels as follows:</div><div><i><b>SRC=VectorAdd.cl</b></i></div><div><i><b>DEST=VectorAdd.ptx</b></i></div><div><i><b><br></b></i></div><div><i><b>clang -Dcl_clang_storage_class_specifiers -isystem libclc/generic/include -include clc/clc.h -target nvptx-unknown-nvcl -xcl $SRC -emit-llvm -S -o $DEST.ll<br></b></i></div><div><i><b><br></b></i></div><div><i><b>opt -S -O3 -loop-unroll $DEST.ll -o $DEST.opt.ll</b></i></div><div><i><b><br></b></i></div><div><i><b>llc -mcpu=sm_20 -mattr=+ptx30 $DEST.opt.ll -o $DEST"</b></i></div><div><i><b><br></b></i></div><div>The following code works to compile the kernel to ptx30, but when I attempt to change -mattr=+ptx30 to -mattr=+ptx23, I get the following warning:</div><div><br></div><div><div><i><b>'+ptx23' is not a recognized feature for this target (ignoring feature)</b></i></div><div><i><b>'+ptx23' is not a recognized feature for this target (ignoring feature)</b></i></div></div><div><i><b><br></b></i></div><div>Is there a way to around this warning so that ptx23 code is generated?</div><div><br></div><div>I am using the Ubuntu 14.04 aptitude packages for libclc-dev, libclc-ptx, clang, and llvm.</div><div>Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)</div><div><br></div><div><br></div><div>Thanks again for your time and let me know if you need further information.</div><div><br></div><div>Regards,</div><div>Alex</div><div><div><br></div>-- <br><div><div dir="ltr">Alex Breslow<div><br></div></div></div>
</div></div></div></div>
_______________________________________________<br>Libclc-dev mailing list<br><a href="mailto:Libclc-dev@lists.llvm.org" target="_blank">Libclc-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a><br></div></blockquote></div><br></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alex Breslow<div>PhD student in computer science at UC San Diego<br><div>Email: <a href="mailto:abreslow@cs.ucsd.edu" target="_blank">abreslow@cs.ucsd.edu</a></div><div>Website: <a href="http://cseweb.ucsd.edu/~abreslow" target="_blank">cseweb.ucsd.edu/~abreslow</a></div></div></div></div>
</div>