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

Ian Romanick idr at freedesktop.org
Thu Mar 22 10:45:58 PDT 2012


On 03/21/2012 06:36 AM, Brian Paul wrote:
> 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?

Unfortunately, the answer to that question depends entirely on the 
hardware and on the size of the loop body (usually).  We're still in 
want of a better loop unroller.

The other issue, that has been noted by at least one piglit test, is 
that allowing huge amounts of unrolling can cause compile times to 
explode to unacceptable levels.


More information about the mesa-dev mailing list