问题
I've been trying for three days to compile a CUDA kernel into llvm IR and I couldn't do it. I've changed langoptions.cpp and added CUDA=1; in the constructor , but still the clang give me Error messages for cuda syntax (like _synchthreads() call).
I've done the following:
- downloaded llvm (including clang) modified langoptions.cpp (CUDA=1; in the constructor), and installed it.
- installed CUDA toolkit 4.1 and CUDA SDK.
compiled a CUDA example using clang using:
clang -I${CUDA_HOME}/include -I${CUDA_SDK_INC} ~/workspace/cuda_example/mis_kernel.cu -S -emit-llvm -o ~/workspace/cuda_example/a.ll
and as I said it doesn't work.
回答1:
clang –x=CUDA in the public LLVM trunk is something experimental done outside of NVIDIA; you should contact the llvm-dev alias with questions.
NVCC doesn't support emitting LLVM IR.
来源:https://stackoverflow.com/questions/9117109/how-to-compile-cuda-to-llvm-ir