diff options
author | Eric Anholt <[email protected]> | 2013-11-06 17:38:23 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-11-12 15:06:28 -0800 |
commit | e9daead784921e453906853a4a78a2f3135af2e0 (patch) | |
tree | 889cfdb316b7d80ea88bd56a1cdc3b721c172d02 /src/mesa/drivers/dri/i965/brw_fs.cpp | |
parent | fbd8303a943d0d491b7c2415eb237a0731c7dec5 (diff) |
i965/fs: Try a different pre-scheduling heuristic if the first spills.
Since LIFO fails on some shaders in one particular way, and non-LIFO
systematically fails in another way on different kinds of shaders, try
them both, and pick whichever one successfully register allocates first.
Slightly prefer non-LIFO in case we produce extra dependencies in register
allocation, since it should start out with fewer stalls than LIFO.
This is madness, but I haven't come up with another way to get unigine
tropics to not spill while keeping other programs from not spilling and
retaining the non-unigine performance wins from texture-grf.
total instructions in shared programs: 1626728 -> 1626288 (-0.03%)
instructions in affected programs: 1015 -> 575 (-43.35%)
GAINED: 50
LOST: 0
Improves Unigine Tropics performance by 14.5257% +/- 0.241838% (n=38)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70445
Cc: "10.0" <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index afa82c9abbf..f89390c346c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3286,15 +3286,28 @@ fs_visitor::run() assign_curb_setup(); assign_urb_setup(); - schedule_instructions(false); + schedule_instructions(SCHEDULE_PRE_NON_LIFO); if (0) assign_regs_trivial(); else { - while (!assign_regs()) { - if (failed) - break; - } + if (!assign_regs(false)) { + /* Try a non-spilling register allocation again with a different + * scheduling heuristic. + */ + schedule_instructions(SCHEDULE_PRE_LIFO); + if (!assign_regs(false)) { + if (dispatch_width == 16) { + fail("Failure to register allocate. Reduce number of " + "live scalar values to avoid this."); + } else { + while (!assign_regs(true)) { + if (failed) + break; + } + } + } + } } } assert(force_uncompressed_stack == 0); @@ -3309,7 +3322,7 @@ fs_visitor::run() if (failed) return false; - schedule_instructions(true); + schedule_instructions(SCHEDULE_POST); if (dispatch_width == 8) { c->prog_data.reg_blocks = brw_register_blocks(grf_used); |