Bug 90000 - [i965 Bisected NIR] Piglit/gglean_fragprog1-z-write_test fail
Summary: [i965 Bisected NIR] Piglit/gglean_fragprog1-z-write_test fail
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: All Linux (All)
: highest major
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-13 02:19 UTC by lu hua
Modified: 2015-06-09 00:48 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description lu hua 2015-04-13 02:19:58 UTC
System Environment:
--------------------------
Platform: HSW
Libdrm:		(master)libdrm-2.4.60-31-g6f90b77ea903756c87ae614c093e3d816ebb26fc
Mesa:		(master)b6354d9bb077815d2e388dc5d0e7411ea6d89748
Xserver:	(master)xorg-server-1.17.0-72-gf1da6bf5d94911e78d2e27e6accf0c6e3aefb331
Xf86_video_intel:(master)2.99.917-256-gfbefc8f2bd4242c3f01b02e25276340237b34a88
Libva:		(master)062a63932c0f1439aa587aa986bbcfb758ff38f2
Libva_intel_driver:(master)ed03aebc6e702dab65204cc1469eef0da73e2372
Kernel:   (drm-intel-nightly)631c2f8cb69ecbd7dd0494c37dd3c7fbd04de928

Bug detailed description:
-----------------------------
It fails on i965 platforms with mesa master branch, works well on 10.5 branch.
Following cases also fail with the same bisect commit:
Piglit:
glean_fragprog1-z-write_test
glean_fragprog1-rsq_test_2_(reciprocal_square_root_of_negative_value)
Ogles3conform(fails on SNB+):
ES3-CTS.shaders.struct.uniform.sampler_array_fragment

Bisect shows: d47405eb707b9921f70454049677a9d504ee3fa6 is the first bad commit.
commit d47405eb707b9921f70454049677a9d504ee3fa6
Author:     Jason Ekstrand <jason.ekstrand@intel.com>
AuthorDate: Fri Apr 10 16:24:11 2015 -0700
Commit:     Jason Ekstrand <jason.ekstrand@intel.com>
CommitDate: Fri Apr 10 17:19:54 2015 -0700

    i965: Use NIR by default for fragment shaders

    GLSL IR vs. NIR shader-db results on i965:

       total instructions in shared programs: 2889747 -> 2890782 (0.04%)
       instructions in affected programs:     2425446 -> 2426481 (0.04%)
       helped:                                3698
       HURT:                                  5341

    GLSL IR vs. NIR shader-db results on g4x:

       total instructions in shared programs: 2547252 -> 2550440 (0.13%)
       instructions in affected programs:     1984482 -> 1987670 (0.16%)
       helped:                                2844
       HURT:                                  4776

    GLSL IR vs. NIR shader-db results on Iron Lake:

       total instructions in shared programs: 4053381 -> 4063828 (0.26%)
       instructions in affected programs:     3026601 -> 3037048 (0.35%)
       helped:                                4110
       HURT:                                  8331
       GAINED:                                1287
       LOST:                                  9

    GLSL IR vs. NIR shader-db results on Sandy Bridge:

       total instructions in shared programs: 5307041 -> 5236666 (-1.33%)
       instructions in affected programs:     3442908 -> 3372533 (-2.04%)
       helped:                                11829
       HURT:                                  5604
       GAINED:                                33
       LOST:                                  18

    GLSL IR vs. NIR shader-db results on Ivy Bridge:

       total instructions in shared programs: 4926333 -> 4857017 (-1.41%)
       instructions in affected programs:     3144042 -> 3074726 (-2.20%)
       helped:                                11559
       HURT:                                  4774
       GAINED:                                46
       LOST:                                  25

    GLSL IR vs. NIR shader-db results on Bay Trail:

       total instructions in shared programs: 4926333 -> 4857017 (-1.41%)
       instructions in affected programs:     3144042 -> 3074726 (-2.20%)
       helped:                                11559
       HURT:                                  4774
       GAINED:                                46
       LOST:                                  25

    GLSL IR vs. NIR shader-db results on Haswell:

       total instructions in shared programs: 4392487 -> 4293476 (-2.25%)
       instructions in affected programs:     2800180 -> 2701169 (-3.54%)
       helped:                                13073
       HURT:                                  3383
       GAINED:                                46
       LOST:                                  23

    GLSL IR vs. NIR shader-db results on Broadwell (FS only):

       total instructions in shared programs: 4378113 -> 4283025 (-2.17%)
       instructions in affected programs:     2743209 -> 2648121 (-3.47%)
       helped:                                12470
       HURT:                                  3609
       GAINED:                                64
       LOST:                                  27

    Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
    Acked-by: Matt Turner <mattst88@gmail.com>
    Acked-by: Kenneth Graunke <kenneth@whitecape.org>

output:
----------------------------------------------------------------------
Fragment Program test 1: test a specific set of fragment programs.

FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 32
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 33
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 111
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, z24, s8, win+pmap, id 158
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, accrgba16, win+pmap, slow, id 159
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, z24, s8, win+pmap, id 166
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 167
        0 tests passed, 1 tests failed.
FAILURE:
  Program: SWZ test
  Expected color: 0, 0, 1, 0
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, accrgba16, win+pmap, slow, id 168
        0 tests passed, 1 tests failed.


Reproduce steps:
---------------------------- 
1. xinit
2. PIGLIT_TEST='SWZ test' bin/glean -o -v -v -v -t +fragProg1
Comment 1 Kenneth Graunke 2015-04-17 21:33:58 UTC
Patch on list:
http://lists.freedesktop.org/archives/mesa-dev/2015-April/082137.html
Comment 2 Kenneth Graunke 2015-04-18 08:46:36 UTC
Please file a separate bug for the ES3 conformance problem if necessary.  It is a separate bug.
Comment 3 lu hua 2015-04-20 09:11:53 UTC
(In reply to Kenneth Graunke from comment #1)
> Patch on list:
> http://lists.freedesktop.org/archives/mesa-dev/2015-April/082137.html

Piglit case fixed by this patch, ogles3conform case still fail. report bug 90114.
Comment 4 Kenneth Graunke 2015-04-21 19:05:10 UTC
commit 44461e70985278464f5c2ce89bda2336c7299b0b
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Apr 17 14:08:14 2015 -0700

    nir: Fix per-component negation in prog_to_nir's SWZ handling.
Comment 5 lu hua 2015-04-23 02:28:35 UTC
glean_fragprog1-swz_test works well.
glean_fragprog1-z-write_test and glean_fragprog1-rsq_test_2_(reciprocal_square_root_of_negative_value) still fail.

libGL: OpenDriver: trying /opt/X11R7/lib/dri/tls/i965_dri.so
libGL: OpenDriver: trying /opt/X11R7/lib/dri/i965_dri.so
----------------------------------------------------------------------
Fragment Program test 1: test a specific set of fragment programs.

FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 32
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 33
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 111
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, z24, s8, win+pmap, id 158
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, accrgba16, win+pmap, slow, id 159
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, z24, s8, win+pmap, id 166
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, win+pmap, id 167
        0 tests passed, 1 tests failed.
FAILURE:
  Program: Z-write test
  Expected color: 0.5, 0.25, 1, 0.5
  Observed color: 0, 0, 0, 0
fragProg1:  FAIL rgba8, db, z24, s8, accrgba16, win+pmap, slow, id 168
        0 tests passed, 1 tests failed.
Comment 6 Matt Turner 2015-06-01 19:13:14 UTC
We're losing, what is presumably, our depth write:

pass -> fail

 mov(8)          g123<1>F        g2<0,1,0>F
 mov(8)          g124<1>F        g2.1<0,1,0>F
 mov(8)          g125<1>F        g2.2<0,1,0>F
 mov(8)          g126<1>F        g2.3<0,1,0>F
-mov(8)          g127<1>F        g2.1<0,1,0>F
 sendc(8)        null            g123<8,8,1>F
                 render RT write SIMD8 LastRT Surface = 0 mlen 5 rlen 0

The mlen is still correct, so we're writing uninitialized values.

Checking out commit 1ca60de4c (before we deleted the non-NIR paths), you can run with INTEL_USE_NIR=0 and the test passes.
Comment 7 Kenneth Graunke 2015-06-05 05:03:02 UTC
Fix on the mailing list:
http://lists.freedesktop.org/archives/mesa-dev/2015-June/085809.html
Comment 8 Kenneth Graunke 2015-06-06 20:27:49 UTC
Fixed on master by:

commit 7b8f20ec5505a25958bcd98aabe73a7ca2b6cbba
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Jun 4 17:00:17 2015 -0700

    prog_to_nir: Fix fragment depth writes.
    
    In the ARB_fragment_program specification, the result.depth output
    variable is treated as a vec4, where the fragment depth is stored in the
    .z component, and the other three components are undefined.
    
    This is different than GLSL, which uses a scalar value (gl_FragDepth).
    
    To make this consistent for driver backends, this patch makes
    prog_to_nir use a scalar output variable for FRAG_RESULT_DEPTH,
    moving result.depth.z into the first component.
    
    Fixes Glean's fragProg1 "Z-write test" subtest.
    
    Cc: mesa-stable@lists.freedesktop.org
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90000
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
Comment 9 Gordon Jin 2015-06-07 03:09:41 UTC
does this bug impact 10.6?
Comment 10 Kenneth Graunke 2015-06-07 06:53:45 UTC
Yes, but I've Cc'd mesa-stable, so Emil will pick it up.
Comment 11 lu hua 2015-06-09 00:48:21 UTC
Verified.Fixed.


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.