boomanaiden154 wrote:

This is the cc1 invocation that is causing things to fail (on the example 
provided in the comment above):
```
/home/gha/llvm-project/build/bin/clang-22 -cc1 -triple nvptx64-nvidia-cuda 
-aux-triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free 
-clear-ast-before-backend -main-file-name test.c -mrelocation-model static 
-mframe-pointer=all -fno-rounding-math -no-integrated-as -aux-target-cpu x86-64 
-fcuda-is-device -mllvm -enable-memcpyopt-without-libcalls 
-fno-threadsafe-statics -target-cpu sm_52 -target-feature +ptx42 
-debugger-tuning=gdb -fno-dwarf-directory-asm 
-fdebug-compilation-dir=/home/gha/llvm-project/build -resource-dir 
/home/gha/llvm-project/build/lib/clang/22 -internal-isystem 
/home/gha/llvm-project/build/lib/clang/22/include/cuda_wrappers 
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 
-internal-isystem 
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 
-internal-isystem 
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward 
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 
-internal-isystem 
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 
-internal-isystem 
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward 
-internal-isystem /home/gha/llvm-project/build/lib/clang/22/include 
-internal-isystem /usr/local/include -internal-isystem 
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include 
-internal-externc-isystem /usr/include/x86_64-linux-gnu 
-internal-externc-isystem /include -internal-externc-isystem /usr/include 
-internal-isystem /home/gha/llvm-project/build/lib/clang/22/include 
-internal-isystem /usr/local/include -internal-isystem 
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include 
-internal-externc-isystem /usr/include/x86_64-linux-gnu 
-internal-externc-isystem /include -internal-externc-isystem /usr/include 
-fdeprecated-macro -fno-autolink -ferror-limit 19 -fmessage-length=451 
--offload-new-driver --no-offloadlib -fgnuc-version=4.2.1 
-fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics 
-cuid=bc129a722f93e87b -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x cuda /tmp/test.c
```

It looks like something in the CUDA flags enables the `__cpuidex` builtin, and 
then we aren't detecting it with `__has_builtin` because the host is the aux 
triple. It's the same flow as the offloading test in `__cpuidex_conflict.c`, 
but it seems like CUDA is handling things differently. I need to spend a bit 
more time investigating.

https://github.com/llvm/llvm-project/pull/126324
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to