[Mesa-dev] [PATCH] nir: add some comparison simplifications

Timothy Arceri tarceri at itsqueeze.com
Fri Mar 16 21:51:08 UTC 2018


Ok feel free to push your patch with :

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 17/03/18 02:19, Ian Romanick wrote:
> On 03/16/2018 07:37 AM, Ian Romanick wrote:
>> I have basically the same patch setting in my simple-range-analysis tree.
>>
>> https://cgit.freedesktop.org/~idr/mesa/commit/?h=simple-range-analysis&id=e9d29d71304347f8ff904294450a398e5838f49a
>>
>> As Jason mentions, you don't need to explicitly mention the compares.
>> You don't need the @bool either... the source of b2[fi] is always bool.
>>
>> IIRC, adding the b2f versions helps some other shaders too.  I'm
>> (re-)gathering shader-db stats right now...
> 
> The shader that lost SIMD16 is one of the Tomb Raider shaders that had a
> loop unrolled.  The results on other Intel platforms are similar.
> 
> Skylake
> total instructions in shared programs: 14391653 -> 14390468 (<.01%)
> instructions in affected programs: 111891 -> 110706 (-1.06%)
> helped: 501
> HURT: 0
> helped stats (abs) min: 1 max: 155 x̄: 2.37 x̃: 1
> helped stats (rel) min: 0.05% max: 21.54% x̄: 1.61% x̃: 1.01%
> 95% mean confidence interval for instructions value: -3.23 -1.50
> 95% mean confidence interval for instructions %-change: -1.77% -1.45%
> Instructions are helped.
> 
> total cycles in shared programs: 532793024 -> 532776598 (<.01%)
> cycles in affected programs: 987682 -> 971256 (-1.66%)
> helped: 348
> HURT: 41
> helped stats (abs) min: 1 max: 3074 x̄: 54.91 x̃: 18
> helped stats (rel) min: 0.05% max: 32.24% x̄: 3.36% x̃: 1.68%
> HURT stats (abs)   min: 1 max: 422 x̄: 65.39 x̃: 24
> HURT stats (rel)   min: 0.09% max: 39.29% x̄: 9.50% x̃: 2.02%
> 95% mean confidence interval for cycles value: -64.08 -20.38
> 95% mean confidence interval for cycles %-change: -2.78% -1.23%
> Cycles are helped.
> 
> total loops in shared programs: 4854 -> 4829 (-0.52%)
> loops in affected programs: 27 -> 2 (-92.59%)
> helped: 18
> HURT: 0
> helped stats (abs) min: 1 max: 8 x̄: 1.39 x̃: 1
> helped stats (rel) min: 50.00% max: 100.00% x̄: 94.44% x̃: 100.00%
> 95% mean confidence interval for loops value: -2.21 -0.57
> 95% mean confidence interval for loops %-change: -102.49% -86.40%
> Loops are helped.
> 
> LOST:   1
> GAINED: 0
> 
>> On 03/15/2018 08:53 PM, Timothy Arceri wrote:
>>> These can be found in the Tomb Raider shaders, eliminating them
>>> helps unroll more loops.
>>> ---
>>>   src/compiler/nir/nir_opt_algebraic.py | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
>>> index c9575e6be4..56dfc53043 100644
>>> --- a/src/compiler/nir/nir_opt_algebraic.py
>>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>>> @@ -152,6 +152,10 @@ optimizations = [
>>>      (('inot', ('ige', a, b)), ('ilt', a, b)),
>>>      (('inot', ('ieq', a, b)), ('ine', a, b)),
>>>      (('inot', ('ine', a, b)), ('ieq', a, b)),
>>> +   (('ine', ('b2i', ('ige', a, b)), 0), ('ige', a, b)),
>>> +   (('ine', ('b2i', ('ilt', a, b)), 0), ('ilt', a, b)),
>>> +   (('ine', ('b2i', ('ult', a, b)), 0), ('ult', a, b)),
>>> +   (('ine', ('b2i', ('ine', a, b)), 0), ('ine', a, b)),
>>>   
>>>      # 0.0 >= b2f(a)
>>>      # b2f(a) <= 0.0
>>>
>>
>> _______________________________________________
>> 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