LIT failure: clang/test/Driver/openmp-offload-gpu.c

Hi,

I don’t know the LIT test infrastructure well enough. Recently, openmp-offload-gpu.c started to fail in our downstream test. I find that if I build with LLVM_TARGETS_TO_BUILD=“PowerPC”, the test is “UNSUPPORTED”. If I build with LLVM_TARGETS_TO_BUILD=“ALL”, the test fails. In both cases, NO -DLLVM_ENABLE_RUNTIMES=“openmp” is specified in the cmake command

Any clues of the reason?

The error message:

Exit Code: 1
Command Output (stderr):

Hi Kelvin,

If only building with target PPC, this case will not be run because clang cannot process CUDA code.
I think it’s related to our recent change that the bitcode library is required when building OpenMP program so I updated the driver. However it passed the test before (locally and on Phab). I’ll try to reproduce and fix it accordingly.

Regards,
Shilei

The REQUIRES lines at the top of the file specify, that all targets need
to be available so that the test is supported.

To fulfill the dependency with the bitcode library, this should be added
as another REQUIREment of the test.

I assume that phabricator and your local test builds include building
the OpenMP runtime/project?

- Joachim

It’s clang driver test, so it doesn’t need to have OpenMP enabled. On Phab, IIRC, by default it’s ALL. I did remember I updated the patch because of the driver case, and later it all passed.

Regards,
Shilei

The test complains, that libomptarget-nvptx-sm_60.bc cannot be found.
How should it be found, if libomptarget is not built?

- Joachim

There is dummy file in clang/test/Driver/Inputs/libomptarget. It also has multiple dummy CUDAs. For this specific case, it should not raise the error because passing -S should only contain preprocess and compilation.

Regards,
Shilei

One more data point. I repeated the builds on the x86 platform. With LLVM_TARGETS_TO_BUILD=“X86”, the test is “UNSUPPORTED” (as expected). With LLVM_TARGETS_TO_BUILD=“ALL”, the test actually ran and passed.

Thanks,
Kelvin

I guess your X86 platform doesn’t have CUDA installed. This issue will not be exposed if the system doesn’t have CUDA. I’ll submit a patch.

Regards,
Shilei

Hi Shilei,

Yes. The x86 does not have CUDA installed.

Thanks a lot.

Kelvin