<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60937>60937</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP] invalid access when offload to amdgpu
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            jdoerfert
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ye-luo
      </td>
    </tr>
</table>

<pre>
    Use this branch https://github.com/ye-luo/miniqmc/tree/amd-invalid-access
```
mkdir build_mi250_llvm_offload_real; cd build_mi250_llvm_offload_real
cmake -DCMAKE_CXX_COMPILER=clang++ -DENABLE_OFFLOAD=ON -DOFFLOAD_TARGET=amdgcn-amdhsa -DOFFLOAD_ARCH=gfx90a ..
make -j32 check_spo_batched_reduction
./bin/check_spo_batched_reduction -n 1 -s 1 -w 2
```
Error
```
AMDGPU fatal error 1: Memory access fault by GPU 2 (agent 0x5616e63e14c0) at virtual address 0x7f9f19c55000. Reasons: Unknown (0)
Aborted
```
Please ignore the following message when using the reproducer.
```
Fail in evaluate_vgh, V error =0.294828
Fail in evaluate_vgh, G error =1.1027
```
```
clang++ -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 3a3ab2147d7a6673c7b22bd14d8bf33ab1276d85)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVF1v5CYU_TXMy5UtDP6aBz9M4nFaNdmJok21bxYGbJNgmAKeSf595Ym7u61GqVayjC6cezlcDod5rwYjZYWyG0TIi7DS9dIFRAjK6g2bw2hd9S4jPdtNZ8V79ewlhFF56BwzfIQxhKNHdIdIg0gzqDDOXczthEjzkYZIMymj_po4Ik1wUiLSsElEypyYViJinEvvEa4R3qEcr98lnF6FctDNSot2UiTDrdanqbV9ry0TrZNMI3oDXPwP5lKMT-xVQlTfPuz-2Le33761t4eHx9_v90-I1lwzMyByg8gNRPX-y-7mft8emub-sKsRrQ9fIKrXsP26e7rbf0W0ZpMYuInYJEbPfgLsnm5_Q7Qe-rctZhDH62Eu279QAnyU_LX1R9t2LPBRLizFzIOy5gMaI9J0yiDSfAKFyEACkV9-ZyBXG7h3zrqrK7uH-u7xGXoWmAa5wCBBdAcPcrLuHT4uBXo26wDdOyxYAoiUbJAmAH7L8iSXOZVJyjEiW2ABTsqFmWlgQrglGb8V_bZPtjzLMMYxPEnmrVm0As_m1dizWQou2SulzrogxVW6j1oyL0ENxrpFfxJ6q7U9KzPAJL1ng4TzKA3MfplaAE4enRUzly6-WrJhSoMyIE9MzyzI9jSMiNzCn2s7EK1xTLZpScrPE-5-JCRxgklxdbv_hP8S3OmnOThJ55frTYoYx3hp0SdPbNH6OkRHZ18kD_GgAlBGWUeStBAFy_OC8qIjpBNJKsqup5R1CSlyUWbfm_-d3kZUVGzplm1kleRFkZC8TIvNWGWiLLOSyjLNOtEVRSoIEz3BPE0zTkW3URXBhGJCKE5piou4wBgnpRDJNi8JLTKUYjkxpeOFbmzdsFHez7LK8ZYWG806qf1qREae4bK4GpGrLkfs5sGjFGvlg_9RJaigLw52OErz8IiyGlZz-UfHF2mslgDBwvJyj_Nmdrr6teYi0lxoeUSaC-2_AwAA__9bJJlI">