Bug 68527 - Planetary Annihilation Alpha: translation from TGSI failed !
Summary: Planetary Annihilation Alpha: translation from TGSI failed !
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: 9.2
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 77449
  Show dependency treegraph
 
Reported: 2013-08-25 13:26 UTC by sxx.public
Modified: 2019-07-04 00:34 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
GL trace using apitrace from git (2.47 MB, application/octet-stream)
2013-08-25 13:28 UTC, sxx.public
Details
Screenshot of game with sun shader glitch from R600g (305.87 KB, image/png)
2013-08-25 13:29 UTC, sxx.public
Details
Screenshot of game without glitch from Intel HD3000 (321.11 KB, image/png)
2013-08-25 13:32 UTC, sxx.public
Details
GLSL code of sun shader (3.88 KB, application/octet-stream)
2013-08-25 13:35 UTC, sxx.public
Details
Game log with R600_DUMP_SHADERS=1, error on line 1488 (206.15 KB, text/plain)
2013-08-26 06:55 UTC, sxx.public
Details
R600_DUMP_SHADERS output and error from latest Mesa without LLVM. (25.50 KB, text/plain)
2013-08-26 10:08 UTC, sxx.public
Details
GPU lockup log from dmesg (17.06 KB, text/plain)
2014-01-12 19:50 UTC, sxx.public
Details
Slightly updated sun shader code from 58772 build (4.22 KB, application/octet-stream)
2014-01-12 19:52 UTC, sxx.public
Details

Description sxx.public 2013-08-25 13:26:44 UTC
I test this game on my AMD HD6950 and Intel HD3000 both using latest Mesa 9.2.
Problem with sun shader only occur with R600g.

I can also notice that sun shader inside game based on this demo (which is working fine with R600):
https://github.com/ashima/webgl-noise

OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD CAYMAN
OpenGL core profile version string: 3.1 (Core Profile) Mesa 9.2.0-devel
OpenGL core profile shading language version string: 1.40
Comment 1 sxx.public 2013-08-25 13:28:24 UTC
Created attachment 84587 [details]
GL trace using apitrace from git
Comment 2 sxx.public 2013-08-25 13:29:37 UTC
Created attachment 84588 [details]
Screenshot of game with sun shader glitch from R600g
Comment 3 sxx.public 2013-08-25 13:32:05 UTC
Created attachment 84589 [details]
Screenshot of game without glitch from Intel HD3000
Comment 4 sxx.public 2013-08-25 13:33:06 UTC
I'm also forgot to post full error:
EE r600_shader.c:158 r600_pipe_shader_create - translation from TGSI failed !
EE r600_state_common.c:754 r600_shader_select - Failed to build shader variant (type=1) -1
Comment 5 sxx.public 2013-08-25 13:35:14 UTC
Created attachment 84590 [details]
GLSL code of sun shader
Comment 6 Henri Verbeet 2013-08-25 20:29:19 UTC
(In reply to comment #4)
> I'm also forgot to post full error:
> EE r600_shader.c:158 r600_pipe_shader_create - translation from TGSI failed !
> EE r600_state_common.c:754 r600_shader_select - Failed to build shader
> variant (type=1) -1

I don't think that's quite the full output, but it does look somewhat like an issue that was fixed by commit b5ddaf9975f96c46ea3dfb02c4130de5196b238c.
Comment 7 Vadim Girlin 2013-08-25 21:07:46 UTC
(In reply to comment #4)
> I'm also forgot to post full error:
> EE r600_shader.c:158 r600_pipe_shader_create - translation from TGSI failed !
> EE r600_state_common.c:754 r600_shader_select - Failed to build shader
> variant (type=1) -1

Looks like the shader needs too much registers, it's probably the most frequent reason for such errors. Old backend can't handle it correctly, and I think it's not going to be fixed. LLVM backend should handle it better, so you might want to try it in this case.

By the way, there is a check that should print more specific message, but currently it's performed after the compilation because we don't know exact numbers of temp registers used by backend itself until we compile the shader. Probably we might want to implement similar check before the compilation as well - in most cases we can detect the problem just by checking the number of TGSI_inputs + TGSI_outputs + TGSI_temps, otherwise the backend often fails due to register limit in the middle of compilation without providing any explanation.
Comment 8 sxx.public 2013-08-26 06:55:17 UTC
Created attachment 84628 [details]
Game log with R600_DUMP_SHADERS=1, error on line 1488
Comment 9 sxx.public 2013-08-26 06:57:01 UTC
(In reply to comment #6)
> I don't think that's quite the full output, but it does look somewhat like
> an issue that was fixed by commit b5ddaf9975f96c46ea3dfb02c4130de5196b238c.

I'm just tried it with latest Mesa from git and there still same error and glitch.

I'm attached game log with R600_DUMP_SHADERS=1, what else might be helpful here?
Comment 10 sxx.public 2013-08-26 07:13:17 UTC
(In reply to comment #7)
> Looks like the shader needs too much registers, it's probably the most
> frequent reason for such errors. Old backend can't handle it correctly, and
> I think it's not going to be fixed. LLVM backend should handle it better, so
> you might want to try it in this case.

I'm always think that LLVM used by default. Sorry for such silly question, but how can I determine which backend is used? I also tried to run game using R600_LLVM=1 and other env vars (with or without sb) with no change.
Comment 11 Vadim Girlin 2013-08-26 07:35:20 UTC
(In reply to comment #10)
> (In reply to comment #7)
> > Looks like the shader needs too much registers, it's probably the most
> > frequent reason for such errors. Old backend can't handle it correctly, and
> > I think it's not going to be fixed. LLVM backend should handle it better, so
> > you might want to try it in this case.
> 
> I'm always think that LLVM used by default. Sorry for such silly question,
> but how can I determine which backend is used? I also tried to run game
> using R600_LLVM=1 and other env vars (with or without sb) with no change.

LLVM backend also needs to be enabled when you're building mesa (configure with --enable-r600-llvm-compiler option). If it's enabled in configure, then it will be used by default.
Comment 12 sxx.public 2013-08-26 10:08:04 UTC
Created attachment 84640 [details]
R600_DUMP_SHADERS output and error from latest Mesa without LLVM.
Comment 13 sxx.public 2013-08-26 12:35:54 UTC
(In reply to comment #11)
> LLVM backend also needs to be enabled when you're building mesa (configure
> with --enable-r600-llvm-compiler option). If it's enabled in configure, then
> it will be used by default.

Thanks, I'm successfully build Mesa with LLVM and sun shader work now.

Everything unstable (randomly result in GPU lockup and always result in lockup when SB used) and everything else is just a mess in game, but probably it's result of my own fault. I'll clean up my system and report back.
Comment 14 sxx.public 2014-01-12 19:49:06 UTC
I didn't expected I'll post in this report one more time, but there is new problem occur related to same shader. Few days ago I'm back to Oibaf PPA for every day use. I'm still using HD6950 1GB.

Now when I try to run game with default sun shader I'm not only get corrupted texture, but also get GPU lockup which turn into full system freeze if I'm didn't switch to virtual terminal quick. Sun shader in-game was modified since I'm posted this bugreport, but I'm also tried old code and it's cause GPU lockup as well.

I can say for sure that without this shader everything works fine.

Is it possible that shader compiler create code which make GPU stuck?
Might be if such problem occur it's shouldn't compile anything at all?
Is there some more information required to debug that problem?

PS: I'm attach slightly updated shaders from newer version of game as well as my dmesg output.
Comment 15 sxx.public 2014-01-12 19:50:42 UTC
Created attachment 91908 [details]
GPU lockup log from dmesg
Comment 16 sxx.public 2014-01-12 19:52:42 UTC
Created attachment 91909 [details]
Slightly updated sun shader code from 58772 build
Comment 17 sxx.public 2014-02-05 21:12:57 UTC
Small update on my issue. In latest version of Mesa this shader don't cause GPU lockup anymore, but retried of shader compilation didn't stop so my console got spammed with tons same errors:

EE ../../../../../../src/gallium/drivers/r600/r600_shader.c:157 r600_pipe_shader_create - translation from TGSI failed !
EE ../../../../../../src/gallium/drivers/r600/r600_state_common.c:745 r600_shader_select - Failed to build shader variant (type=1) -1
Comment 18 Igor Gnatenko 2014-03-12 03:28:16 UTC
Is this reproducible with 10.x ?

Any news here ?
Comment 19 sxx.public 2014-03-23 02:46:26 UTC
At moment sun shader in build 59607 don't cause GPU lockup, but have exactly same error. Also LLVM shader compiler can't handle it properly so it's only partially compile it.

Newer versions of game completely broken for open source drivers due to dependency on OpenGL 3.2 compatibility profile that isn't supported in Mesa:
http://pa.lennardf1989.com/Tracker/index.php?do=details&task_id=3057
I tried to bypass this problem but stuck on new GPU lockup, but I didn't report it because it's can be related to how I bypass crashes.

Anyway I suppose when developers change code to use 3.2 context game will work on Intel drivers, but there will be one more GPU lockup on R600g.
Comment 20 sxx.public 2014-03-23 03:33:50 UTC
If somebody want to check it here is trace that from 63180:
https://drive.google.com/file/d/0B5LwC3WbdQ3DUVM2bzMwUlQzSW8
This one have to be opened like that:
MESA_GL_VERSION_OVERRIDE=3.0 qapitrace PA.trace
Then it's will cause GPU lockup on R600g and it's not sun shader, but something else. Actually it's cause lockup with both default and LLVM shader compiler.

I guess this can be related to how MESA_GL_VERSION_OVERRIDE working. When I run glxinfo this MESA_GL_VERSION_OVERRIDE=3.0 it's still show that GLSL 3.3 supported so this is why game able to compile shaders at all.

Possible lockup related to invalid (for Mesa) GL call or something else so I have no idea what this can be.
Comment 21 Bronson 2017-05-17 06:46:00 UTC
Same issue here I belive:
https://bugs.freedesktop.org/show_bug.cgi?id=99349
Comment 22 mirh 2018-08-02 19:01:23 UTC
(In reply to Bronson from comment #21)
> Same issue here I belive:
> https://bugs.freedesktop.org/show_bug.cgi?id=99349

Which was fixed in 17.3. Can anybody retest?
Comment 23 Timothy Arceri 2019-07-04 00:34:23 UTC
Since nobody seems to be able to retest lets assume it was fixed (it likely was) along with bug #99349 and close for now.


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.