Bug 93840 - [i965] Alien: Isolation fails with GL_ARB_compute_shader enabled
Summary: [i965] Alien: Isolation fails with GL_ARB_compute_shader enabled
Status: NEW
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-24 15:55 UTC by Darius Spitznagel
Modified: 2016-09-01 19:11 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Alien: Isolation GDB log (226.78 KB, text/plain)
2016-02-14 14:00 UTC, Darius Spitznagel
Details
[PATCH] i965/fs: Allow spilling for SIMD16 compute shaders (2.88 KB, patch)
2016-02-22 20:31 UTC, Jordan Justen
Details | Splinter Review
Alien: Isolation GDB log with applied patch (224.97 KB, text/plain)
2016-02-24 21:18 UTC, Darius Spitznagel
Details
patch (1.60 KB, patch)
2016-08-30 19:35 UTC, Matt Turner
Details | Splinter Review
AI shaders (deleted)
2016-08-31 19:39 UTC, Darius Spitznagel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darius Spitznagel 2016-01-24 15:55:50 UTC
I tested this game with my Iris Pro 5200 (i965) and mesa master as GL_ARB_compute_shader for Intel is ready there.

But the game quits right before the 20th Century Fox video should play.
When I disable compute_shader (MESA_EXTENSION_OVERRIDE=-GL_ARB_compute_shader) I can get into the game but all I see are the legs from Ripley, the rest is totally dark. Switching SSAO doesn't help.

I also did an apitrace with disabled compute_shader and can confirm, that the game requests compute_shader right before the start of the 20th Century Fox video.

I have posted this issue also here...
https://bugs.freedesktop.org/show_bug.cgi?id=93144
But as suggested by Alexandre Demers I created a new report for i965.

Maybe the game also needs GL_ARB_stencil_texturing which is ready for Intel gen8 GPUs but not gen7 (like mine).
I write this because Shadow of Mordor also uses compute_shader but this games works great on Intel gen7 and mesa master.
Comment 1 Darius Spitznagel 2016-02-14 14:00:01 UTC
Created attachment 121746 [details]
Alien: Isolation GDB log
Comment 2 Darius Spitznagel 2016-02-14 14:01:26 UTC
I have create a backtrace with gdb.
Hope I did it right and it helps.
On every stop I did "bt" and "bt full" then "cont" until the program terminated.

Debugging Symbols installed:
libgbm1-dbg
libgl1-mesa-dri-dbg
libgl1-mesa-glx-dbg
libglapi-mesa-dbg

Environment:
export MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430

Mesa:
darius@pc1:~$ glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0-devel (git-a4cff18)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 11.2.0-devel (git-a4cff18)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.2.0-devel (git-a4cff18)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
Comment 3 Darius Spitznagel 2016-02-19 23:57:45 UTC
Hello devs,

common guys,
I know you all (also me) have plenty do do, but I wish that someone could have a look into this.
I think if more games (apps) run on foss drivers, the better for all.
I really like to help you how much I can, but without any answer my hands are bound.

Kind regards
Darius
Comment 4 Jordan Justen 2016-02-22 20:31:41 UTC
Created attachment 121900 [details] [review]
[PATCH] i965/fs: Allow spilling for SIMD16 compute shaders

Does the attached patch help with the crash?

Note, the one compute shader program I looked at took
about 20 seconds to generate a program for, so startup
may take a while.

