[Driver] Duplicate --offload-targets warns about "OpenMP" and is grouped under -Wopenmp-target for every offloading language
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The driver's duplicate offload-target check is offloading-language agnostic, but the diagnostic it emits is OpenMP-specific.
$ clang -### -fsycl --offload-targets=spirv64-unknown-unknown,spirv64-unknown-unknown -c t.cpp
clang: warning: OpenMP offloading target 'spirv64-unknown-unknown' is similar to target 'spirv64-unknown-unknown' already specified; will be ignored [-Wopenmp-target]
The same wording appears for HIP:
$ clang -### -x hip --offload-targets=amdgcn-amd-amdhsa,amdgcn-amd-amdhsa --offload-arch=gfx90a -c t.hip
clang: warning: OpenMP offloading target 'amdgpu-amd-amdhsa' is similar to target 'amdgpu-amd-amdhsa' already specified; will be ignored [-Wopenmp-target]
The warning comes from `warn_drv_omp_offload_target_duplicate` (clang/include/clang/Basic/DiagnosticDriverKinds.td:435-437), emitted from the generic duplicate check in Driver::CreateOffloadingDeviceToolChains (clang/lib/Driver/Driver.cpp:1165-1171), which runs for all offloading kinds.
Two problems: the text names OpenMP when nothing OpenMP is involved, and -Wno-openmp-target is the only way to silence it, which is not discoverable for SYCL, HIP or CUDA users.
Suggested fix: reword the message so it does not name an offloading language, and move it to a language-neutral diagnostic group
Contributor guide
Research direction
Start with clang/include/clang/Basic/DiagnosticDriverKinds.td:435-437 and the duplicate check in clang/lib/Driver/Driver.cpp:1165-1171. Trace how the diagnostic wording and warning group are defined, then verify the duplicate-target cases shown for SYCL and HIP, along with the stated CUDA and other offloading-language behavior. Done means the warning is language-neutral and has a language-neutral diagnostic group rather than requiring -Wno-openmp-target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100