Bug 77288

Summary: [swrast] piglit glean glsl1 regression
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Severity: critical    
Priority: medium CC: eric, kenneth
Version: 10.2Keywords: bisected, have-backtrace, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 79039    

Description Vinson Lee 2014-04-10 21:42:17 UTC
mesa: 8291f6d5c5db2dba6bd9a8d94a5e269a90d255eb (master 10.2.0-devel)

piglit glean glsl1 now crashes.

$ ./bin/glean -t glsl1 --quick
  Shader test: function prototype
  Expected color: 0.25, 0.25, 0.25, 0.25
  Observed color: 0.25098, 0.25098, 0.25098, 0
glean: program/ir_to_mesa.cpp:1800: virtual void {anonymous}::ir_to_mesa_visitor::visit(ir_assignment*): Assertion `ir->lhs->type->is_vector()' failed.
Aborted (core dumped)

(gdb) bt
#0  0x00007fc9e02baf77 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007fc9e02be5e8 in __GI_abort () at abort.c:90
#2  0x00007fc9e02b3d43 in __assert_fail_base (fmt=0x7fc9e040af58 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7fc9dd4633db "ir->lhs->type->is_vector()", 
    file=file@entry=0x7fc9dd462d6c "program/ir_to_mesa.cpp", line=line@entry=1800, 
    function=function@entry=0x7fc9dd464060 <(anonymous namespace)::ir_to_mesa_visitor::visit(ir_assignment*)::__PRETTY_FUNCTION__> "virtual void {anonymous}::ir_to_mesa_visitor::visit(ir_assignment*)") at assert.c:92
#3  0x00007fc9e02b3df2 in __GI___assert_fail (assertion=0x7fc9dd4633db "ir->lhs->type->is_vector()", 
    file=0x7fc9dd462d6c "program/ir_to_mesa.cpp", line=1800, 
    function=0x7fc9dd464060 <(anonymous namespace)::ir_to_mesa_visitor::visit(ir_assignment*)::__PRETTY_FUNCTION__> "virtual void {anonymous}::ir_to_mesa_visitor::visit(ir_assignment*)") at assert.c:101
#4  0x00007fc9dd31f6b8 in (anonymous namespace)::ir_to_mesa_visitor::visit (this=0x7fffd40ddf50, ir=0x19a9f00)
    at program/ir_to_mesa.cpp:1800
#5  0x00007fc9dd3d7698 in ir_assignment::accept (this=0x19a9f00, v=0x7fffd40ddf50) at ../../src/glsl/ir.h:1060
#6  0x00007fc9dd31b63c in (anonymous namespace)::ir_to_mesa_visitor::visit (this=0x7fffd40ddf50, ir=0x1c5dec0)
    at program/ir_to_mesa.cpp:807
#7  0x00007fc9dd3d75e8 in ir_function::accept (this=0x1c5dec0, v=0x7fffd40ddf50) at ../../src/glsl/ir.h:927
#8  0x00007fc9dd3d4713 in visit_exec_list (list=0x1643860, visitor=0x7fffd40ddf50) at ../../src/glsl/ir.cpp:1734
#9  0x00007fc9dd322e75 in get_mesa_program (ctx=0x7fc9e1bdc010, shader_program=0x19ab0e0, shader=0x162e120)
    at program/ir_to_mesa.cpp:2823
#10 0x00007fc9dd323a93 in _mesa_ir_link_shader (ctx=0x7fc9e1bdc010, prog=0x19ab0e0) at program/ir_to_mesa.cpp:3050
#11 0x00007fc9dd323c21 in _mesa_glsl_link_shader (ctx=0x7fc9e1bdc010, prog=0x19ab0e0) at program/ir_to_mesa.cpp:3093
#12 0x00007fc9dd1bf44c in link_program (ctx=0x7fc9e1bdc010, program=329) at main/shaderapi.c:918
#13 0x00007fc9dd1c05cd in _mesa_LinkProgram (programObj=329) at main/shaderapi.c:1386
#14 0x00000000004948ed in GLEAN::GLSLTest::testProgram (this=0x732d80 <GLEAN::glslTest>, p=...)
    at piglit/tests/glean/tglsl1.cpp:4460
#15 0x00000000004954ea in GLEAN::GLSLTest::runOne (this=0x732d80 <GLEAN::glslTest>, r=..., w=...)
    at piglit/tests/glean/tglsl1.cpp:4672
#16 0x0000000000476c43 in GLEAN::BaseTest<GLEAN::MultiTestResult>::run (this=0x732d80 <GLEAN::glslTest>, environment=...)
    at piglit/tests/glean/tbase.h:331
#17 0x000000000046f4cf in main (argc=4, argv=0x7fffd40de978) at piglit/tests/glean/main.cpp:125
(gdb) frame 4
#4  0x00007fc9dd31f6b8 in (anonymous namespace)::ir_to_mesa_visitor::visit (this=0x7fffd40ddf50, ir=0x19a9f00)
    at program/ir_to_mesa.cpp:1800
1800	      assert(ir->lhs->type->is_vector());
(gdb) print ir->lhs->type->vector_elements
$1 = 4
(gdb) print ir->lhs->type->matrix_columns
$2 = 4
(gdb) print ir->lhs->type->base_type

e9822f77a9cc024f528d30382fd5ad21c73a173b is the first bad commit
commit e9822f77a9cc024f528d30382fd5ad21c73a173b
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Mar 5 17:05:54 2014 -0800

    glsl: Skip making a temporary for assignments when we don't need one.
    While we wish our optimization passes could identify all the cases where
    we can coalesce our variables, we miss out on a lot of opportunities.
    total instructions in shared programs: 1673849 -> 1673166 (-0.04%)
    instructions in affected programs:     299521 -> 298838 (-0.23%)
    GAINED:                                7
    LOST:                                  0
    Note that many programs are "hurt".  The notable ones are where we produce
    unrolling in cases we didn't before (presumably just because of the lower
    instruction count).  But there are also some cases where pushing things
    right into the variables prevents copy propagation and tree grafting,
    since we don't split our variable usage webs apart.
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

:040000 040000 7c8cf5cd96b51ebe578fdafd148bba0786e419a9 b129f85386b692d69af59fe92df22efd74a8e8ba M	src
bisect run success
Comment 1 Vinson Lee 2014-05-10 19:32:45 UTC
mesa: d9e102b220701c15730329290daa0176751af09a (master 10.3.0-devel)

This regression is still present.
Comment 2 Brian Paul 2014-05-13 20:41:01 UTC
This patch silences the assertion, but I'm really not sure if it's the right thing to do.

--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1797,7 +1797,8 @@ ir_to_mesa_visitor::visit(ir_assignment *ir)
       int first_enabled_chan = 0;
       int rhs_chan = 0;
-      assert(ir->lhs->type->is_vector());
+      assert(ir->lhs->type->is_vector() ||
+             ir->lhs->type->is_matrix());
       l.writemask = ir->write_mask;
       for (int i = 0; i < 4; i++) {

The corresponding code in the src/mesa/state_tracker/st_glsl_to_tgsi.cpp has no type assertions.  So maybe we should just remove the assert()?
Comment 3 Eric Anholt 2014-05-14 20:47:59 UTC
The alternative I think would be to make "if (ir->write_mask == 0) {" (which is presumably the case that was being hit before) also explicitly accept matrices/structures.
Comment 4 Vinson Lee 2014-09-12 22:42:11 UTC
mesa: d13d2fd16132f351ec7c8184f165faeac3b31bb4 (master 10.4.0-devel)

Regression is still present.
Comment 5 Vinson Lee 2015-02-14 02:16:44 UTC
mesa: 8323796840a343ee39687cc8e8b424ee43d6fee7 (10.6.0-devel)

piglit glean glsl1 regression on swrast is still present.
Comment 6 Vinson Lee 2015-06-21 04:13:50 UTC
mesa: 717376155d2082d7bf94122a1e1d383b39e0b070 (master 10.7.0-devel)

piglit glean glsl1 regression on swrast is still present.
Comment 7 Vinson Lee 2016-03-22 02:29:44 UTC
mesa: 1e8435ce0cce671024ebf9c5465ea8bdcb563b69 (master 11.3.0-devel)

piglit glean glsl1 regression on swrast is still present.
Comment 8 Vinson Lee 2017-03-31 23:35:38 UTC
mesa: 150736b5c34fc07de296454b973ae72ede215ae2 (master 17.1.0-devel)

Regression is still present.
Comment 9 Timothy Arceri 2018-04-13 05:45:30 UTC
All glean tests have been rewritten and removed from piglit, and since nobody really cares enough to fix swrast anyway I'm closing this bug.

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.