llvm / llvm-project

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

[OpenMP] libomptarget Segmentation fault #54731

Closed ye-luo closed 1 year ago

ye-luo commented 2 years ago

Reproducer https://github.com/ye-luo/miniqmc testing commit 2f7f17fefb9f38719ecbfe36fb8b47c8a5392c5d

cmake -DCMAKE_CXX_COMPILER=/soft/compilers/llvm/main-20220329/bin/clang++ -DENABLE_OFFLOAD=ON -DUSE_OBJECT_TARGET=ON -DOFFLOAD_ARCH=sm_80 -DQMC_MIXED_PRECISION=ON ..
make -j32 miniqmc_sync_move
OMP_NUM_THREADS=32 ./bin/miniqmc_sync_move

The failure is sporadic indicating a race.

My 20220328 build e619c07d168dff1d27f90cef84222a68064c35ea always pass the run. 20220329 build 1fe4b968c5fad5959ab9d371cc3324d9c7062eb3 starts to see the failure.

Thread 28 "miniqmc_sync_mo" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff497f4780 (LWP 5758)]
0x00007ffff0b8749c in targetDataEnd(ident_t*, DeviceTy&, int, void**, void**, long*, long*, void**, void**, AsyncInfoTy&, bool) ()
   from /soft/compilers/llvm/main-20220329/lib/libomptarget.so
(gdb) bt
#0  0x00007ffff0b8749c in targetDataEnd(ident_t*, DeviceTy&, int, void**, void**, long*, long*, void**, void**, AsyncInfoTy&, bool) ()
   from /soft/compilers/llvm/main-20220329/lib/libomptarget.so
#1  0x00007ffff0b8b650 in target(ident_t*, DeviceTy&, void*, int, void**, void**, long*, long*, void**, void**, int, int, int, AsyncInfoTy&) () from /soft/compilers/llvm/main-20220329/lib/libomptarget.so
#2  0x00007ffff0b81998 in __tgt_target_teams_mapper () from /soft/compilers/llvm/main-20220329/lib/libomptarget.so
#3  0x0000000000457add in qmcplusplus::DistanceTableBA<float, 3u, 39>::evaluate(qmcplusplus::ParticleSet&) ()
#4  0x000000000044da90 in qmcplusplus::VirtualParticleSet::makeMoves(int, qmcplusplus::ParticleAttrib<qmcplusplus::TinyVector<float, 3u>, std::allocator<qmcplusplus::TinyVector<float, 3u> > > const&, bool, int) ()
#5  0x000000000040d283 in qmcplusplus::NonLocalPP<float>::evaluate(qmcplusplus::ParticleSet const&, qmcplusplus::WaveFunction&) ()
#6  0x000000000040a58e in omp_outlined. ()
#7  0x00007ffff0e54493 in __kmp_invoke_microtask () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#8  0x00007ffff0dd6479 in __kmp_fork_call () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#9  0x00007ffff0dc6be5 in __kmpc_fork_call () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#10 0x000000000040a1a2 in omp_outlined. ()
#11 0x00007ffff0e54493 in __kmp_invoke_microtask () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#12 0x00007ffff0ddb877 in __kmp_invoke_task_func () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#13 0x00007ffff0dda81d in __kmp_launch_thread () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#14 0x00007ffff0e34b3d in __kmp_launch_worker(void*) () from /soft/compilers/llvm/main-20220329/lib/libomp.so
#15 0x00007ffff07416ea in start_thread () from /lib64/libpthread.so.0
#16 0x00007ffff0459a8f in clone () from /lib64/libc.so.6
llvmbot commented 2 years ago

@llvm/issue-subscribers-bug

llvmbot commented 2 years ago

@llvm/issue-subscribers-openmp

shiltian commented 1 year ago

Is it still an issue?

ye-luo commented 1 year ago

I think https://reviews.llvm.org/D132676 (not merged yet) fixes the issue.

shiltian commented 1 year ago

It's merged now. Could you please take a quick test to see if it gets fixed? Thanks.

ye-luo commented 1 year ago

Should be fixed now.