[Mesa-dev] [PATCH 0/2][RFC] Rework how glsl runs optimization passes

Thomas Helland thomashelland90 at gmail.com
Sun Nov 13 01:29:08 UTC 2016


After looking into how optimization passes are run, it became apparent
that most glsl optimization passes only show benefit of one run.
My idea was that some optimization passes will snowball on each other,
while others that provide no initial benefit probably never will.
Therefore, rework so that passes that only passes that made progress
will be rerun, while the rest will get dropped.

I'm not perfectly happy with the hack of passing the index into the
optimization macro, and I'm considering other ways of solving this.
An enum of sorts might be a possibility. This is probably also not
the most ideal way of reducing runs of compiler passes. A carefully
though out order of passes that is run only once (like LLVM does)
is  probably better, but that would be more involved.

There are no piglit regresions, and shader-db shows no changes for 
fills, spills, loops, or instruction count. However, cycle count shows 
a ridiculous improvement:

total cycles in shared programs: 1344569689 -> 90702114 (-93.25%)
cycles in affected programs: 1334668075 -> 80800500 (-93.95%)
helped: 229
HURT: 375

It seems to be mostly shaders that either regress massively,
or improve massively. One example that shows this behavioy is:

./shaders/glamor/74.shader_test FS SIMD8:    104 -> 65586 (62963.46%)

So I'm not sure if these results are thustworthy.

Thoughts on the aproach are welcome. This is more of a suggestion
than anything, as there is probably differing ideas about this.

Thomas Helland (2):
  glsl: Add a way to skip passes when they're ineffective
  glsl: Only call do_common_optimization once

 src/compiler/glsl/glsl_parser_extras.cpp | 151 +++++++++++++++++--------------
 1 file changed, 83 insertions(+), 68 deletions(-)

-- 
2.9.3



More information about the mesa-dev mailing list