<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126342>126342</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
when offloading nested structs, sometimes "PluginInterface" error: Failure to synchronize stream (nil): Error in cuStreamSynchronize: an illegal memory access was encountered happens
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bschulz81
</td>
</tr>
</table>
<pre>
The following code has no memory problems. Upon investigating, it seems not to offload dQ and dR correctly in the function qr_decomposition in line 3792 which calls
create_in_struct(dA);
create_out_struct(dQ);
create_out_struct(dR);
that do the mappings with
template<typename T>
void inline create_in_struct(const datastruct<T>& dA)
{
#pragma omp target enter data map(to: dA,dA.pdata[0:dA.pdatalength],dA.pextents[0:dA.prank],dA.pstrides[0:dA.prank])
}
template<typename T>
void inline create_out_struct(datastruct<T>& dA)
{
#pragma omp target enter data map(to: dA) map(alloc: dA.pdata[0:dA.pdatalength]) map(to:dA.pextents[0:dA.prank],dA.pstrides[0:dA.prank])
}
template<typename T>
and then calls
gpu_qr_decomposition.
If one removes the lines 1863 -1997 in gpu_qr_decomposition, especially these lines:
#pragma omp parallel for
for (size_t i=0; i<Q.pdatalength; i++)
{
Q.pdata[i]=0;
}
//
//
#pragma omp parallel for
for (size_t i=0; i<R.pdatalength; i++)
{
R.pdata[i]=0;
}
then the code suddenly compiles...
The strange problem is that before, similar code is called for a cholesky and an lu decomposition.
here, the code works provided i compile it without optimization.
if i compile the code with -O2, then clang takes veeeeeeerry long to finish, and for the result, the lu decomposition crashes too...
There is no problem with the array sizes, as I have checked these, and these are just test cases with 9 elements (3x3 matrix).
[main_acc.cpp.txt](https://github.com/user-attachments/files/18716923/main_acc.cpp.txt)
[mdspan_acc.h.txt](https://github.com/user-attachments/files/18716924/mdspan_acc.h.txt)
[CMakeLists.txt](https://github.com/user-attachments/files/18716925/CMak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