how to compile CUDA to llvm IR?

百般思念 提交于 2019-12-19 04:09:10

问题


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:

  1. downloaded llvm (including clang) modified langoptions.cpp (CUDA=1; in the constructor), and installed it.
  2. installed CUDA toolkit 4.1 and CUDA SDK.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!