Dear all,

I am trying to extract the NVVM IR (or at least LLVM IR) out of a C for CUDA file. I have cuda 5.0, plus LLVM 3.4 installed in my system. Is that possible?

Put it in another way, I would like to optimize CUDA programs using some LLVM technology of my own craft. Is there another path towards this goal, in case my first idea is not feasible?

Thank you in advance,


I don’t think that there is currently a way to get NVVM IR other than to generate it yourself.
I’m sure someone will correct me if I am wrong.

As an alternative, you can try playing around with the public CLANG compiler frontend to
generate LLVM IR, then use the NVPTX backend in LLVM to generate PTX and target an

Since your program will be in LLVM IR at that point, it should be very similar to NVVM.
I’ve not tried converting it directly into NVVM, but that might work. If not, you can
feed it directly into the NVPTX backend and still get an executable program.

If you already have LLVM 3.4 installed from source you should have the NVPTX backend.
You may also need to install CLANG (see the website for installation instructions).

There is also some documentation for the NVPTX backend.