[LLVMdev] UNREACHABLE executed! error while trying to generate PTX
justin.holewinski at gmail.com
Thu Mar 21 13:27:43 PDT 2013
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.
In the clang unit tests, there is a cuda.h header that provides very basic
support for these keywords: tests/SemaCUDA/cuda.h
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
$ clang test1.cu -Xclang -fcuda-is-device -I ../src/clang/test/SemaCUDA
-Xclang -triple -Xclang nvptx64 -Xclang -target-cpu -Xclang sm_20 -S
... assuming your clang source directory is ../src/clang, you want 64-bit
PTX, and your target SM is 2.0. Adjust accordingly.
Clang also knows how to map OpenCL to PTX, so you would do something like:
$ clang test1.cl -Xclang -triple -Xclang nvptx64 -Xclang -target-cpu
-Xclang sm_20 -S
On Wed, Mar 20, 2013 at 3:29 PM, upit <uday_pitambare at yahoo.com> wrote:
> Thanks a lot Justin,
> I will remove the toolkit header. Just one last question..(maybe ;) ) If I
> do away with toolkit headers it says unknown type name '__device__'. Does
> this function qualifier have an alternative ? or I can just do away with ?
> View this message in context:
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev