Bug 106382

Summary: Shader cache breaks INTEL_DEBUG=shader_time
Product: Mesa Reporter: Eero Tamminen <eero.t.tamminen>
Component: Drivers/DRI/i965Assignee: Jordan Justen <jljusten>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium Keywords: regression
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Eero Tamminen 2018-05-03 14:55:07 UTC
INTEL_DEBUG=shader_time is currently obviously broken (e.g. for GfxBench Manhattan):
--------------------------------------------------------------------------
type          ID                  cycles spent                   % of total
fs8   glsl               373:               90 (   0.00 Gcycles)       0.0%
fs8   ff                    :           172370 (   0.00 Gcycles)       0.0%
vs    ff                    :           344888 (   0.00 Gcycles)       0.0%
fs16  glsl               373:          8305920 (   0.01 Gcycles)       0.0%
fs16  ff                    :         11216436 (   0.01 Gcycles)       0.0%
vs    glsl               373:     343586468912 ( 343.59 Gcycles)      100.0%

total vs                    :     343586813800 ( 343.59 Gcycles)      100.0%
total tcs                   :                0 (   0.00 Gcycles)       0.0%
total tes                   :                0 (   0.00 Gcycles)       0.0%
total gs                    :                0 (   0.00 Gcycles)       0.0%
total fs8                   :           172460 (   0.00 Gcycles)       0.0%
total fs16                  :         19522356 (   0.02 Gcycles)       0.0%
total cs                    :                0 (   0.00 Gcycles)       0.0%
--------------------------------------------------------------------------

(Doesn't catch all shaders, bogus claim of VS taking all cycles.)

Whereas it looked OK earlier:
--------------------------------------------------------------------------
type          ID                  cycles spent                   % of total
...
fs16                     145:      78882844194 (  78.88 Gcycles)       5.3%
fs16                     130:      81080453640 (  81.08 Gcycles)       5.5%
fs16                     100:      89160006304 (  89.16 Gcycles)       6.0%
fs8                      100:      97493340722 (  97.49 Gcycles)       6.6%
fs8                      145:     109074002940 ( 109.07 Gcycles)       7.4%
vs                        25:     141904285068 ( 141.90 Gcycles)       9.6%
vs                       145:     163587049558 ( 163.59 Gcycles)      11.1%
vs                       130:     210961326200 ( 210.96 Gcycles)      14.3%
vs    glsl               373:     365123108520 ( 365.12 Gcycles)      24.7%

total vs                    :     950461159406 ( 950.46 Gcycles)      64.3%
total tcs                   :                0 (   0.00 Gcycles)       0.0%
total tes                   :                0 (   0.00 Gcycles)       0.0%
total gs                    :                0 (   0.00 Gcycles)       0.0%
total fs8                   :     273197670631 ( 273.20 Gcycles)      18.5%
total fs16                  :     254685996871 ( 254.69 Gcycles)      17.2%
total cs                    :                0 (   0.00 Gcycles)       0.0%
--------------------------------------------------------------------------


This is the commit breaking shader_time (I had to bisect it twice):
--------------------------------------------------------------------------
002cb6f2b330434763b0fd8a51ac2f0eb8f5d65f is the first bad commit
commit 002cb6f2b330434763b0fd8a51ac2f0eb8f5d65f
Author: Iago Toral Quiroga <itoral@igalia.com>
Date:   Fri Mar 2 11:12:38 2018 +0100

    anv/pipeline: support SpvCapabilityInt16 in gen8+
    
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
--------------------------------------------------------------------------

No idea how it can do that (I wasn't building with debug enabled).
Comment 1 Eero Tamminen 2018-05-03 16:30:23 UTC
> No idea how it can do that (I wasn't building with debug enabled).

It's not.  By going backwards from Mesa head (instead of towards head, like happened with 2x bisect tries), I get the issue even with earlier commits, even when doing "make clean" before every build.  There's something funky going on.

-> I don't know what commit actually causes this.
Comment 2 Eero Tamminen 2018-05-04 08:16:19 UTC
If I use MESA_GLSL_CACHE_DISABLE=true, shader_time output is sane again i.e. shader cache & shader_time are incompatible.

If there's no suitable fix, at least disable shader cache automatically when shader_time is used, and/or output a warning about it.
Comment 3 Kenneth Graunke 2018-05-04 08:38:39 UTC
Disabling the cache probably makes the most sense.  We could also put a "bool using_shader_time" in the program keys, but...I'm not sure it's worth it.
Comment 4 Jordan Justen 2018-07-31 22:10:28 UTC
https://patchwork.freedesktop.org/patch/241060/

i965: Disable shader cache with INTEL_DEBUG=shader_time
Comment 5 Jordan Justen 2018-08-09 22:07:52 UTC
Should be fixed by:

commit 3887700dfd7597fba654a4a713c274213a4a8755

    i965: Disable shader cache with INTEL_DEBUG=shader_time

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.