Cuda programs on LLVM

Hello ,
How to execute a cuda program using llvm?
More specifically, nvcc produces some temporary files during its compilation. I want to convert the .cu.cpp to .ll format and optimize it. The .cu.cpp file contains typedefs and enums used by cuda runtime and also the host part of the code
and the ptx file contains the kernel definition. How can i run the program after optimization? Will Rhodin be of any help in doing so? Thank you:)

Hi Adarsh,

to my knowledge there is no publicly available CUDA-Frontend for LLVM yet.
The work of Helge Rhodin you mentioned is on the backend-side: It allows to generate PTX code from LLVM IR. It is still being maintained, although I think the currently available source code is a little outdated.
There is also a PTX backend in the current version of LLVM that makes use of LLVM's backend-infrastructure (our approach is similar to the C-backend).

Best,
Ralf

Hi Adarsh,

Justin has uploaded some sample codes of how to work with the LLVM PTX
backend: https://github.com/jholewinski/llvm-ptx-samples

Basically, you have to write a C++ program that explicitly loads CUDA
"bytecodes". And, as Ralf pointed out, since we do not have a LLVM
CUDA frontend, your CUDA kernels have to be looked like C++. That
means, it is not a 100% syntactically correct CUDA codes.

Regards,
Che-Liang