Bug 82477 - [softpipe] piglit fp-long-alu regression
Summary: [softpipe] piglit fp-long-alu regression
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords: bisected, have-backtrace, regression
: 82471 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-11 21:19 UTC by Vinson Lee
Modified: 2016-07-09 00:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vinson Lee 2014-08-11 21:19:54 UTC
mesa: f24be7340162c6a831b392d46d6637e9656e7a8a (master 10.3.0-devel)

$ ./bin/fp-long-alu -auto
Max (native) ALU instructions: 2147483647
Testing: alu_depth = 1
Testing: alu_depth = 2
Testing: alu_depth = 3
Testing: alu_depth = 4
Testing: alu_depth = 5
Testing: alu_depth = 6
Testing: alu_depth = 7
Testing: alu_depth = 8
Testing: alu_depth = 11
Testing: alu_depth = 17
Testing: alu_depth = 29
Testing: alu_depth = 53
Testing: alu_depth = 101
Testing: alu_depth = 197
Testing: alu_depth = 389
Testing: alu_depth = 773
Testing: alu_depth = 1541
tgsi/tgsi_exec.c:762:tgsi_exec_machine_bind_shader: Assertion `mach->ImmLimit + 1 <= 256' failed.
Trace/breakpoint trap (core dumped)

(gdb) bt
#0  0x00007fa5d3012ac6 in _debug_assert_fail (expr=expr@entry=0x7fa5d312f80a "mach->ImmLimit + 1 <= 256", file=file@entry=0x7fa5d312f58f "tgsi/tgsi_exec.c", 
    line=line@entry=762, function=function@entry=0x7fa5d312ff60 <__func__.7069> "tgsi_exec_machine_bind_shader") at util/u_debug.c:309
#1  0x00007fa5d3003e25 in tgsi_exec_machine_bind_shader (mach=0x7fa5d11e7010, tokens=<optimized out>, sampler=<optimized out>) at tgsi/tgsi_exec.c:762
#2  0x00007fa5d30854bd in update_fragment_shader (prim=4, softpipe=0x178bb10) at sp_state_derived.c:274
#3  softpipe_update_derived (softpipe=softpipe@entry=0x178bb10, prim=4) at sp_state_derived.c:376
#4  0x00007fa5d3079c58 in softpipe_draw_vbo (pipe=0x178bb10, info=0x7fff56d3c220) at sp_draw_arrays.c:79
#5  0x00007fa5d2ee24e2 in st_draw_vbo (ctx=<optimized out>, prims=<optimized out>, nr_prims=<optimized out>, ib=0x0, index_bounds_valid=<optimized out>, min_index=0, 
    max_index=3, tfb_vertcount=0x0, indirect=0x0) at ../../src/mesa/state_tracker/st_draw.c:285
#6  0x00007fa5d2eafa4f in vbo_draw_arrays (ctx=0x7fa5d893e010, mode=5, start=0, count=4, numInstances=1, baseInstance=0) at ../../src/mesa/vbo/vbo_exec_array.c:667
#7  0x00007fa5d84ae3eb in piglit_draw_rect_from_arrays (verts=0x7fff56d3c3a0, tex=0x0) at piglit/tests/util/piglit-util-gl.c:691
#8  0x00007fa5d84ae75d in piglit_draw_rect (x=0, y=0, w=32, h=32) at piglit/tests/util/piglit-util-gl.c:795
#9  0x00000000004014de in test (alu_depth=1541) at piglit/tests/shaders/fp-long-alu.c:117
#10 0x00000000004017b8 in piglit_display () at piglit/tests/shaders/fp-long-alu.c:160
#11 0x00007fa5d84cf24e in display () at piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:60
#12 0x00007fa5d7bd9244 in fghRedrawWindow (window=0x1774ba0) at freeglut_main.c:231
#13 fghcbDisplayWindow (window=0x1774ba0, enumerator=0x7fff56d3c5c0) at freeglut_main.c:248
#14 0x00007fa5d7bdcaa9 in fgEnumWindows (enumCallback=enumCallback@entry=0x7fa5d7bd91d0 <fghcbDisplayWindow>, enumerator=enumerator@entry=0x7fff56d3c5c0)
    at freeglut_structure.c:396
#15 0x00007fa5d7bd97fd in fghDisplayAll () at freeglut_main.c:271
#16 glutMainLoopEvent () at freeglut_main.c:1523
#17 0x00007fa5d7bd9ffd in glutMainLoop () at freeglut_main.c:1571
#18 0x00007fa5d84cf58a in run_test (gl_fw=0x7fa5d8741080 <glut_fw>, argc=1, argv=0x7fff56d3c998)
    at piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:167
#19 0x00007fa5d84b6236 in piglit_gl_test_run (argc=1, argv=0x7fff56d3c998, config=0x7fff56d3c860) at piglit/tests/util/piglit-framework-gl.c:151
#20 0x0000000000401155 in main (argc=1, argv=0x7fff56d3c998) at piglit/tests/shaders/fp-long-alu.c:45
(gdb) frame 1
#1  0x00007fa5d3003e25 in tgsi_exec_machine_bind_shader (mach=0x7fa5d11e7010, tokens=<optimized out>, sampler=<optimized out>) at tgsi/tgsi_exec.c:762
762	            assert( mach->ImmLimit + 1 <= TGSI_EXEC_NUM_IMMEDIATES );
(gdb) print mach->ImmLimit
$1 = 256

f82f2fb3dc770902f1657ab1c22e6004faa3afab is the first bad commit
commit f82f2fb3dc770902f1657ab1c22e6004faa3afab
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Aug 2 05:33:14 2014 -0700

    mesa: Actually use the Mesa IR optimizer for ARB programs.
    
    On Haswell, this cuts 1-3 instructions from 183 vertex shaders in
    "Shadowrun Returns", "Shatter", and "Trine 2."  It adds 2 instructions
    to a single fragment shader in "Closure."
    
    total instructions in shared programs: 278803 -> 278546 (-0.09%)
    instructions in affected programs:     41930 -> 41673 (-0.61%)
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>

:040000 040000 e36b3a25abfddfcd79865f73c885f3bd89af034b 9a18c67434a461b0d09cb3c6487f9606cd8786b8 M	src
bisect run success
Comment 1 Marek Olšák 2014-08-11 21:31:43 UTC
The Mesa IR optimizer creates a lot of immediates when it evaluates constant expressions, but doesn't eliminate them. You can easily get hundreds of unused immediates, which is what is happening with fp-long-alu.
Comment 2 Kenneth Graunke 2014-08-13 04:15:53 UTC
That sounds pretty easy to fix, but we could also just disable the Mesa IR optimizer for ARB_fragment_programs.  Notably, in my commit, I measured gains for ARB_vp, but only losses from enabling it in ARB_fp...
Comment 3 Ian Romanick 2015-02-11 23:06:51 UTC
*** Bug 82471 has been marked as a duplicate of this bug. ***
Comment 4 Carl Worth 2015-02-12 21:36:50 UTC
commit 55a57834bf912916a5e07486b32f1778b35657f6
Author: Carl Worth <cworth@cworth.org>
Date:   Thu Feb 12 10:14:24 2015 -0800

    Revert use of Mesa IR optimizer for ARB_fragment_programs
    
    Commit f82f2fb3dc770902f1657ab1c22e6004faa3afab added use of the Mesa
    IR optimizer for both ARB_fragment_program and ARB_vertex_program, but
    only justified the vertex-program portions with measured performance
    improvements.
    
    Meanwhile, the optimizer was seen to generate hundreds of unused
    immediates without discarding them, causing failures.
    
    Discard the use of the optimizer for now to fix the regression. (In
    the future, we anticpate things moving from Mesa IR to NIR for better
    optimization anyway.)
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82477
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    
    CC: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>


bug/show.html.tmpl processed on Jan 17, 2017 at 08:49:44.
(provided by the Example extension).