[Mesa-dev] Optimizations in mesa shader compiler

Tom Stellard tstellar at gmail.com
Wed Jul 14 21:33:33 PDT 2010


On Wed, Jul 14, 2010 at 09:16:15PM -0700, Segovia, Benjamin wrote:
> Thanks for that. It may be clearly useful.
> 
> FYW, I output big shaders from nexuiz (> 100 inst) and clearly swizzling kills opportunities of optimizations. A serie of instructions may be totally useless but swizzles make the flow analysis more complicated. 
> For big nexuiz fragment shaders, almost all the moves may be removed. This may lead to remove almost 40% of the instructions in these cases.
> 
> I am not sure of the final speed up at the end. Intel GPUs use SoA computations for the fragment programs. So, it should be easy to completely remove the swizzle and to consider everything scalar. In that case, flow analysis becomes easier. 
> However, despite that, the Intel Gen output still includes uncessary moves in particular from GPR to message registers. Not sure it is still related.
> 
> Hmmm. Cool. We may be able anyway to make it faster :)
> 
> Ben
>

Hi,

As Alex suggested, take a look at the r300 compiler.  If you are
looking to eliminate  MOV instructions, the peephole() function in
src/mesa/drivers/dri/r300/compiler/radeon_optimize.c might interest you.
It does copy propagation and is a good example of dataflow analysis
with swizzles.

-Tom


More information about the mesa-dev mailing list