[llvm-bugs] [Bug 51949] New: Host header files not detected when compiling for OpenMP device

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 23 10:06:53 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51949

            Bug ID: 51949
           Summary: Host header files not detected when compiling for
                    OpenMP device
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenMP
          Assignee: a.bataev at hotmail.com
          Reporter: huberjn at ornl.gov
                CC: huberjn at ornl.gov, jdoerfert at anl.gov,
                    llvm-bugs at lists.llvm.org

The host header files are not correctly detected when compiling for the OpenMP
device currently. As shown in https://godbolt.org/z/PhWTEfvYo the host files
are not detected if the target is set to `nvptx64-nvidia-cuda` but are detected
if the target is only `nvptx64`.

Normally, the header search uses the auxiliary triple to initiate its header
search when it detects that the Operating System part of the triple is `cuda`.
Just using `nvptx64` avoids this by not being considered CUDA and the header
search will instead use `nvptx64` as the triple for the header search. Since
this doesn't have an Operating System, the header search won't know how to
handle it specifically and instead add some default paths like /usr/include.

When we provide the full triple `nvptx64-nvidia-cuda` it will detect that we're
compiling for CUDA and instead use the host's triple, which doesn't add the
proper system header files when compiling with `-fopenmp` set for an unknown
reason. Removing `-fopenmp` from the compiler options causes it to again find
the host's header files using the host triple.

The OpenMP offloading device bitcode is current compiled with `-target nvptx64`
and seems to work accidentally by defaulting to searching preset paths, but
this probably won't work on all systems.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210923/02771a8a/attachment.html>


More information about the llvm-bugs mailing list