[Mesa-dev] Clamp/saturate optimizations v3

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Thu Aug 28 09:23:45 PDT 2014



On 26.08.2014 15:17, Abdiel Janulgue wrote:
> On 23.08.2014 02:57, Ian Romanick wrote:
>> Patches 2, 3, 4, 5, 6, 9, 10, 11, 12, 15, and 17 are
>>
>> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>>
>> (Additional question below.)
>>
>> On 08/18/2014 05:17 AM, Abdiel Janulgue wrote:
>>> v3 of clamp and saturate optimizations
>>>
>>> Changes since v1: 
>>>  - Only remove the old try_emit_saturate operations after the new optimizations are
>>>    in place. (Matt, Ian)
>>>  - Output [min/max](saturate(x),b) instead of saturate([min/max](x,b)) as suggested
>>>    by Ilia Mirkin.
>>>  - The change above required some refactoring in the fs/vec4 backend to allow
>>>    propagation of certain instructions with saturate flag to SEL. For other instructions,
>>>    we don't propagate saturate instructions, similar to the previous behaviour.
>>> Since v2:
>>>  - Fix comments to reflect we are doing a commutative operation, add missing conditions
>>>    when optimizing clamp in opt_algebraic pass.
>>>  - Refactor try_emit_saturate() in i965/fs instead of completely removing it. This fixed a
>>>    a regression where the changes emitted an (extra) unnecessary saturated mov when the 
>>>    expression generating src can do saturate directly instead.
>>>  - Fix regression in the i965/vec4 copy-propagate optimization caused by ignoring 
>>>    channels in the propagated instruction.
>>>  - Count generated loops from the fs/vec4 generator.
>>>
>>> Results from our shader-db:
>>>
>>> total instructions in shared programs: 4538627 -> 4560104 (0.47%)
>>> instructions in affected programs:     45144 -> 66621 (47.57%)
>>> total loops in shared programs:        887 -> 711 (-19.84%)
>>> GAINED:                                0
>>> LOST:                                  36
>>
>> Can we try benchmarking the applications that have shaders that lost
>> SIMD16 before pushing these changes?  I'd hate to have an "optimization"
>> that actually makes performance worse. :(
> 
> There were a couple of games that lost simd16: heroes-of-newerth and
> savage2. However, it is interesting that the same games also reported an
> even higher amount of shaders that gained improvements (loop reductions
> and instruction count reduction) with the saturate optimizations
> switched on.
> 
> I did a preliminary comparison on HoN:
> 
> x Heroes_Of_Newearth_master
> + Heroes_Of_Newearth_sat_fixes
> 
>     N           Min           Max        Median           Avg    Stddev
> x  11          53.1          55.8          55.1     54.872727 0.83317574
> +  11          54.2            56          55.1     55.036364 0.59375538
> No difference proven at 95.0% confidence
> 
> I'll post the results of savage2 as soon as I get it running.

Savage 2 results (maximum-quality settings, AA turned off):

x savage2.master
+ savage2.sat_fixes

    N           Min           Max        Median           Avg     Stddev
x  11          16.1          35.2          29.7     27.881818  5.7516638
+  11          18.2            35          30.7     28.718182  5.4258305
No difference proven at 95.0% confidence

Both of the apps are tested on IVB.


More information about the mesa-dev mailing list