[Mesa-dev] [PATCH 09/28] nir/algebraic: fix (inf - inf) = NaN case

Connor Abbott cwabbott0 at gmail.com
Wed Dec 5 18:17:50 UTC 2018


This is not acceptable, since this will disable the optimization even
when it would otherwise be allowed. Either we need to mark everything
as precise if one of these execution modes are enabled, or we need to
disable this optimization only if the appropriate preserve-NaN-and-Inf
mode is set.
On Wed, Dec 5, 2018 at 4:56 PM Samuel Iglesias Gonsálvez
<siglesias at igalia.com> wrote:
>
> If we have (inf - inf) we should return NaN, not 0.0. Same for
> (NaN - NaN) case.
>
> Fixes tests in Vulkan CTS that produce such kind subtractions.
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
> index 747f1751086..e4f77e7b952 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -91,7 +91,6 @@ optimizations = [
>     (('usadd_4x8', a, ~0), ~0),
>     (('~fadd', ('fmul', a, b), ('fmul', a, c)), ('fmul', a, ('fadd', b, c))),
>     (('iadd', ('imul', a, b), ('imul', a, c)), ('imul', a, ('iadd', b, c))),
> -   (('~fadd', ('fneg', a), a), 0.0),
>     (('iadd', ('ineg', a), a), 0),
>     (('iadd', ('ineg', a), ('iadd', a, b)), b),
>     (('iadd', a, ('iadd', ('ineg', a), b)), b),
> @@ -891,7 +890,6 @@ before_ffma_optimizations = [
>
>     (('~fadd', ('fmul', a, b), ('fmul', a, c)), ('fmul', a, ('fadd', b, c))),
>     (('iadd', ('imul', a, b), ('imul', a, c)), ('imul', a, ('iadd', b, c))),
> -   (('~fadd', ('fneg', a), a), 0.0),
>     (('iadd', ('ineg', a), a), 0),
>     (('iadd', ('ineg', a), ('iadd', a, b)), b),
>     (('iadd', a, ('iadd', ('ineg', a), b)), b),
> --
> 2.19.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