[Mesa-dev] [PATCH] nir: optimize iand(ieq(a, 0), ieq(b, 0)) to ieq(ior(a, b), 0)

Timothy Arceri tarceri at itsqueeze.com
Thu May 31 02:32:33 UTC 2018


On 31/05/18 10:44, Ian Romanick wrote:
> On 05/30/2018 01:48 AM, Samuel Pitoiset wrote:
>> Totals from affected shaders:
>> SGPRS: 80 -> 80 (0.00 %)
>> VGPRS: 48 -> 48 (0.00 %)
>> Code Size: 2120 -> 2096 (-1.13 %) bytes
>> Max Waves: 16 -> 16 (0.00 %)
>>
>> Only two Rise of Tomb Raider shaders are affected on my side.
> 
> I got:
> 
> total instructions in shared programs: 14371513 -> 14371511 (<.01%)
> instructions in affected programs: 155 -> 153 (-1.29%)
> helped: 1
> HURT: 0
> 
> total cycles in shared programs: 532435951 -> 532435927 (<.01%)
> cycles in affected programs: 16696 -> 16672 (-0.14%)
> helped: 1
> HURT: 0
> 
> The only shader affected was a compute shader in Deus Ex.  It looks like
> we don't have RotTR in our shader-db, so we'll have to fix that.

RotTR is Vulkan only. Samuel's results are for vkpipeline-db [1] rather 
than shader-db. Not sure if you guys are building a collection for that 
yet or not.

[1] https://cgit.freedesktop.org/mesa/vkpipeline-db/

> 
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> 
>> Cc: Ian Romanick <ian.d.romanick at intel.com>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/compiler/nir/nir_opt_algebraic.py | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
>> index 909ea3daf4..95b5813bd7 100644
>> --- a/src/compiler/nir/nir_opt_algebraic.py
>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>> @@ -280,6 +280,8 @@ optimizations = [
>>      (('iand', ('uge(is_used_once)', a, b), ('uge', a, c)), ('uge', a, ('umax', b, c))),
>>      (('iand', ('uge(is_used_once)', a, c), ('uge', b, c)), ('uge', ('umin', a, b), c)),
>>   
>> +   (('iand', ('ieq', 'a at 32', 0), ('ieq', 'b at 32', 0)), ('ieq', ('ior', 'a at 32', 'b at 32'), 0)),
>> +
>>      # These patterns can result when (a < b || a < c) => (a < min(b, c))
>>      # transformations occur before constant propagation and loop-unrolling.
>>      (('~flt', a, ('fmax', b, a)), ('flt', a, b)),
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list