Re: [Mesa-dev] [PATCH 2/5] nir: Recognize sum of open-coded pow()s.

2016-02-08 Thread Matt Turner
On Mon, Feb 8, 2016 at 12:01 PM, Jason Ekstrand  wrote:
> On Thu, Feb 4, 2016 at 5:47 PM, Matt Turner  wrote:
>>
>> Prevents regressions in the next commit.
>> ---
>>  src/compiler/nir/nir_opt_algebraic.py | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/compiler/nir/nir_opt_algebraic.py
>> b/src/compiler/nir/nir_opt_algebraic.py
>> index 60df69f..0a248a2 100644
>> --- a/src/compiler/nir/nir_opt_algebraic.py
>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>> @@ -167,6 +167,7 @@ optimizations = [
>> (('flog2', ('fexp2', a)), a), # lg2(2^a) = a
>> (('fpow', a, b), ('fexp2', ('fmul', ('flog2', a), b)),
>> 'options->lower_fpow'), # a^b = 2^(lg2(a)*b)
>> (('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))), ('fadd', ('fpow', a, b), ('fpow', c, d))),
>
>
> I think you mean ('fmul', ('fpow', a, b), ('fpow', c, d)).  You can't pull
> an add out of an exp and get another add.

Whoops. Yes, thank you!
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/5] nir: Recognize sum of open-coded pow()s.

2016-02-08 Thread Jason Ekstrand
On Thu, Feb 4, 2016 at 5:47 PM, Matt Turner  wrote:

> Prevents regressions in the next commit.
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py
> b/src/compiler/nir/nir_opt_algebraic.py
> index 60df69f..0a248a2 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -167,6 +167,7 @@ optimizations = [
> (('flog2', ('fexp2', a)), a), # lg2(2^a) = a
> (('fpow', a, b), ('fexp2', ('fmul', ('flog2', a), b)),
> 'options->lower_fpow'), # a^b = 2^(lg2(a)*b)
> (('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))), ('fadd', ('fpow', a, b), ('fpow', c, d))),
>

I think you mean ('fmul', ('fpow', a, b), ('fpow', c, d)).  You can't pull
an add out of an exp and get another add.


> (('fpow', a, 1.0), a),
> (('fpow', a, 2.0), ('fmul', a, a)),
> (('fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),
> --
> 2.4.10
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/5] nir: Recognize sum of open-coded pow()s.

2016-02-08 Thread Jason Ekstrand
On Mon, Feb 8, 2016 at 12:18 PM, Matt Turner  wrote:

> On Mon, Feb 8, 2016 at 12:01 PM, Jason Ekstrand 
> wrote:
> > On Thu, Feb 4, 2016 at 5:47 PM, Matt Turner  wrote:
> >>
> >> Prevents regressions in the next commit.
> >> ---
> >>  src/compiler/nir/nir_opt_algebraic.py | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/src/compiler/nir/nir_opt_algebraic.py
> >> b/src/compiler/nir/nir_opt_algebraic.py
> >> index 60df69f..0a248a2 100644
> >> --- a/src/compiler/nir/nir_opt_algebraic.py
> >> +++ b/src/compiler/nir/nir_opt_algebraic.py
> >> @@ -167,6 +167,7 @@ optimizations = [
> >> (('flog2', ('fexp2', a)), a), # lg2(2^a) = a
> >> (('fpow', a, b), ('fexp2', ('fmul', ('flog2', a), b)),
> >> 'options->lower_fpow'), # a^b = 2^(lg2(a)*b)
> >> (('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))), ('fadd', ('fpow', a, b), ('fpow', c, d))),
> >
> >
> > I think you mean ('fmul', ('fpow', a, b), ('fpow', c, d)).  You can't
> pull
> > an add out of an exp and get another add.
>
> Whoops. Yes, thank you!
>

With that fixed, this one gets my R-B too.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/5] nir: Recognize sum of open-coded pow()s.

2016-02-04 Thread Matt Turner
Prevents regressions in the next commit.
---
 src/compiler/nir/nir_opt_algebraic.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 60df69f..0a248a2 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -167,6 +167,7 @@ optimizations = [
(('flog2', ('fexp2', a)), a), # lg2(2^a) = a
(('fpow', a, b), ('fexp2', ('fmul', ('flog2', a), b)), 
'options->lower_fpow'), # a^b = 2^(lg2(a)*b)
(('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))), 
('fadd', ('fpow', a, b), ('fpow', c, d))),
(('fpow', a, 1.0), a),
(('fpow', a, 2.0), ('fmul', a, a)),
(('fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),
-- 
2.4.10

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev