<div dir="ltr">Not really.  Clang does not have a way to annotate device vs. kernel functions in C/C++ mode.  You're probably better off trying to use OpenCL or CUDA mode in clang.<div><br></div><div style>In the clang unit tests, there is a cuda.h header that provides very basic support for these keywords:  tests/SemaCUDA/cuda.h</div>
<div style><br></div><div style>If you compile as CUDA (use .cu extension, or "-x cuda") and use this header, you will have basic support.  You can invoke clang with something like:</div><div style><br></div><div style>
<font face="courier new, monospace">$ clang <a href="http://test1.cu">test1.cu</a> -Xclang -fcuda-is-device -I ../src/clang/test/SemaCUDA -Xclang -triple -Xclang nvptx64 -Xclang -target-cpu -Xclang sm_20 -S</font><br></div>
<div style><br></div><div style>... assuming your clang source directory is ../src/clang, you want 64-bit PTX, and your target SM is 2.0.  Adjust accordingly.</div><div style><br></div><div style>Clang also knows how to map OpenCL to PTX, so you would do something like:</div>
<div style><br></div><div style><font face="courier new, monospace">$ clang <a href="http://test1.cl">test1.cl</a> -Xclang -triple -Xclang nvptx64 -Xclang -target-cpu -Xclang sm_20 -S</font></div><div style><br></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 20, 2013 at 3:29 PM, upit <span dir="ltr"><<a href="mailto:uday_pitambare@yahoo.com" target="_blank">uday_pitambare@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks a lot Justin,<br>
<br>
I will remove the toolkit header. Just one last question..(maybe ;) ) If I<br>
do away with toolkit headers it says unknown type name '__device__'. Does<br>
this function qualifier have an alternative ? or I can just do away with ?<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://llvm.1065342.n5.nabble.com/UNREACHABLE-executed-error-while-trying-to-generate-PTX-tp56026p56093.html" target="_blank">http://llvm.1065342.n5.nabble.com/UNREACHABLE-executed-error-while-trying-to-generate-PTX-tp56026p56093.html</a><br>

<div class="HOEnZb"><div class="h5">Sent from the LLVM - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">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><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div>
</div>