Emit LLVMIR for a CUDA kernel

Hi all,

Does anyone know how to emit LLVM IR for the kernel of a CUDA C++ code? clang++ -emit-llvm --cuda-gpu-arch=sm_75 [x.cu](http://x.cu/) somehow only emits code for the host side code.

Thanks,
Navdeep

Hi Navdeep,

you can emit the llvm IR code of the device side with clang -S -emit-llvm --cuda-gpu-arch=sm_75 --cuda-device-only code.cu -o code.ll

and with clang -S --cuda-gpu-arch=sm_75 --cuda-device-only code.cu -o code.ptx you can emit the ptx code.

Cheers,
Simeon

Hi Simeon,

Thanks! that worked.

Cheers,
Navdeep