llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.71k stars 11.87k forks source link

[offload] [test-suite] 19.1.1 Bug in the test-suite for the offload runtime #112210

Open Crivella opened 1 week ago

Crivella commented 1 week ago

When running the test-suite after a 3 stage build, if the offload runtime is enabled (tested with host offloading only), all test related to offloading fails with error of the type described in:

I am unsure if I am doing something wrong in my build setup, but in case this is an actual bug, I was able to fix it by applying the patch in:

Description of the changes:

llvmbot commented 1 week ago

@llvm/issue-subscribers-offload

Author: Davide Grassano (Crivella)

When running the test-suite after a 3 stage build, if the `offload` runtime is enabled (tested with host offloading only), all test related to offloading fails with error of the type described in: - https://github.com/easybuilders/easybuild-easyblocks/pull/3373#issuecomment-2404623211 - https://github.com/llvm/llvm-project/issues/90333 I am unsure if I am doing something wrong in my build setup, but in case this is an actual bug, I was able to fix it by applying the patch in: - https://github.com/easybuilders/easybuild-easyconfigs/blob/21f9b19ccb38095ee41dffdc5528f5db492a7eca/easybuild/easyconfigs/l/LLVM/LLVM-19.1.1_libomptarget_tests.patch Description of the changes: - offload/CMakeLists.txt: Required to add `-fopenmp` to the `test_openmp_flags` in the respective `lit.cfg` file - offload/test/lit.cfg: Required to add the correct include path to: - the `omp.h` header as `omp_header_directory` (`LIBOMPTARGET_OPENMP_HEADER_FOLDER`) are not being set - This should probably be solved in the `CMakeLists.txt` but I am not sure if it is as straightforward as copying the old lines from `openmp/runtime` as I assume `CMAKE_CURRENT_BINARY_DIR` is not gonna be the same when run from the `offload` dir. - Use the correct target: the offload tests will set the target to `x86_64-pc-linux-gnu` even if the default target for the clang compilation is `x86_64-unknown-linux-gnu`. If the correct target is not set the tests will fail for not finding the `clang_rt.builtins.a` file ``` ld.lld: error: cannot open /home/crivella/.local/easybuild/build/LLVM/19.1.1/system-system/llvm.obj.3/lib/clang/19/lib/x86_64-pc-linux-gnu/libclang_rt.builtins.a: No such file or directory ``` - I am unsure if the way this is implemented would be able to catch all triples provided by [config.guess](https://github.com/llvm/llvm-project/blob/main/llvm/cmake/config.guess) beyond the x86_64 archs. - offload/test/lit.site.cfg.in: Same as last point in order to pass `config.host_triple` to the `lit.cfg` file in order to check the currently set host triple vs the tested openmp_target