<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - OpenMP target offload and Python regression because of exit handler order change"
href="https://bugs.llvm.org/show_bug.cgi?id=44933">44933</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>OpenMP target offload and Python regression because of exit handler order change
</td>
</tr>
<tr>
<th>Product</th>
<td>OpenMP
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Runtime Library
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>csdaley@lbl.gov
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following simple program segfaults with 10.0.0-rc2. I am running on a
system with Skylake CPUs and NVIDIA V100 GPUs.
+ cat demo.c
int cfunc(void)
{
#pragma omp target
{
;
}
return 123;
}
+ cat main.py
#!/usr/bin/env python
from ctypes import *
libdemo = CDLL("./libdemo.so")
rtn = libdemo.cfunc()
print "rtn value: ", rtn
+ clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -fPIC -shared -o
libdemo.so demo.c
+ srun -n 1 ./main.py
rtn value: 123
python:
/tmp/llvm-build.0qdn7s/llvm-project/openmp/libomptarget/src/rtl.cpp:339: void
RTLsTy::UnregisterLib(__tgt_bin_desc*): Assertion `R->isUsed && "Expecting used
RTLs."' failed.
srun: error: cgpu01: task 0: Aborted
This program works with LLVM/Clang trunk from Aug 28 2019. GDB shows that the
Python and LLVM OpenMP library exit handlers are now called in a different
order. Based on my installations of LLVM/Clang, I can tell that the change in
behavior happened sometime between Aug 28 2019 and Nov 09 2019.
10.0.0-rc2:
Thread 1 "python" hit Breakpoint 1, 0x00002aaaaaabb0e4 in _dl_fini () from
/lib64/ld-linux-x86-64.so.2
#0 0x00002aaaaaabb0e4 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#1 0x00002aaaab36cd78 in __run_exit_handlers () from /lib64/libc.so.6
#2 0x00002aaaab36cdca in exit () from /lib64/libc.so.6
#3 0x00002aaaab354f91 in __libc_start_main () from /lib64/libc.so.6
Thread 1 "python" hit Breakpoint 2, 0x00002aaaac9709f0 in
RTLsTy::UnregisterLib(__tgt_bin_desc*) () from
/project/projectdirs/m1759/csdaley/software/cgpu/llvm/10.0.0-rc2/lib/libomptarget.so
#0 0x00002aaaac9709f0 in RTLsTy::UnregisterLib(__tgt_bin_desc*) () from
/project/projectdirs/m1759/csdaley/software/cgpu/llvm/10.0.0-rc2/lib/libomptarget.so
#1 0x00002aaaac46089d in .omp_offloading.descriptor_unreg () from ./libdemo.so
#2 0x00002aaaaaabb2b3 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#3 0x00002aaaab36cd78 in __run_exit_handlers () from /lib64/libc.so.6
#4 0x00002aaaab36cdca in exit () from /lib64/libc.so.6
#5 0x00002aaaab354f91 in __libc_start_main () from /lib64/libc.so.6
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
10.0.0 trunk from Aug 28:
Thread 1 "python" hit Breakpoint 2, 0x00002aaaac967c90 in
RTLsTy::UnregisterLib(__tgt_bin_desc*) () from
/usr/common/software/llvm/10.0.0-git_20190828/lib/libomptarget.so
#0 0x00002aaaac967c90 in RTLsTy::UnregisterLib(__tgt_bin_desc*) () from
/usr/common/software/llvm/10.0.0-git_20190828/lib/libomptarget.so
#1 0x00002aaaac460848 in .omp_offloading.descriptor_unreg () from ./libdemo.so
#2 0x00002aaaab36cd78 in __run_exit_handlers () from /lib64/libc.so.6
#3 0x00002aaaab36cdca in exit () from /lib64/libc.so.6
#4 0x00002aaaab354f91 in __libc_start_main () from /lib64/libc.so.6
[Thread 0x2aaab6210700 (LWP 70842) exited]
Thread 1 "python" hit Breakpoint 1, 0x00002aaaaaabb0e4 in _dl_fini () from
/lib64/ld-linux-x86-64.so.2
#0 0x00002aaaaaabb0e4 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
#1 0x00002aaaab36cd78 in __run_exit_handlers () from /lib64/libc.so.6
#2 0x00002aaaab36cdca in exit () from /lib64/libc.so.6
#3 0x00002aaaab354f91 in __libc_start_main () from /lib64/libc.so.6
[Thread 0x2aaab600f700 (LWP 70841) exited]
[Inferior 1 (process 70825) exited normally]
The error does not happen if we compile demo.c without -fopenmp
-fopenmp-targets=nvptx64-nvidia-cuda compilation options.
Thanks,
Chris</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>