[Mesa-dev] [PATCH 1/9] glsl: Optimize min/max expression trees

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Thu Aug 14 00:04:12 PDT 2014



On 14.08.2014 04:33, Ian Romanick wrote:
> On 07/29/2014 02:36 AM, Petri Latvala wrote:
>> Add an optimization pass that drops min/max expression operands that
>> can be proven to not contribute to the final result. The algorithm is
>> similar to alpha-beta pruning on a minmax search, from the field of
>> AI.
>>
>> This optimization pass can optimize min/max expressions where operands
>> are min/max expressions. Such code can appear in shaders by itself, or
>> as the result of clamp() or AMD_shader_trinary_minmax functions.
>>
>> This optimization pass improves the generated code for piglit's
>> AMD_shader_trinary_minmax tests as follows:
>>
>> total instructions in shared programs: 75 -> 67 (-10.67%)
>> instructions in affected programs:     60 -> 52 (-13.33%)
>> GAINED:                                0
>> LOST:                                  0
>>
>> All tests (max3, min3, mid3) improved.
> 
> And I assume no piglit regressions?
> 
> Also... have you tried this in combination with Abdiel's related work on
> saturates?
> 


Petteri,

What is your plan on this particular pass? I have a similar patch that
drops the min/max expression but using a different approach. Do you want
to push for this particular optimization or do you want to take over the
series?



More information about the mesa-dev mailing list