Additionally it had a fair amount of register spilling,
and therefore the performance may not be very good.
Comment 5 Darius Spitznagel 2016-02-24 17:09:29 UTC
(In reply to Jordan Justen from comment #4)
> Created attachment 121900 [details] [review] [review]
> [PATCH] i965/fs: Allow spilling for SIMD16 compute shaders
> 
> Does the attached patch help with the crash?
> 
> Note, the one compute shader program I looked at took
> about 20 seconds to generate a program for, so startup
> may take a while.
> 
> Additionally it had a fair amount of register spilling,
> and therefore the performance may not be very good.

Sadly no.

Tested with...
darius@pc1:~$ glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.3.0-devel (git-c95d5c5)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 11.3.0-devel (git-c95d5c5)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.3.0-devel (git-c95d5c5)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
Comment 6 Darius Spitznagel 2016-02-24 21:18:22 UTC
Created attachment 121953 [details]
Alien: Isolation GDB log with applied patch
Comment 7 Darius Spitznagel 2016-02-24 21:20:10 UTC
I have created a new backtrace log with applied patch.
Comment 8 Jordan Justen 2016-03-10 18:58:47 UTC
A commit related to this bug was merged. Apparently
it does not fix the issue:

commit e1d54b1ba5a9d579020fab058bb065866bc35554

    i965/fs: Allow spilling for SIMD16 compute shaders
Comment 9 Eero Tamminen 2016-08-29 08:03:26 UTC
Darius, could you check this with Mesa 12.x?
Comment 10 Darius Spitznagel 2016-08-29 16:13:28 UTC
(In reply to Eero Tamminen from comment #9)
> Darius, could you check this with Mesa 12.x?

Still crashing.

Tested with...
glxinfo   | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel (git-4c53267)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 12.1.0-devel (git-4c53267)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 12.1.0-devel (git-4c53267)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
Comment 11 Eero Tamminen 2016-08-30 07:46:57 UTC
(In reply to Darius Spitznagel from comment #10)
> OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
> OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel
> (git-4c53267)

I forgot you use Haswell, where Mesa doesn't yet expose GL GL 4.x required by the game.  Game developer has also stated (in bug 93144 comment 31) that the game *requires* compute shaders (which you explicitly disable in first comment of this bug).

The fp64 support still missing for GL 4.3 GEN7 shouldn't affect your game though. Could you try the game also with:
MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430 ?
Comment 12 Darius Spitznagel 2016-08-30 19:12:51 UTC
(In reply to Eero Tamminen from comment #11)
> (In reply to Darius Spitznagel from comment #10)
> > OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
> > OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.1.0-devel
> > (git-4c53267)
> 
> I forgot you use Haswell, where Mesa doesn't yet expose GL GL 4.x required
> by the game.  Game developer has also stated (in bug 93144 comment 31) that
> the game *requires* compute shaders (which you explicitly disable in first
> comment of this bug).
> 
> The fp64 support still missing for GL 4.3 GEN7 shouldn't affect your game
> though. Could you try the game also with:
> MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430 ?

The test I did yesterday was run with "MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430".
Sorry I didn't mention it.
Comment 13 Darius Spitznagel 2016-08-30 19:21:35 UTC
"MESA_GL_VERSION_OVERRIDE=4.3 MESA_GLSL_VERSION_OVERRIDE=430 %command%" is only set for this game inside Steam Client - not in my bash environment where I called glxinfo to show you that I was using git master.
Comment 14 Matt Turner 2016-08-30 19:35:34 UTC
Created attachment 126122 [details] [review]
patch

(In reply to Darius Spitznagel from comment #1)
> Created attachment 121746 [details]
> Alien: Isolation GDB log

The memset() at line 935 of a4cff18:src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp is

>   memset(last_grf_write, 0, sizeof(last_grf_write));

The backtrace shows

#1  0x00007fffe79015fe in memset (__len=482688, __ch=0, __dest=0x7fffa216e550) at /usr/include/x86_64-linux-gnu/bits/string3.h:84

__len=482688?!

last_grf_write is sized as

>   schedule_node *last_grf_write[grf_count * 16];

and 482688 / 16 is 30168. So we have 30168 virtual registers?!

I would very much like to see this shader... could you try to capture it with MESA_SHADER_CAPTURE_PATH=/tmp/alienisolation [...] (after making that directory)? It will write shaders to the directory, and I would expect the last one it writes to be the one causing the trouble. :)



I expect the attached patch will fix it, though I'm not sure it's exactly what we want to do. (Of course capture the shaders without this patch)
Comment 15 Darius Spitznagel 2016-08-30 20:26:44 UTC
Hello Matt,

great, it's working with your patch as you expected:)
No more crash at start!

I only played about 2 minutes.
The only strange thing that I saw where flashing little white boxes (not spots, max 4x4 pixels ore more) which maybe should simulate dust particles in the air - but this is not the issue of this bug report.

Many thanks Matt!

Do you have doubts this patch could land in mesa?
> I expect the attached patch will fix it, though I'm not sure it's exactly what we want to do.
Comment 16 Matt Turner 2016-08-30 21:41:31 UTC
(In reply to Darius Spitznagel from comment #15)
> Do you have doubts this patch could land in mesa?

I cannot say without seeing the shader. 30 thousand virtual registers used is an incredible amount. It's possible the shader is significantly larger than anything we've seen before, but it's equally likely that we have a bug somewhere else that's causing it.

Once I see the shader I should be able to determine what to do next.
Comment 17 Matt Turner 2016-08-31 18:52:25 UTC
So there's no misunderstanding, I'm waiting for you to capture the shader (without my patch).
Comment 18 Darius Spitznagel 2016-08-31 19:39:41 UTC
Created attachment 126150 [details]
AI shaders

Sorry Matt, I was very busy until now.
Here it comes...
Comment 19 Matt Turner 2016-08-31 20:01:12 UTC
(In reply to Darius Spitznagel from comment #18)
> Created attachment 126150 [details]
> AI shaders
> 
> Sorry Matt, I was very busy until now.
> Here it comes...

No problem. Sorry, I didn't mean to rush you. Just wanted to make sure I was communicating clearly.

Doesn't look like there are any compute shaders in there. I'll investigate if our capturing mechanism has a bug. (And I'll have a Bugzilla admin delete the attachment, since we probably cannot distribute the shaders. Sorry, I should have asked you to email them to me).
Comment 20 Tollef Fog Heen 2016-09-01 19:11:43 UTC
The content of attachment 126150 [details] has been deleted for the following reason:

Not public.


bug/show.html.tmpl processed on Jan 16, 2017 at 17:21:45.
(provided by the Example extension).