I have a CUDA C/C++ programm for CUDA 7.5. And as known: libNVVM Library - an optimizing compiler library that generates PTX from NVVM IR.
I can get PTX by using: nvcc -ptx <file>.cu -o <file>.ptx
But how can I get NVVM IR (LLVM IR) from <file>.cu
?
And how can I compile NVVM IR (LLVM IR) or Optimized IR for the target architecture?
Do I need for this third-party libraries or programs such as: libcuda.lang, ...?
- http://on-demand.gputechconf.com/gtc/2013/presentations/S3185-Building-GPU-Compilers-libNVVM.pdf
- http://on-demand.gputechconf.com/gtc/2012/presentations/S0235-Compiling-CUDA-and-Other-Languages-for-GPUs.pdf
- Read more at: http://docs.nvidia.com/cuda/nvvm-ir-spec/index.html#ixzz3tod7pdD7
The NVVM compiler (which is based on LLVM) generates PTX code from NVVM IR.
NVVM IR and NVVM compilers are mostly agnostic about the source language being used. The PTX codegen part of a NVVM compiler needs to know the source language because of the difference in DCI (driver/compiler interface).
Technically speaking, NVVM IR is LLVM IR with a set of rules, restrictions, and conventions, plus a set of supported intrinsic functions. A program specified in NVVM IR is always a legal LLVM program. A legal LLVM program may not be a legal NVVM program.