Yep, I start to read it and it is clearly what I was looking for. But I am 
still wondering if this is so useful to make it here since some back ends (like 
Intel GPU fragment programs and maybe g80s (???) ) use struct of array layouts 
which do not need swizzle.  

BTW, the simpler solution for these machines should be to transform the Mesa 
GPU code into a scalar code. So:
** mul a b c 
becomes
mul a.x b.xxxx c.xxxx
mul a.y b.yyyy c.yyyy
mul a.z b.zzzz c.zzzz
mul a.w b.wwww c.wwww
and then, we re-analyze the program as a scalar one.

Anyway, it may be still nice to have better programs higher in the sw stack.

Thanks for your help. I am studying the r300 code

Ben
 
________________________________________
From: Tom Stellard [tstel...@gmail.com]
Sent: Wednesday, July 14, 2010 10:33 PM
To: Segovia, Benjamin
Cc: mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] Optimizations in mesa shader compiler

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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to