<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 - Incorrect data sharing analysis leads to kernel crash"
   href="https://bugs.llvm.org/show_bug.cgi?id=52109">52109</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect data sharing analysis leads to kernel crash
          </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>All
          </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>Clang Compiler Support
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>xjin@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://godbolt.org/z/4o7fbPbYW">https://godbolt.org/z/4o7fbPbYW</a>

First, the compiler finds data sharing, which is incorrect.  There's no sharing
of these stack variables.

example.cpp:820:62: remark: Found thread data sharing on the GPU. Expect
degraded performance due to data globalization. [OMP112]
[-Rpass-missed=openmp-opt]
                ColorSpinor<typename Arg::realIn, Arg::nColor, Arg::nSpin> in =
arg.in(x_cb, (parity+arg.inParity)&1);
                                                                           ^
example.cpp:821:63: remark: Found thread data sharing on the GPU. Expect
degraded performance due to data globalization. [OMP112]
[-Rpass-missed=openmp-opt]
                ColorSpinor<typename Arg::realOut, Arg::nColor, Arg::nSpin>
out;
                                                                            ^
example.cpp:665:8: remark: Found thread data sharing on the GPU. Expect
degraded performance due to data globalization. [OMP112]
[-Rpass-missed=openmp-opt]
                real v[length];
                     ^
example.cpp:682:8: remark: Found thread data sharing on the GPU. Expect
degraded performance due to data globalization. [OMP112]
[-Rpass-missed=openmp-opt]
                real v[length];
                     ^

Second, the generated code crashes in kernels, with

CUDA error: an illegal memory access was encountered

Close inspections (debug by commenting out code) show that some of the accesses
to the above variables caused the illegal memory access.</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>