<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61992>61992</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
libomptarget.so.15`target OpenMP device offload Assertion '__n < this->size()' failed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
burlen
</td>
</tr>
</table>
<pre>
With llvm project updated Apr 8 2023 on a system with NVIDIA QuadroRTX 4000 GPU (compute 7.5). I'm using CUDA 12 because that's the only version nvidia provide for my OS (Fedora 37).
```
clang version 17.0.0 (https://github.com/llvm/llvm-project.git b206cde3504c0078469f02bd74aeb5eb5ab875f5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bloring/work/llvm/llvm-install/bin
```
The following code crashes inside of the target region inside openmp itself.
```C++
#include <stdio.h>
#include <omp.h>
int main()
{
int num_devices = omp_get_num_devices();
printf("Number of available devices %d\n", num_devices);
#pragma omp target
{
if (omp_is_initial_device()) {
printf("Running on host\n");
} else {
int nteams= omp_get_num_teams();
int nthreads= omp_get_num_threads();
printf("Running on device with %d teams in total and %d threads in each team\n",nteams,nthreads);
}
}
return 0;
}
```
Full output of compilation, run, crash, and stack.
```
smic:/work/SENSEI/omp_do$clang++ -g -stdlib=libstdc++ -fopenmp -fopenmp-targets=nvptx64 -Xopenmp-target=nvptx64 --offload-arch=sm_75 test.cpp
clang++: warning: CUDA version is newer than the latest partially supported version 11.8 [-Wunknown-cuda-version]
clang: warning: CUDA version is newer than the latest partially supported version 11.8 [-Wunknown-cuda-version]
smic:/work/SENSEI/omp_do$./a.out
Number of available devices 1
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1123: std::vector::reference std::vector<void *>::operator[](std::vector::size_type) [_Tp = void *, _Alloc = std::allocator<void *>]: Assertion '__n < this->size()' failed.
Aborted (core dumped)
smic:/work/SENSEI/omp_do$lldb ./a.out
(lldb) target create "./a.out"
Current executable set to '/work/SENSEI/omp_do/a.out' (x86_64).
(lldb) run
Process 1339982 launched: '/work/SENSEI/omp_do/a.out' (x86_64)
Number of available devices 1
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1123: std::vector::reference std::vector<void *>::operator[](std::vector::size_type) [_Tp = void *, _Alloc = std::allocator<void *>]: Assertion '__n < this->size()' failed.
Process 1339982 stopped
* thread #1, name = 'a.out', stop reason = signal SIGABRT
frame #0: 0x00007ffff7998e5c libc.so.6`__pthread_kill_implementation + 268
libc.so.6`__pthread_kill_implementation:
-> 0x7ffff7998e5c <+268>: movl %eax, %ebp
0x7ffff7998e5e <+270>: negl %ebp
0x7ffff7998e60 <+272>: cmpl $0xfffff000, %eax ; imm = 0xFFFFF000
0x7ffff7998e65 <+277>: movl $0x0, %eax
(lldb) bt
* thread #1, name = 'a.out', stop reason = signal SIGABRT
* frame #0: 0x00007ffff7998e5c libc.so.6`__pthread_kill_implementation + 268
frame #1: 0x00007ffff7948a76 libc.so.6`raise + 22
frame #2: 0x00007ffff79327fc libc.so.6`abort + 215
frame #3: 0x00007ffff7cd7e80 libstdc++.so.6`std::__glibcxx_assert_fail(char const*, int, char const*, char const*) + 96
frame #4: 0x00007ffff7eaca0d libomptarget.so.15`target(ident_t*, DeviceTy&, void*, int, void**, void**, long*, long*, void**, void**, int, int, unsigned long, int, AsyncInfoTy&) + 5933
frame #5: 0x00007ffff7ea929f libomptarget.so.15`__tgt_target_kernel + 591
frame #6: 0x00005555555552cc a.out`main at test.cpp:6:3
frame #7: 0x00007ffff7933510 libc.so.6`__libc_start_call_main + 128
frame #8: 0x00007ffff79335c9 libc.so.6`__libc_start_main@@GLIBC_2.34 + 137
frame #9: 0x0000555555555135 a.out`_start + 37
(lldb)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWEtv4zjy_zTMpWCDpqyH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