[Mesa-dev] [PATCH/RFC] glsl: Avoid excessive loop unrolling.

Eric Anholt eric at anholt.net
Tue Feb 7 12:25:29 PST 2012


On Mon, 30 Jan 2012 07:40:15 +0100, Mathias Fröhlich <Mathias.Froehlich at gmx.net> wrote:
> 
> Hi,
> 
> I am trying to make the shaders from a sky scattering shader work with mesa.
> One of the problems is that the shader contains a nested 16 x 32 loop with an 
> instruction intensive body. The glsl loop unrolling pass is trying to unroll 
> both loops since both of them have a fixed size <=32. Compiling this shader 
> gets stuck in do_common_optimization (= takes more than 10 minutes) since 
> unrolling and then optimizing that huge 16*32*(function body) intruction count 
> kills the runtime behavour of other optimization passes.
> 
> Attached is a change that additionally skips loop unrolling if either the loop 
> is a nested loop or the instruction count of the body times the constant 
> iteration count exceeds the former max iteration count times 5 instructions.
> This makes the above shaders at least compile within the usual fraction of a 
> second.
> 
> Comments/Review?

Does this also fix our piglit tests for the bug?  If so, note it in the
commit message, and

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120207/4360d100/attachment.pgp>


More information about the mesa-dev mailing list