[Mesa-dev] [PATCH 07/10] nir: add imprecise flrp optimisation

Jason Ekstrand jason at jlekstrand.net
Sat Jan 7 20:35:47 UTC 2017


On Jan 7, 2017 12:07 PM, "Timothy Arceri" <timothy.arceri at collabora.com>
wrote:

On Sat, 2017-01-07 at 11:14 -0800, Matt Turner wrote:
> On Sat, Jan 7, 2017 at 3:58 AM, Timothy Arceri
> <timothy.arceri at collabora.com> wrote:
> > On BDW:
> >
> > total instructions in shared programs: 13061890 -> 13061877 (-
> > 0.00%)
> > instructions in affected programs: 2441 -> 2428 (-0.53%)
> > helped: 13
> > HURT: 0
> >
> > total cycles in shared programs: 256612254 -> 256611784 (-0.00%)
> > cycles in affected programs: 16418 -> 15948 (-2.86%)
> > helped: 10
> > HURT: 2
> > ---
> >  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 fa9f3f1..7cee378 100644
> > --- a/src/compiler/nir/nir_opt_algebraic.py
> > +++ b/src/compiler/nir/nir_opt_algebraic.py
> > @@ -111,6 +111,7 @@ optimizations = [
> >     (('~flrp', a, b, 1.0), b),
> >     (('~flrp', a, a, b), a),
> >     (('~flrp', 0.0, a, b), ('fmul', a, b)),
> > +   (('~flrp', a, 0.0, c), ('ffma', ('fneg', a), c, a), '!options-
> > >lower_ffma'),
>
> I don't think we want to be generating ffma directly in
> nir_opt_algebraic?

We already have:

(('~fadd', ('fmul', a, b), c), ('ffma', a, b, c), 'options-
>fuse_ffma'),

Is you concern backends that don't want ffma? The !options->lower_ffma
should avoid  problems there. Or I could switch to using options->fuse_ffma
(I assume i965 is using it).


In i965 we've generally taken the approach that you should do mul+add and
let the ffma peephole sort it out.

> _______________________________________________
> 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/20170107/11cbb644/attachment.html>


More information about the mesa-dev mailing list