[llvm-dev] Using Clang Tools on CUDA Programs

Izzat El Hajj via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 21 10:07:25 PST 2015


Hello,

I'm not sure if this is the right place to post this question. If not, I
apologize and would appreciate if you redirect me.

I recently built and installed llvm/clang in order to build a CUDA
source-to-source translator using Clang. I followed these instructions:
http://clang.llvm.org/docs/LibASTMatchersTutorial.html.

The built-in tools (like clang-check) work fine on C/C++ programs, but they
don't work on CUDA. If I execute the following command (regardless of what
kernel.cu contains) I get the error shown:

$ clang-check kernel.cu --

error: unable to handle compilation, expected exactly one compiler job in '
"/usr/local/bin/clang-check" "-cc1" "-triple" "nvptx64-nvidia-cuda"
"-aux-triple" "x86_64-unknown-linux-gnu" "-fcuda-target-overloads"
"-fcuda-disable-target-call-checks" "-fsyntax-only" "-disable-free"
"-main-file-name" "kernel.cu" "-mrelocation-model" "static"
"-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno"
"-no-integrated-as" "-mconstructor-aliases" "-fcuda-is-device"
"-mlink-cuda-bitcode"
"/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc"
"-target-feature" "+ptx42" "-target-cpu" "sm_20" "-dwarf-column-info"
"-resource-dir" "/usr/local/bin/../lib/clang/3.8.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/local/bin/../lib/clang/3.8.0/include" "-internal-externc-isystem"
"/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"
"-internal-isystem" "/usr/local/cuda/include" "-include"
"__clang_cuda_runtime_wrapper.h" "-fdeprecated-macro"
"-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/<path>/test"
"-ferror-limit" "19" "-fmessage-length" "192" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-x" "cuda" "/<path>/test/kernel.cu";
 "/usr/local/bin/clang-check" "-cc1" "-triple" "x86_64-unknown-linux-gnu"
"-aux-triple" "nvptx64-nvidia-cuda" "-fcuda-target-overloads"
"-fcuda-disable-target-call-checks" "-fsyntax-only" "-disable-free"
"-main-file-name" "kernel.cu" "-mrelocation-model" "static"
"-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu"
"x86-64" "-dwarf-column-info" "-resource-dir"
"/usr/local/bin/../lib/clang/3.8.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/local/bin/../lib/clang/3.8.0/include" "-internal-externc-isystem"
"/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include"
"-internal-externc-isystem" "/usr/include" "-internal-isystem"
"/usr/local/cuda/include" "-include" "__clang_cuda_runtime_wrapper.h"
"-fdeprecated-macro" "-fdebug-compilation-dir" "/<path>/test"
"-ferror-limit" "19" "-fmessage-length" "192" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-x" "cuda" "/<path>/test/kernel.cu"; '
Error while processing /<path>/test/kernel.cu.


I searched thoroughly online before posting here but could not find
relevant answers. Any help would be appreciated.

Thanks!

-Izzat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151221/4c10f808/attachment.html>


More information about the llvm-dev mailing list