[Mesa-dev] [PATCH 2/2] st/mesa: set MaxUnrollIterations = 64

Brian Paul brianp at vmware.com
Wed Mar 21 06:36:15 PDT 2012


On 03/21/2012 05:42 AM, Jose Fonseca wrote:
> The increase sounds good to me.
>
> But 64 seems small. SM3 allows loops up to 255 iterations, and Microsoft HLSL compiler will unroll loops that big.

I'm happy to raise the limit higher.  If there's no objections let's 
go with 255.


> Although I wonder why we don't simply unroll everything until we hit PIPE_SHADER_CAP_MAX_INSTRUCTIONS too, when options->EmitNoLoops is false.

Luca Barbieri wrote this code in commit 
b37459388b22fb6a831d45bc08e51cdb7b9c610c.

I'd be happy to set the MaxUnrollIterations unconditionally, without 
regard to EmitNoLoops.  I was just trying to make the least invasive 
change to fix the problem at hand (and I think I'd still prefer to do 
that for the time being).

We have to be careful with # of instructions vs. # of iterations. 
Most loops have at least two instructions so 
PIPE_SHADER_CAP_MAX_INSTRUCTIONS/2 would seem to be a better choice. 
Though even that's probably unneccesarily large.

I guess the key question is do we want smaller shaders with loops or 
larger shaders without loops?

-Brian


More information about the mesa-dev mailing list