Bug 86974 - INTEL_DEBUG=shader_time always asserts in fs_generator::generate_code() when Mesa is built with --enable-debug (= with asserts)
Summary: INTEL_DEBUG=shader_time always asserts in fs_generator::generate_code() when ...
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Matt Turner
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-03 13:33 UTC by Eero Tamminen
Modified: 2015-03-10 16:48 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Gdb output on the assert (41.84 KB, text/plain)
2014-12-03 13:33 UTC, Eero Tamminen
Details
Gdb output of "shader_time" crash when not using "--enable-debug" asserts (7.92 KB, text/plain)
2014-12-03 15:31 UTC, Eero Tamminen
Details
Gdb output on second assert (5.17 KB, text/plain)
2014-12-12 16:01 UTC, Eero Tamminen
Details

Description Eero Tamminen 2014-12-03 13:33:51 UTC
Created attachment 110411 [details]
Gdb output on the assert

Setup:
- HSW GT3e
- Ubuntu 14.10
- Latest Mesa (ef7e0b39a24966526b102643523feac765771842),
  built with --enable-debug

Steps:
- export following environment variable:
  INTEL_DEBUG=shader_time
- run Witcher2 with above env variable and latest Mesa

Result:
- Game crashes to an assert

More info:
- Crash happens only with "shader_time".
- If Mesa isn't compiled with --enable-debug, one needs to select "Arena" from the game main menu and only then it will crash

---------------
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorageMultisample(samples)
glCreateShader is no-op
glShaderSource is no-op
glCompileShader is no-op
glCreateShader is no-op
...
glCreateShader is no-op
glShaderSource is no-op
glCompileShader is no-op
witcher2: ../../../../../../src/mesa/drivers/dri/i965/brw_fs_generator.cpp:1567: int fs_generator::generate_code(const cfg_t*, int): Assertion `inst->force_writemask_all' failed.
---------------

Gdb output is attached.
Comment 1 Eero Tamminen 2014-12-03 14:07:38 UTC
Correction: "--enable-debug" didn't affect this.  Crash happening later was with older version of Mesa.
Comment 2 Eero Tamminen 2014-12-03 15:31:31 UTC
Created attachment 110413 [details]
Gdb output of "shader_time" crash when not using "--enable-debug" asserts

(disregard previous comment, I did incomplete build)

From the Gdb output one can see that without "--enable-debug" asserts, Mesa with "shader_time" does past-the-array-end access, tries to access data through invalid pointer it got that way, and crashes.

Valgrind doesn't work with Witcher2, so I couldn't get info on whether something goes wrong already earlier.
Comment 3 Eero Tamminen 2014-12-08 10:36:25 UTC
The assert actually happens with everything, even glxgears.

With asserts disable, so far I've seen crash only with Witcher2.  Should I file separate bug for that?
Comment 4 Matt Turner 2014-12-09 05:29:58 UTC
This is fixed by my

[RFC 6/9] i965/fs: Remove force_writemask_all assertion for execsize < 8.

patch from Oct 31.

It's part of an RFC series, but it could go in separately. The only thing that makes me hesitate is that I don't know how the execution mask works exactly for instructions with execution size < shader dispatch width.
Comment 5 Eero Tamminen 2014-12-12 16:01:47 UTC
Created attachment 110789 [details]
Gdb output on second assert

(In reply to Matt Turner from comment #4)
> This is fixed by my
>   [RFC 6/9] i965/fs: Remove force_writemask_all assertion for execsize < 8.
> patch from Oct 31.
> 
> It's part of an RFC series, but it could go in separately. The only thing
> that makes me hesitate is that I don't know how the execution mask works
> exactly for instructions with execution size < shader dispatch width.

If I remove that assert, the next assert the game hits with "shader_time" is this:
witcher2: ../../../../../../src/mesa/drivers/dri/i965/brw_eu_emit.c:285: validate_reg: Assertion `hstride == 0' failed.
Comment 6 Eero Tamminen 2014-12-12 16:13:45 UTC
And the second assert with "shader_time" actually happens also with everything, even glxgears.

A test patch that fixes / works around at least the asserts that get triggered with every GL program would be appreciated, so that I can check whether there's some further Witcher2 specific assert.
Comment 7 Matt Turner 2014-12-12 18:27:35 UTC
Okay, I'll take a look.
Comment 8 Matt Turner 2015-02-18 05:34:52 UTC
Should be fixed by

commit 0d8f27eab7b7e8b7a16e76aabd3f6a0ab4880497
Author: Matt Turner <mattst88@gmail.com>
Date:   Sun Oct 26 22:10:53 2014 -0700

    i965/fs: Remove force_writemask_all assertion for execsize < 8.
Comment 9 Eero Tamminen 2015-02-19 10:28:44 UTC
(In reply to Matt Turner from comment #8)
>     i965/fs: Remove force_writemask_all assertion for execsize < 8.

This fixes only the first assert, not the next one which is also triggered by all programs, including glxgears:

glxgears: ../../../../../../src/mesa/drivers/dri/i965/brw_eu_emit.c:285: validate_reg: Assertion `hstride == 0' failed.

See the Gdb output I attached few months ago.
Comment 10 Kenneth Graunke 2015-03-09 23:13:46 UTC
Fixed by these:

commit ef9cc7d0c176669c03130abf576f2b700be39514
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Mar 7 23:01:07 2015 -0800

    i965/fs: Set force_writemask_all on shader_time instructions.

commit f1adc45dbe649cdd4538fb96f6d2a27328bbfba1
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sun Mar 8 00:13:41 2015 -0800

    i965/fs: Set smear on shader_time diff register.
Comment 11 Kenneth Graunke 2015-03-09 23:14:55 UTC
Note that shader_time is still producing bogus VS values.  You need to revert 15f6118b77cbe42fb997174715bce4c2548aa1f1 then revert 5df88c2096281f416b2738debac1c4c329e29673 for now.  Matt's looking into that.

The FS code appears to be working.
Comment 12 Eero Tamminen 2015-03-10 16:48:03 UTC
The programs I tested worked -> verified.

Witcher2 game I couldn't test as its latest version crashes both with latest Mesa and Ubuntu 14.10 Mesa version for some reason, even without shader_time (don't have now time to look more into that).

Could you or Matt comment in this bug when the VS shader_time fixes go upstream?


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.