[Mesa-dev] [PATCH 11/22 v2] nir: Recognize some more open-coded fmin / fmax

Jason Ekstrand jason at jlekstrand.net
Mon Mar 5 22:07:45 UTC 2018


On Mon, Mar 5, 2018 at 11:11 AM, Ian Romanick <idr at freedesktop.org> wrote:

> On 02/28/2018 12:48 PM, Jason Ekstrand wrote:
> > Rb
>
> For both or just this one?
>

If you put the ~ on there, both.


> > On Wed, Feb 28, 2018 at 12:18 PM, Ian Romanick <idr at freedesktop.org
> > <mailto:idr at freedesktop.org>> wrote:
> >
> >     From: Ian Romanick <ian.d.romanick at intel.com
> >     <mailto:ian.d.romanick at intel.com>>
> >
> >     This transformation is inexact because section 4.7.1 (Range and
> >     Precision) says:
> >
> >         Operations and built-in functions that operate on a NaN are not
> >         required to return a NaN as the result.
> >
> >     The fmin or fmax might not return NaN in cases where the original
> >     expression would be required to return NaN.
> >
> >     v2: Reorder operands and mark as inexact.  The latter suggested by
> >     Jason.
> >
> >     shader-db results:
> >
> >     Haswell, Broadwell, and Skylake had similar results. (Skylake shown)
> >     total instructions in shared programs: 14514817 -> 14514808 (<.01%)
> >     instructions in affected programs: 229 -> 220 (-3.93%)
> >     helped: 3
> >     HURT: 0
> >     helped stats (abs) min: 1 max: 4 x̄: 3.00 x̃: 4
> >     helped stats (rel) min: 2.86% max: 4.12% x̄: 3.70% x̃: 4.12%
> >
> >     total cycles in shared programs: 533145211 -> 533144939 (<.01%)
> >     cycles in affected programs: 37268 -> 36996 (-0.73%)
> >     helped: 8
> >     HURT: 0
> >     helped stats (abs) min: 2 max: 134 x̄: 34.00 x̃: 2
> >     helped stats (rel) min: 0.02% max: 14.22% x̄: 3.53% x̃: 0.05%
> >
> >     Sandy Bridge and Ivy Bridge had similar results. (Ivy Bridge shown)
> >     total cycles in shared programs: 257618409 -> 257618403 (<.01%)
> >     cycles in affected programs: 12582 -> 12576 (-0.05%)
> >     helped: 3
> >     HURT: 0
> >     helped stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
> >     helped stats (rel) min: 0.05% max: 0.05% x̄: 0.05% x̃: 0.05%
> >
> >     No changes on Iron Lake or GM45.
> >
> >     Signed-off-by: Ian Romanick <ian.d.romanick at intel.com
> >     <mailto:ian.d.romanick at intel.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 d40d59b..17f4d9c 100644
> >     --- a/src/compiler/nir/nir_opt_algebraic.py
> >     +++ b/src/compiler/nir/nir_opt_algebraic.py
> >     @@ -170,6 +170,8 @@ optimizations = [
> >         (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
> >         (('bcsel', ('flt', b, a), b, a), ('fmin', a, b)),
> >         (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),
> >     +   (('~bcsel', ('fge', a, b), b, a), ('fmin', a, b)),
> >     +   (('~bcsel', ('fge', b, a), b, a), ('fmax', a, b)),
> >         (('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
> >         (('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
> >         (('bcsel', a, True, 'b at bool'), ('ior', a, b)),
> >     --
> >     2.9.5
> >
> >     _______________________________________________
> >     mesa-dev mailing list
> >     mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.
> freedesktop.org>
> >     https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >     <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180305/4fa7674c/attachment-0001.html>


More information about the mesa-dev mailing list