[Mesa-dev] [PATCH] Better GPU program optimization in Mesa front end

Tom Stellard tstellar at gmail.com
Mon Jul 19 23:11:43 PDT 2010


On Mon, Jul 19, 2010 at 04:01:02PM -0700, Benjamin Segovia wrote:
> - Improved optimization of GPU programs. Now, swizzling is taken into account
>   and swizzles are properly transformed while removing mov instructions.
>   Removals of mov instructions are now much more effective
> 
> - Analysis of control flows is still very primitive and far more too
>   conservative. Shaders using a lot of branches will be less optimized than
>   straightforward ones
> 
> - Main things to do next is:
>    * instruction merging like for example merging:
>        mul a.x b.x c.x
>        mul a.y b.y c.y
>        mul a.z b.z c.z
>      into
>        mul a.xyz b.xyz c.xyz
>    * register renaming to avoid some still unecessary movs
> 

> - Tested with piglit. I run all the shaders and compare output from the new
>   version with the old one. Also, run openarena, nexuiz and warsow. All games
>   perfectly run and GPU code is clearly improved. Note that I only use my Intel
>   Gen GPU for the backend. So everything was tested using classic Mesa with
>   the Intel i965 driver.

Hi,

I tried this patch out with the r300 backend and it looks pretty good.
I didn't do very extensive testing or anything, but the code output from
the mesa compiler is much better.

I think the instruction merging will make a big difference
once you get it done.  I've seen a lot of shaders like this one:
https://bugs.freedesktop.org/attachment.cgi?id=36940 from fdo bug #28860
that waste a lot of instructions doing single component moves.

Nice work!

-Tom


More information about the mesa-dev mailing list