Bug 88246

Summary: Commit 2881b12 causes 43 DrawElements test regressions
Product: Mesa Reporter: Mike Mason <michael.w.mason>
Component: Drivers/DRI/i965Assignee: Matt Turner <mattst88>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: chadversary, itoral
Version: gitKeywords: patch
Hardware: Other   
OS: Linux (All)   
URL: http://lists.freedesktop.org/archives/mesa-dev/2015-February/078055.html
Whiteboard:
i915 platform: i915 features:
Attachments: Mesa debug output before 2881b12
dEQP output before 2881b12
Mesa debug output after 2881b12
dEQP output after 2881b12

Description Mike Mason 2015-01-09 17:29:26 UTC
Environment:
Mesa: (master 934e41c0b31cffa4efc08f61cff2389e3149b3f3)
Ubuntu 14.04

Commit 2881b12 "i965: Use ~0 to represent true on all generations" causes regressions on 43 DrawElments tests (see list below).  All appear to be related to boolean conversions.

dEQP-GLES3.functional.shaders.conversions.scalar_to_scalar.int_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_scalar.uint_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_vector.int_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_vector.int_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_vector.int_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_vector.uint_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_vector.uint_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.scalar_to_vector.uint_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_scalar.ivec2_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_scalar.ivec3_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_scalar.ivec4_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_scalar.uvec2_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_scalar.uvec3_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_scalar.uvec4_to_bool_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.ivec4_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.ivec4_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.ivec4_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.uvec4_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.uvec4_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.uvec4_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.ivec3_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.ivec3_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.uvec3_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.uvec3_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.ivec2_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_to_vector.uvec2_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_int_int_int_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.uint_uint_uint_uint_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.bool_float_int_bool_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.vec2_ivec2_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_ivec2_int_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.bool_float_ivec2_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.float_uvec3_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_uvec2_bool_to_bvec4_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_int_int_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.uint_uint_uint_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.bool_float_int_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.bvec2_int_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.bool_ivec2_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.float_uvec2_to_bvec3_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_int_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.uint_uint_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.float_int_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_bool_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.int_uint_to_bvec2_vertex
dEQP-GLES3.functional.shaders.conversions.vector_combine.uint_float_to_bvec2_vertex


Analysis:

Bisect shows 2881b123d00562fee8b7d2b4f7825f89a73e0d9f is the first bad commit.

Author: Matt Turner <mattst88@gmail.com>
Date:   Tue Dec 2 12:28:13 2014 -0800

    i965: Use ~0 to represent true on all generations.
    
    Jason realized that we could fix the result of the CMP instruction on
    Gen <= 5 by doing -(result & 1). Also do the resolves in the vec4
    backend before use, rather than when the bool was created. The FS does
    this and it saves some unnecessary resolves.
    
    On Ironlake:
    
    total instructions in shared programs: 4289762 -> 4287277 (-0.06%)
    instructions in affected programs:     619430 -> 616945 (-0.40%)
    
    Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>


Steps to reproduce:

# ./deqp-gles3 --deqp-case=<test>

for each of the above listed tests.
Comment 1 Mike Mason 2015-01-09 17:43:31 UTC
These tests also regressed due to commit 2881b12:

dEQP-GLES3.functional.shaders.random.scalar_conversion.vertex.58
dEQP-GLES3.functional.shaders.random.scalar_conversion.vertex.68
Comment 2 Matt Turner 2015-01-09 19:32:35 UTC
Strange. Presumably you're testing on SNB or newer, and that commit should have affected only older generations.

Could you run one of the tests before and after commit 2881b12 with INTEL_DEBUG=vs,fs and attach the output here?
Comment 3 Mike Mason 2015-01-09 20:31:38 UTC
Actually, I saw the failures on IVB (i7-3770K) and Haswell (i7-4770K).  I'll collect the debug info you requested.
Comment 4 Mike Mason 2015-01-09 21:38:49 UTC
Created attachment 112031 [details]
Mesa debug output before 2881b12
Comment 5 Mike Mason 2015-01-09 21:39:42 UTC
Created attachment 112032 [details]
dEQP output before 2881b12
Comment 6 Mike Mason 2015-01-09 21:40:10 UTC
Created attachment 112033 [details]
Mesa debug output after 2881b12
Comment 7 Mike Mason 2015-01-09 21:40:47 UTC
Created attachment 112035 [details]
dEQP output after 2881b12
Comment 8 Matt Turner 2015-01-12 07:34:25 UTC
Oh yeah:

(assign  (x) (var_ref packed:v_out0)  (expression float b2f (expression bool i2b (expression int f2i (var_ref a_in0) ) ) ) )
-cmp.nz.f0(8)    g6<1>.xD        g7<4,4,1>.xD    0F              
+and(8)          g6<1>.xD        g7<4,4,1>.xD    1D              
 and(8)          g4<1>.xD        g6<4,4,1>.xD    0x3f800000UD

Those are definitely not the same. I'll investigate more tomorrow.
Comment 9 Ian Romanick 2015-02-26 16:14:34 UTC
*** Bug 89313 has been marked as a duplicate of this bug. ***
Comment 10 Matt Turner 2015-02-27 18:30:47 UTC
Wow. I just simply broke i2b in the vec4 backend in commit 2881b123d from the looks of it. The fix is easy, but unfortunately when testing some of these tests assert fail in our SSSE3 code in rgba8_copy() because of unaligned dst.

I'll send a patch shortly for the failure that is my fault.
Comment 11 Matt Turner 2015-02-27 19:35:33 UTC
Patch sent to the mailing list.
Comment 12 Matt Turner 2015-02-28 04:25:38 UTC
Should be fixed by:

commit 43ef2657a08f850c5756f28520f2cbe506807f24
Author: Matt Turner <mattst88@gmail.com>
Date:   Thu Feb 26 22:49:47 2015 -0800

    i965/vec4: Fix implementation of i2b.

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.