[Mesa-dev] [PATCH 0/8] i965/vec4: Use Vector-float immediates.

Matt Turner mattst88 at gmail.com
Mon Dec 29 12:41:14 PST 2014


On Mon, Dec 22, 2014 at 6:30 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 12/21/2014 03:23 PM, Matt Turner wrote:
>> This series adds support to i965's vec4 backend for using vector-float
>> immediates. The shader-db results are pretty nice:
>>
>> total instructions in shared programs: 5889529 -> 5876617 (-0.22%)
>> instructions in affected programs:     465347 -> 452435 (-2.77%)
>>
>> and there's still room for improvement. It helps 4914 shaders and hurts
>> none. 50 Valley and Heaven shaders are cut by 30% and there are a few
>> that do
>>
>>    mov(8)  g25<1>F  [-1.5F, -1.5F, -0.5F, -1.5F]VF
>>    mov(8)  g27<1>F  [ 0.5F, -1.5F,  1.5F, -1.5F]VF
>>    mov(8)  g29<1>F  [-1.5F, -0.5F, -0.5F, -0.5F]VF
>>    mov(8)  g31<1>F  [ 0.5F, -0.5F,  1.5F, -0.5F]VF
>>    mov(8)  g33<1>F  [-1.5F,  0.5F, -0.5F,  0.5F]VF
>>    mov(8)  g35<1>F  [ 0.5F,  0.5F,  1.5F,  0.5F]VF
>>    mov(8)  g37<1>F  [-1.5F,  1.5F, -0.5F,  1.5F]VF
>>    mov(8)  g39<1>F  [ 0.5F,  1.5F,  1.5F,  1.5F]VF
>>
>> before using each register once in a MAD instruction. I'll have to think
>> more about a general solution that would optimize that into a single
>>
>>    mov(8)  g25<1>F  [-1.5F,  1.5F, -0.5F,  0.5F]VF
>>
>> and then sources it 8 times with different swizzles. Probably something
>> like the constant-combining pass I've floated for the FS backend.
>
> There is (was?) code to do a similar thing for program constants in the
> assembly shader compiler.  Maybe there's something there to borrow?
> It's a bit of a long shot...

I see _mesa_lookup_parameter_constant() which will return a constant
and a swizzle. That's probably what you're thinking of.


More information about the mesa-dev mailing list