Re: [Mesa-dev] [PATCH 3/6] nir: Turn -(b2f(a) + b2f(b) >= 0 into !(a || b).
> > > > For now, this patch is > > > > Reviewed-by: Ian Romanick > I had a hard time parsing the title: "Turn -(b2f(a) + b2f(b) >= 0 into !(a || b)" at first, until I saw the replacement instructions. You're missing a ')' on the commit line. :) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/6] nir: Turn -(b2f(a) + b2f(b) >= 0 into !(a || b).
On Wednesday, August 10, 2016 10:58:49 AM PDT Ian Romanick wrote: > On 08/09/2016 07:30 PM, Kenneth Graunke wrote: > > On Haswell (GL 3.3): > > > > total instructions in shared programs: 6211485 -> 6211427 (-0.00%) > > instructions in affected programs: 16260 -> 16202 (-0.36%) > > helped: 25 > > HURT: 37 > > > > On Broadwell (GL 4.4): > > > > total instructions in shared programs: 11640288 -> 11640218 (-0.00%) > > instructions in affected programs: 16313 -> 16243 (-0.43%) > > helped: 27 > > HURT: 37 > > Interesting... I had a similar version of this that worked on arbitrary > length sequences of (b2f(a_0) + .. b2f(a_n)), but I didn't get any > benefit. I also had tests for a couple other relational operators with > 0 that didn't see benefit. Maybe one of us should try to revive my old, > more generic series at some point. > > For now, this patch is > > Reviewed-by: Ian Romanick I believe I first saw this sequence after my bcsel -1.0 -0.0 optimization. I also imported over 11,000 more shaders recently - probably after you last did this experiment. signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/6] nir: Turn -(b2f(a) + b2f(b) >= 0 into !(a || b).
On 08/09/2016 07:30 PM, Kenneth Graunke wrote: > On Haswell (GL 3.3): > > total instructions in shared programs: 6211485 -> 6211427 (-0.00%) > instructions in affected programs: 16260 -> 16202 (-0.36%) > helped: 25 > HURT: 37 > > On Broadwell (GL 4.4): > > total instructions in shared programs: 11640288 -> 11640218 (-0.00%) > instructions in affected programs: 16313 -> 16243 (-0.43%) > helped: 27 > HURT: 37 Interesting... I had a similar version of this that worked on arbitrary length sequences of (b2f(a_0) + .. b2f(a_n)), but I didn't get any benefit. I also had tests for a couple other relational operators with 0 that didn't see benefit. Maybe one of us should try to revive my old, more generic series at some point. For now, this patch is Reviewed-by: Ian Romanick > Signed-off-by: Kenneth Graunke > --- > src/compiler/nir/nir_opt_algebraic.py | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/compiler/nir/nir_opt_algebraic.py > b/src/compiler/nir/nir_opt_algebraic.py > index 4e9896f..ef87d4d 100644 > --- a/src/compiler/nir/nir_opt_algebraic.py > +++ b/src/compiler/nir/nir_opt_algebraic.py > @@ -135,6 +135,9 @@ optimizations = [ > # inot(a) > (('fge', 0.0, ('b2f', a)), ('inot', a)), > > + # -(b2f(a) + b2f(b)) >= 0 becomes !(a || b) > + (('fge', ('fneg', ('fadd', ('b2f', 'a@bool'), ('b2f', 'b@bool'))), 0.0), > ('inot', ('ior', a, b))), > + > # 0.0 < fabs(a) > # fabs(a) > 0.0 > # fabs(a) != 0.0 because fabs(a) must be >= 0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] nir: Turn -(b2f(a) + b2f(b) >= 0 into !(a || b).
On Haswell (GL 3.3): total instructions in shared programs: 6211485 -> 6211427 (-0.00%) instructions in affected programs: 16260 -> 16202 (-0.36%) helped: 25 HURT: 37 On Broadwell (GL 4.4): total instructions in shared programs: 11640288 -> 11640218 (-0.00%) instructions in affected programs: 16313 -> 16243 (-0.43%) helped: 27 HURT: 37 Signed-off-by: Kenneth Graunke --- src/compiler/nir/nir_opt_algebraic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 4e9896f..ef87d4d 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -135,6 +135,9 @@ optimizations = [ # inot(a) (('fge', 0.0, ('b2f', a)), ('inot', a)), + # -(b2f(a) + b2f(b)) >= 0 becomes !(a || b) + (('fge', ('fneg', ('fadd', ('b2f', 'a@bool'), ('b2f', 'b@bool'))), 0.0), ('inot', ('ior', a, b))), + # 0.0 < fabs(a) # fabs(a) > 0.0 # fabs(a) != 0.0 because fabs(a) must be >= 0 -- 2.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev