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, ...?
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.
clang++ -S -emit-llvm -o axpy -I<CUDA install path>/samples/common/inc -L<CUDA install path>/<lib64 or lib> axpy.cu -lcudart_static -lcuda -ldl -lrt -pthread
! – algoProg