[Mesa-dev] [GSoC 13]Interested in the idea: Improved application of GLSL complier optimizations

Ian Romanick idr at freedesktop.org
Tue Apr 30 09:34:02 PDT 2013


On 04/19/2013 06:04 AM, pkucoin wrote:
> Hi,
> My name is Sida Li and I am a senior student from Peking University in
> China. I am interested in the idea that
> improved application of GLSL complier optimizations.
> I have downloaded the source code and read some parts of the it. First
> let me talk about my understanding about the problem.
> The loop we try to improve should be in the main.cpp:
>   do {
>       progress = do_common_optimization(shader->ir, false, false, 32);
>   } while (progress);
> In the function do_common_optimization, all optimization passes are
> called in a certain order. As the loop goes in a few times, some
> optimization passes do not contribute to optimizing the code since the
> original unoptimized code has been optimized and no more code that can
> be optimized by these optimization passes is generated by
> other optimization passes. So time spending on these optimization passes
> is wasted.
> The goal is to find a static ordering, with possible repeats, of
> optimization passes that does not compromise the quality of the
> generated code. I find it difficult to start because a single
> optimization pass or a combo of optimization passes may generate some
> code that can be optimized by other optimization pass, which can not be
> decided before.

Since I suggested the project, I'll offer some opinions.

There are a few ways to attack this problem, I think.  Certain 
optimizations can generate opportunities for other optimizations to do 
work.  For example, copy propagation can "create" dead code.  Using this 
sort of analysis, it should be possible to come up with an initial 
ordering of passes that still uses the "while progress" loop.

Once that is done, it should be possible to instrument the code to see 
which optimization passes make progress on each pass.  This will let us 
know, for example, if do_algebraic never does anything after the first 
pass.  Then it's a matter of running the compiler on a large set of 
shaders and seeing what happens.

> Can you give me some advice?
> Best regards,
> Sida Li
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



More information about the mesa-dev mailing list