Issue 65237
Summary [OpenMP] crashing in libomptarget
Labels new issue
Assignees
Reporter ye-luo
    My llvm recipe
```
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_INSTALL_PREFIX=/soft/llvm/main-patched \
 -DLLVM_ENABLE_BACKTRACES=ON \
    -DLLVM_ENABLE_WERROR=OFF \
 -DBUILD_SHARED_LIBS=OFF \
    -DLLVM_ENABLE_RTTI=ON \
 -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;NVPTX" \
 -DLLVM_ENABLE_ASSERTIONS=ON \
 -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld" \
 -DLIBOMPTARGET_ENABLE_DEBUG=ON \
    ../llvm-project/llvm
```
then build openmp using gcc (tested gcc9-12). The issue is not reproducible if openmp is built with clang.
```
cmake -DCMAKE_C_COMPILER=/soft/llvm/main-patched/bin/clang \
 -DCMAKE_CXX_COMPILER=/soft/llvm/main-patched/bin/clang++ \
 -DLLVM_ROOT=/soft/llvm/main-patched -DLIBOMPTARGET_ENABLE_DEBUG=ON \
 -DCMAKE_INSTALL_PREFIX=/soft/llvm/main-patched ../llvm-project/openmp
```

Using this repdrodcer https://github.com/ye-luo/openmp-target/blob/master/tests/target_task/target_update_nowait_taskwait.cpp
```
clang++ -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu -O3 target_nowait_taskwait.cpp && ./a.out
clang++ -fopenmp --offload-arch=gfx906 -O3 target_nowait_taskwait.cpp && ./a.out
clang++ -fopenmp --offload-arch=sm_86 -O3 target_nowait_taskwait.cpp && ./a.out
```
I got `Segmentation fault` or `illegal instruction` depending on the OS. It fails on SLES SP4 and Ubuntu 20.04 and 22.04.

Even if I built openmp with debugging flags. I still got `??` in the backtrace.
```
#1 0x00007ffff7b39ed8 in ?? () from /soft/llvm/main-patched/lib/libomptarget.so.18git
#2  0x00007ffff7b3c4a0 in ?? () from /soft/llvm/main-patched/lib/libomptarget.so.18git
#3 0x0000000000000000 in ?? ()
```
I also noticed changing `-O3` to `-O0` makes the test run.
So I'm wondering if there is some potential bug in the tasking runtime as the segfault happens when running the `update from nowait` target task.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to