<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [r600g-evergreen][compute]Empty kernel execution causes crash"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=82671">82671</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>[r600g-evergreen][compute]Empty kernel execution causes crash
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>damien.hilloulin@supelec.fr
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

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

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

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=104687" name="attach_104687" title="Bug repro program source file">attachment 104687</a> <a href="attachment.cgi?id=104687&action=edit" title="Bug repro program source file">[details]</a></span>
Bug repro program source file

I gave a shot to opencl support on my evergreen card (cedar) with mesa git.
I noticed that with an empty kernel the program crash with:
evergreen_state.c:1827:evergreen_emit_vertex_buffers: Assertion `rbuffer'
failed.

I made a little debugging and I think that this is du to a bug in
evergreen_init_compute_state_functions from evergreen_compute.c .

The two concerned lines are

/* We always use at least one vertex buffer for parameters (id = 1)*/
ctx->cs_vertex_buffer_state.enabled_mask =
ctx->cs_vertex_buffer_state.dirty_mask = 0x2;

With an empty kernel there is in fact no vertex buffer used as far as I can
see.

By changing the two lines to
ctx->cs_vertex_buffer_state.enabled_mask =
ctx->cs_vertex_buffer_state.dirty_mask = 0x0;

It doesn't crash for me anymore.
However I am a total driver development noob so my interpretation (and
therefore fix) can be wrong.

You can find attacted the very small program to be able to cause the crash.</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>