[Mesa-dev] [PATCH 03/22] nir/algebraic: Add some max/min optimizations

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Aug 17 22:33:02 UTC 2018


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

On Fri, Aug 17, 2018 at 10:06 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> Found by inspection.  This doesn't help much now but we'll see this
> pattern with images if you load UNORM and then store UNORM.
>
> Shader-db results on Kaby Lake:
>
>     total instructions in shared programs: 15166916 -> 15166910 (<.01%)
>     instructions in affected programs: 761 -> 755 (-0.79%)
>     helped: 6
>     HURT: 0
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
> index 07fbb161a4e..55a1feeaf47 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -302,6 +302,12 @@ optimizations = [
>     (('imax', a, a), a),
>     (('umin', a, a), a),
>     (('umax', a, a), a),
> +   (('fmax', ('fmax', a, b), b), ('fmax', a, b)),
> +   (('umax', ('umax', a, b), b), ('umax', a, b)),
> +   (('imax', ('imax', a, b), b), ('imax', a, b)),
> +   (('fmin', ('fmin', a, b), b), ('fmin', a, b)),
> +   (('umin', ('umin', a, b), b), ('umin', a, b)),
> +   (('imin', ('imin', a, b), b), ('imin', a, b)),
>     (('fmax', a, ('fneg', a)), ('fabs', a)),
>     (('imax', a, ('ineg', a)), ('iabs', a)),
>     (('fmin', a, ('fneg', a)), ('fneg', ('fabs', a))),
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list