Bug 89944

Summary: GPU crash in Civilization 5
Product: Mesa Reporter: Sami Liedes <sami.liedes>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: kenneth, sami.liedes
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: dmesg
R600_DEBUG=ps,vs,gs output from crashing program
Non-crashing debug output from mesa 10.4.2, for comparison
R600_DEBUG=ps,vs,gs output from last good commit (8eb6c109)
R600_DEBUG=ps,vs,gs output from first bad commit (30f51f1a)

Description Sami Liedes 2015-04-07 20:18:24 UTC
Created attachment 114935 [details]
dmesg

Civilization 5, with all DLC, causes a GPU crash on recent git (490621f) on Radeon R9 270. The game works perfectly on mesa 10.4.2 from Debian unstable, though. Hardware and kernel are x86-64, but the game (and obviously mesa) is 32-bit.

The crash happens when the game is loaded, probably where the map would first get drawn.

Mesa was built in a 32-bit chroot and configured with

   ./configure --prefix=/home/sliedes/local/mesa32 --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --with-gallium-drivers=radeonsi --with-egl-platforms=drm,x11 --enable-driglx-direct --enable-gles1 --enable-gles2 --enable-glx-tls --enable-texture-float

LLVM version is 3.6.0, built in release mode.
Comment 1 Sami Liedes 2015-04-07 20:19:28 UTC
Created attachment 114936 [details]
R600_DEBUG=ps,vs,gs output from crashing program
Comment 2 Sami Liedes 2015-04-07 20:20:13 UTC
Created attachment 114937 [details]
Non-crashing debug output from mesa 10.4.2, for comparison
Comment 3 Sami Liedes 2015-04-08 21:52:22 UTC
I bisected this down to this commit:

------------------------------------------------------------
commit 30f51f1a1a70bc838d5bed449daff0dd9f2e8ef2
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Wed Oct 22 20:48:21 2014 -0700

    glsl: Optimize "if (cond) discard;" to a conditional discard.                                                                                                                                                    
                                                                                                                                                                                                                     
    st_glsl_to_tgsi and ir_to_mesa have handled conditional discards for a                                                                                                                                           
    long time; the previous patch added that capability to i965.                                                                                                                                                     
                                                                                                                                                                                                                     
    i965 (Haswell) shader-db stats:                                                                                                                                                                                  
                                                                                                                                                                                                                     
    Without NIR:                                                                                                                                                                                                     
    total instructions in shared programs: 5792133 -> 5776360 (-0.27%)                                                                                                                                               
    instructions in affected programs:     737585 -> 721812 (-2.14%)                                                                                                                                                 
    helped:                                6300                                                                                                                                                                      
    HURT:                                  68                                                                                                                                                                        
    GAINED:                                2                                                                                                                                                                         
                                                                                                                                                                                                                     
    With NIR:                                                                                                                                                                                                        
    total instructions in shared programs: 5787538 -> 5769569 (-0.31%)                                                                                                                                               
    instructions in affected programs:     767843 -> 749874 (-2.34%)
    helped:                                6522
    HURT:                                  35
    GAINED:                                6
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
------------------------------------------------------------

I can also confirm that reverting that commit on top of recent HEAD (4deca127) fixes the issue.

I can attach R600_DEBUG=ps,gs,vs output from the offending commit and its parent if you think comparing them is of any use.
Comment 4 qaridarium 2015-04-09 02:04:16 UTC
I think I do have the same problem.

http://www.phoronix.com/forums/showthread.php?116700-HD7850-radeon-oibaf-ppa-Zivilisation-5-crash

I do have a hd7850 and I use the oibaf PPA to run the GIT code
Comment 5 Tom Stellard 2015-04-10 15:25:36 UTC
(In reply to Sami Liedes from comment #3)
> I bisected this down to this commit:
> 
> ------------------------------------------------------------
> commit 30f51f1a1a70bc838d5bed449daff0dd9f2e8ef2
> Author: Kenneth Graunke <kenneth@whitecape.org>
> Date:   Wed Oct 22 20:48:21 2014 -0700
> 
>     glsl: Optimize "if (cond) discard;" to a conditional discard.           
> 
>                                                                             
> 
>     st_glsl_to_tgsi and ir_to_mesa have handled conditional discards for a  
> 
>     long time; the previous patch added that capability to i965.            
> 
>                                                                             
> 
>     i965 (Haswell) shader-db stats:                                         
> 
>                                                                             
> 
>     Without NIR:                                                            
> 
>     total instructions in shared programs: 5792133 -> 5776360 (-0.27%)      
> 
>     instructions in affected programs:     737585 -> 721812 (-2.14%)        
> 
>     helped:                                6300                             
> 
>     HURT:                                  68                               
> 
>     GAINED:                                2                                
> 
>                                                                             
> 
>     With NIR:                                                               
> 
>     total instructions in shared programs: 5787538 -> 5769569 (-0.31%)      
> 
>     instructions in affected programs:     767843 -> 749874 (-2.34%)
>     helped:                                6522
>     HURT:                                  35
>     GAINED:                                6
>     
>     Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
>     Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
>     Reviewed-by: Matt Turner <mattst88@gmail.com>
>     Reviewed-by: Eric Anholt <eric@anholt.net>
> ------------------------------------------------------------
> 
> I can also confirm that reverting that commit on top of recent HEAD
> (4deca127) fixes the issue.
> 
> I can attach R600_DEBUG=ps,gs,vs output from the offending commit and its
> parent if you think comparing them is of any use

That would be useful.
Comment 6 Sami Liedes 2015-04-10 16:18:20 UTC
Created attachment 115007 [details]
R600_DEBUG=ps,vs,gs output from last good commit (8eb6c109)
Comment 7 Sami Liedes 2015-04-10 16:19:24 UTC
Created attachment 115008 [details]
R600_DEBUG=ps,vs,gs output from first bad commit (30f51f1a)
Comment 8 Tom Stellard 2015-04-14 15:05:51 UTC
Can you pull the latest version of llvm and mesa and see if the problem still exists?
Comment 9 Sami Liedes 2015-04-14 21:52:19 UTC
Tested; cannot reproduce problem with latest mesa (28d9e904) and llvm (r234939).
Comment 10 Marek Olšák 2015-04-22 10:04:35 UTC
(In reply to Sami Liedes from comment #9)
> Tested; cannot reproduce problem with latest mesa (28d9e904) and llvm
> (r234939).

Ok. Closing then.

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.