<html>
    <head>
      <base href="https://bugs.freedesktop.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 - [radeonsi][hawaii] Borderlands 2 rendering issues with recent mesa/llvm"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101651">101651</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[radeonsi][hawaii] Borderlands 2 rendering issues with recent mesa/llvm
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/Gallium/radeonsi
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ptpzz@yandex.ru
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=132354" name="attach_132354" title="screenshot (wrong rendering)">attachment 132354</a> <a href="attachment.cgi?id=132354&action=edit" title="screenshot (wrong rendering)">[details]</a></span>
screenshot (wrong rendering)

AFAICS it's related to the VCCZ bug. There is a workaround for SI/CIK in the
AMDGPU LLVM backend (SIInsertWaitcnts.cpp) but it doesn't handle this case.

The attached patch fixes it for me by relaxing the workaround condition, but
probably it can be improved if there is a detailed info on that bug. OTOH I
guess it won't have a noticeable effect on performance anyway, so maybe it's
safer to use the patch as is.

The issue is reproducible with the reduced OpenCL test in the attachment:

  $ make

  // run on cpu - reference result

  $ ./testcpu
  117

  // OpenCL/gpu - wrong result

  $ LD_PRELOAD=/opt/llvm64_master/lib/libLLVM-5.0svn.so ./testgpu
  99

  // OpenCL/gpu + patch - correct result

  $ LD_PRELOAD=/opt/llvm64_patched/lib/libLLVM-5.0svn.so ./testgpu
  117</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>