Bug 82671 - [r600g-evergreen][compute]Empty kernel execution causes crash
Summary: [r600g-evergreen][compute]Empty kernel execution causes crash
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: All Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
Depends on:
Reported: 2014-08-15 17:57 UTC by Damien Hilloulin
Modified: 2014-08-21 14:08 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Bug repro program source file (1.40 KB, text/plain)
2014-08-15 17:57 UTC, Damien Hilloulin
Fix (1.35 KB, patch)
2014-08-19 23:34 UTC, Tom Stellard
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Damien Hilloulin 2014-08-15 17:57:43 UTC
Created attachment 104687 [details]
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.
Comment 1 Tom Stellard 2014-08-19 23:34:15 UTC
Created attachment 104927 [details] [review]

Can you try this patch?
Comment 2 Damien Hilloulin 2014-08-20 15:31:31 UTC
Fix the bug for me :)

Thank you for giving a look at this bug!
Comment 3 Tom Stellard 2014-08-21 14:08:47 UTC
Fixed in git commit commit bf7a60f41d897be4d9804ba7c46633e38501ffe7

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.