Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False-positive from -Wsource-uses-openmp with SYCL #15930

Open
al42and opened this issue Oct 30, 2024 · 0 comments
Open

False-positive from -Wsource-uses-openmp with SYCL #15930

al42and opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@al42and
Copy link
Contributor

al42and commented Oct 30, 2024

Describe the bug

Building a program with -Wsource-uses-openmp -fopenmp -fsycl produces warnings about OpenMP pragmas. Building the same program without -fsycl does not produce any warnings. The source indeed uses OpenMP, but the warning should not be issued as long as we have -fopenmp flag.

To reproduce

#include <iostream>

int main() {
#pragma omp parallel for
  for (int i = 0; i < 8; i++) {
    std::cout << i << std::endl;
  }
  return 0;
}
$ clang++ simple-sycl-omp.cpp -Wsource-uses-openmp -fopenmp && echo ok
ok
$ clang++ simple-sycl-omp.cpp -Wsource-uses-openmp -fopenmp -fsycl
simple-sycl-omp.cpp:4:9: warning: unexpected '#pragma omp ...' in program [-Wsource-uses-openmp]
    4 | #pragma omp parallel for
      |         ^

Environment

  • Ubuntu 22.04
  • DPC++ version: 2172d9e

Additional context

The warning comes from the device pass:

$ clang++ simple-sycl-omp.cpp -Wsource-uses-openmp -fopenmp -fsycl -c -v
clang version 20.0.0git (https://github.com/intel/llvm 2172d9ee91d5ff70fc3e995c3dfd64c84c3738a7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/aland/intel-sycl/llvm/build/install/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda-12.3, version 12.3
Found HIP installation: /opt/rocm, version 6.1.40092
 "/home/aland/intel-sycl/llvm/build/install/bin/clang-20" -cc1 -triple spir64-unknown-unknown -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -fdeclare-spirv-builtins -mllvm -sycl-opt -fenable-sycl-dae -fsycl-instrument-device-code -Wno-sycl-strict -O2 -fsycl-int-header=/tmp/simple-sycl-omp-header-83cbd0.h -fsycl-int-footer=/tmp/simple-sycl-omp-footer-95cb5a.h -sycl-std=2020 -ffine-grained-bitfield-accesses -fsycl-unique-prefix=uid9031853f69f4f78a -D__SYCL_ANY_DEVICE_HAS_ANY_ASPECT__=1 -Wspir-compat -emit-llvm-bc -emit-llvm-uselists -disable-free -clear-ast-before-backend -main-file-name simple-sycl-omp.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -aux-target-cpu x86-64 -debugger-tuning=gdb -fdebug-compilation-dir=/home/aland/sycl_tests -v -fcoverage-compilation-dir=/home/aland/sycl_tests -resource-dir /home/aland/intel-sycl/llvm/build/install/lib/clang/20 -internal-isystem /home/aland/intel-sycl/llvm/build/install/bin/../include/sycl/stl_wrappers -internal-isystem /home/aland/intel-sycl/llvm/build/install/bin/../include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /home/aland/intel-sycl/llvm/build/install/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../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/aland/intel-sycl/llvm/build/install/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wsource-uses-openmp -std=c++17 -fdeprecated-macro -ferror-limit 19 -fgpu-rdc -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/simple-sycl-omp-bc25c5.bc -x c++ simple-sycl-omp.cpp
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward"
ignoring duplicate directory "/home/aland/intel-sycl/llvm/build/install/lib/clang/20/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/home/aland/intel-sycl/llvm/build/install/lib/clang/20/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/aland/intel-sycl/llvm/build/install/bin/../include/sycl/stl_wrappers
 /home/aland/intel-sycl/llvm/build/install/bin/../include
 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12
 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12
 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward
 /home/aland/intel-sycl/llvm/build/install/lib/clang/20/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
simple-sycl-omp.cpp:4:9: warning: unexpected '#pragma omp ...' in program [-Wsource-uses-openmp]
    4 | #pragma omp parallel for
      |         ^
1 warning generated.
 "/home/aland/intel-sycl/llvm/build/install/bin/clang-20" -cc1 -triple x86_64-unknown-linux-gnu -sycl-std=2020 -fsycl-unique-prefix=uid9031853f69f4f78a -include-internal-header /tmp/simple-sycl-omp-header-83cbd0.h -dependency-filter /tmp/simple-sycl-omp-header-83cbd0.h -fsycl-enable-int-header-diags -include-internal-footer /tmp/simple-sycl-omp-footer-95cb5a.h -dependency-filter /tmp/simple-sycl-omp-footer-95cb5a.h -fsycl-is-host -D__SYCL_ANY_DEVICE_HAS_ANY_ASPECT__=1 -emit-obj -disable-free -clear-ast-before-backend -main-file-name simple-sycl-omp.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic --dependent-lib=sycl-devicelib-host -debugger-tuning=gdb -fdebug-compilation-dir=/home/aland/sycl_tests -v -fcoverage-compilation-dir=/home/aland/sycl_tests -resource-dir /home/aland/intel-sycl/llvm/build/install/lib/clang/20 -internal-isystem /home/aland/intel-sycl/llvm/build/install/bin/../include/sycl/stl_wrappers -internal-isystem /home/aland/intel-sycl/llvm/build/install/bin/../include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /home/aland/intel-sycl/llvm/build/install/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../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/aland/intel-sycl/llvm/build/install/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wsource-uses-openmp -std=c++17 -fdeprecated-macro -ferror-limit 19 -fopenmp -fgpu-rdc -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/simple-sycl-omp-65a940.o -x c++ simple-sycl-omp.cpp
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward"
ignoring duplicate directory "/home/aland/intel-sycl/llvm/build/install/lib/clang/20/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/aland/intel-sycl/llvm/build/install/bin/../include/sycl/stl_wrappers
 /home/aland/intel-sycl/llvm/build/install/bin/../include
 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12
 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12
 /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward
 /home/aland/intel-sycl/llvm/build/install/lib/clang/20/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
 "/home/aland/intel-sycl/llvm/build/install/bin/clang-offload-bundler" -type=o -targets=sycl-spir64-unknown-unknown,host-x86_64-unknown-linux-gnu -output=simple-sycl-omp.o -input=/tmp/simple-sycl-omp-bc25c5.bc -input=/tmp/simple-sycl-omp-65a940.o -verbose
@al42and al42and added the bug Something isn't working label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant