[Mesa-dev] [PATCH] nir: lower fexp2(fmul(flog2(a), 2)) to fmul(a, a)

Bas Nieuwenhuizen basni at chromium.org
Wed Feb 21 11:45:26 UTC 2018


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

On Wed, Feb 7, 2018 at 10:29 AM, Samuel Pitoiset <samuel.pitoiset at gmail.com>
wrote:

>
>
> On 02/06/2018 12:29 AM, Ian Romanick wrote:
>
>> Do you have any data from shader-db for this change (and the other patch)?
>>
>
> We didn't see any changes for this patch on ivy bridge, but it helps when
> fpow is lowered.
>
> shader-db results for the other patch https://hastebin.com/gajajodebo.hs
> on ivy bridge, seems good overall.
>
>
>
>> On 02/05/2018 06:08 AM, Samuel Pitoiset wrote:
>>
>>> Similar for the 4 case.
>>>
>>> Suggested by Bas.
>>>
>>> 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 6dc19d9b12..b30d1df199 100644
>>> --- a/src/compiler/nir/nir_opt_algebraic.py
>>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>>> @@ -321,6 +321,8 @@ optimizations = [
>>>      (('~fexp2', ('fmul', ('flog2', a), b)), ('fpow', a, b),
>>> '!options->lower_fpow'), # 2^(lg2(a)*b) = a^b
>>>      (('~fexp2', ('fadd', ('fmul', ('flog2', a), b), ('fmul', ('flog2',
>>> c), d))),
>>>       ('~fmul', ('fpow', a, b), ('fpow', c, d)),
>>> '!options->lower_fpow'), # 2^(lg2(a) * b + lg2(c) + d) = a^b * c^d
>>> +   (('~fexp2', ('fmul', ('flog2', a), 2.0)), ('fmul', a, a)),
>>> +   (('~fexp2', ('fmul', ('flog2', a), 4.0)), ('fmul', ('fmul', a, a),
>>> ('fmul', a, a))),
>>>      (('~fpow', a, 1.0), a),
>>>      (('~fpow', a, 2.0), ('fmul', a, a)),
>>>      (('~fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),
>>>
>>>
>> _______________________________________________
> 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/5d53b2dd/attachment-0001.html>


More information about the mesa-dev mailing list