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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to