[clang] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 16:41:19 PST 2024


================
@@ -0,0 +1,7 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with code 0.
+// DEFINE: %{gpu_opts} = --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda --no-cuda-version-check
+// DEFINE: %{check} = %clang -### -c %{gpu_opts} -mcmodel=medium %s
+// RUN: %{check} -fbasic-block-sections=all
----------------
Artem-B wrote:

You may want to either rename the file into `.cu` or use `-x cuda`. Otherwise you're running a plain C compilation.

Also, what exactly are we checking here? With `-###` CC1 sub-compilations do not run and, I think, that's where unsupported options were triggering warning/errors. 

You may want to do two actual compilations, one with `--cuda-host-only` and one with `--cuda-device-only -s`. 

https://github.com/llvm/llvm-project/pull/79222


More information about the cfe-commits mailing list