[Mesa-dev] [PATCH] nir: add is_used_once for fmul(fexp2(a), fexp2(b)) to fexp2(fadd(a, b))

Bas Nieuwenhuizen basni at chromium.org
Wed Feb 21 11:46:06 UTC 2018


Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

On Thu, Feb 15, 2018 at 10:56 PM, Timothy Arceri <tarceri at itsqueeze.com>
wrote:

> Here are the IVB shader-db results:
>
> instructions helped:   shaders/closed/steam/dex/63.shader_test FS SIMD8:
> 1303 -> 1300 (-0.23%)
> instructions helped:   shaders/closed/steam/gang-beasts/111.shader_test
> FS SIMD8: 1303 -> 1300 (-0.23%)
> instructions helped: shaders/closed/steam/rocketsrocketsrockets/81.shader_test
> FS SIMD8: 1303 -> 1300 (-0.23%)
> instructions helped: shaders/closed/steam/kerbal-space-program/687.shader_test
> FS SIMD8: 1303 -> 1300 (-0.23%)
> instructions helped: shaders/closed/steam/chivalry-
> medieval-warfare/834.shader_test FS SIMD16: 391 -> 389 (-0.51%)
> instructions helped: shaders/closed/steam/saints-row-the-third/834.shader_test
> FS SIMD16: 391 -> 389 (-0.51%)
> instructions helped: shaders/closed/steam/chivalry-
> medieval-warfare/834.shader_test FS SIMD8: 338 -> 336 (-0.59%)
> instructions helped: shaders/closed/steam/saints-row-the-third/834.shader_test
> FS SIMD8: 338 -> 336 (-0.59%)
> instructions helped: shaders/closed/steam/dota-2-reborn/1243.shader_test
> FS SIMD16: 148 -> 141 (-4.73%)
> instructions helped:   shaders/closed/steam-big-picture/1.shader_test FS
> SIMD16: 145 -> 138 (-4.83%)
> instructions helped: shaders/closed/steam/dota-2-reborn/1243.shader_test
> FS SIMD8: 100 -> 93 (-7.00%)
> instructions helped:   shaders/closed/steam-big-picture/1.shader_test FS
> SIMD8: 97 -> 90 (-7.22%)
>
> instructions HURT: shaders/closed/UnrealEngine4/VehicleGame/234.shader_test
> FS SIMD8: 146 -> 147 (0.68%)
> instructions HURT: shaders/closed/UnrealEngine4/L
> ightroominteriorday/175.shader_test FS SIMD8: 139 -> 140 (0.72%)
> instructions HURT: shaders/closed/UnrealEngine4/VehicleGame/234.shader_test
> FS SIMD16: 178 -> 180 (1.12%)
> instructions HURT: shaders/closed/UnrealEngine4/L
> ightroominteriorday/175.shader_test FS SIMD16: 171 -> 173 (1.17%)
>
> cycles helped: shaders/closed/steam/chivalry-
> medieval-warfare/834.shader_test FS SIMD8: 2790 -> 2784 (-0.22%)
> cycles helped: shaders/closed/steam/saints-row-the-third/834.shader_test
> FS SIMD8: 2790 -> 2784 (-0.22%)
> cycles helped: shaders/closed/steam/chivalry-
> medieval-warfare/834.shader_test FS SIMD16: 3399 -> 3383 (-0.47%)
> cycles helped: shaders/closed/steam/saints-row-the-third/834.shader_test
> FS SIMD16: 3399 -> 3383 (-0.47%)
> cycles helped: shaders/closed/UnrealEngine4/VehicleGame/234.shader_test
> FS SIMD8: 7944 -> 7904 (-0.50%)
> cycles helped: shaders/closed/UnrealEngine4/L
> ightroominteriorday/175.shader_test FS SIMD8: 7726 -> 7686 (-0.52%)
> cycles helped: shaders/closed/UnrealEngine4/VehicleGame/234.shader_test
> FS SIMD16: 10557 -> 10471 (-0.81%)
> cycles helped: shaders/closed/UnrealEngine4/L
> ightroominteriorday/175.shader_test FS SIMD16: 10335 -> 10249 (-0.83%)
> cycles helped:   shaders/closed/steam/dota-2-reborn/1243.shader_test FS
> SIMD16: 974 -> 883 (-9.34%)
> cycles helped:   shaders/closed/steam/dota-2-reborn/1243.shader_test FS
> SIMD8: 951 -> 841 (-11.57%)
> cycles helped:   shaders/closed/steam-big-picture/1.shader_test FS
> SIMD16: 1155 -> 958 (-17.06%)
> cycles helped:   shaders/closed/steam-big-picture/1.shader_test FS SIMD8:
> 1056 -> 845 (-19.98%)
>
> cycles HURT:   shaders/closed/steam/dex/63.shader_test FS SIMD8: 13165 ->
> 13240 (0.57%)
> cycles HURT:   shaders/closed/steam/gang-beasts/111.shader_test FS SIMD8:
> 13165 -> 13240 (0.57%)
> cycles HURT:   shaders/closed/steam/rocketsrocketsrockets/81.shader_test
> FS SIMD8: 13165 -> 13240 (0.57%)
> cycles HURT:   shaders/closed/steam/kerbal-space-program/687.shader_test
> FS SIMD8: 13165 -> 13240 (0.57%)
> cycles HURT:   shaders/closed/steam/dungeon-defenders/8409.shader_test FS
> SIMD8: 573 -> 579 (1.05%)
> cycles HURT:   shaders/closed/steam/dungeon-defenders/8409.shader_test FS
> SIMD16: 635 -> 645 (1.57%)
>
> total instructions in shared programs: 10114499 -> 10114457 (-0.00%)
> instructions in affected programs: 7794 -> 7752 (-0.54%)
> helped: 12
> HURT: 4
>
> total cycles in shared programs: 230925909 -> 230925320 (-0.00%)
> cycles in affected programs: 106944 -> 106355 (-0.55%)
> helped: 12
> HURT: 6
>
> total loops in shared programs: 2436 -> 2436 (0.00%)
> loops in affected programs: 0 -> 0
> helped: 0
> HURT: 0
>
> total spills in shared programs: 5435 -> 5435 (0.00%)
> spills in affected programs: 0 -> 0
> helped: 0
> HURT: 0
>
> total fills in shared programs: 6069 -> 6069 (0.00%)
> fills in affected programs: 0 -> 0
> helped: 0
> HURT: 0
>
> LOST:   0
> GAINED: 0
>
>
> On 15/02/18 12:36, Ian Romanick wrote:
>
>> Do you have shader-db results?  Did you try having only one is_used_once?
>>
>> On 02/05/2018 07:07 AM, Samuel Pitoiset wrote:
>>
>>> Otherwise the code size increases because the original fexp2()
>>> instructions can't be deleted.
>>>
>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>> ---
>>>   src/compiler/nir/nir_opt_algebraic.py | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/compiler/nir/nir_opt_algebraic.py
>>> b/src/compiler/nir/nir_opt_algebraic.py
>>> index b30d1df199..d40d59b5cd 100644
>>> --- a/src/compiler/nir/nir_opt_algebraic.py
>>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>>> @@ -336,7 +336,7 @@ optimizations = [
>>>      (('~flog2', ('frcp', a)), ('fneg', ('flog2', a))),
>>>      (('~flog2', ('frsq', a)), ('fmul', -0.5, ('flog2', a))),
>>>      (('~flog2', ('fpow', a, b)), ('fmul', b, ('flog2', a))),
>>> -   (('~fmul', ('fexp2', a), ('fexp2', b)), ('fexp2', ('fadd', a, b))),
>>> +   (('~fmul', ('fexp2(is_used_once)', a), ('fexp2(is_used_once)', b)),
>>> ('fexp2', ('fadd', a, b))),
>>>      # Division and reciprocal
>>>      (('~fdiv', 1.0, a), ('frcp', a)),
>>>      (('fdiv', a, b), ('fmul', a, ('frcp', b)), 'options->lower_fdiv'),
>>>
>>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180221/13abf9b6/attachment.html>


More information about the mesa-dev mailing list