diff options
author | Timothy Arceri <[email protected]> | 2017-09-22 09:23:15 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-10-10 10:05:37 +1100 |
commit | 7a7fb90af757d8c86aec062f9fdb82c29f6a228d (patch) | |
tree | 4e5c589a1681b255b8a0e12caeafcf0a831f0bf5 /src | |
parent | 646621c66da946aa06482e70d8cbc149756c477c (diff) |
glsl: tidy up IR after loop unrolling
c7affbf6875622a enabled GLSLOptimizeConservatively on some
drivers. The idea was to speed up compile times by running
the GLSL IR passes only once each time do_common_optimization()
is called. However loop unrolling can create a big mess and
with large loops can actually case compile times to increase
significantly due to a bunch of redundant if statements being
propagated to other IRs.
Here we make sure to clean things up before moving on.
There was no measureable difference in shader-db compile times,
but it makes compile times of some piglit tests go from a couple
of seconds to basically instant.
The shader-db results seemed positive also:
Totals:
SGPRS: 2829456 -> 2828376 (-0.04 %)
VGPRS: 1720793 -> 1721457 (0.04 %)
Spilled SGPRs: 7707 -> 7707 (0.00 %)
Spilled VGPRs: 33 -> 33 (0.00 %)
Private memory VGPRs: 3140 -> 2060 (-34.39 %)
Scratch size: 3308 -> 2180 (-34.10 %) dwords per thread
Code Size: 79441464 -> 79214616 (-0.29 %) bytes
LDS: 436 -> 436 (0.00 %) blocks
Max Waves: 558670 -> 558571 (-0.02 %)
Wait states: 0 -> 0 (0.00 %)
Reviewed-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 9cbc2355f9d..764c05ad802 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -2216,7 +2216,13 @@ do_common_optimization(exec_list *ir, bool linked, if (options->MaxUnrollIterations) { loop_state *ls = analyze_loop_variables(ir); if (ls->loop_found) { - OPT(unroll_loops, ir, ls, options); + bool loop_progress = unroll_loops(ir, ls, options); + while (loop_progress) { + loop_progress = false; + loop_progress |= do_constant_propagation(ir); + loop_progress |= do_if_simplification(ir); + } + progress |= loop_progress; } delete ls; } |