[Mesa-dev] [PATCH 16/22] nir: Simplify some comparisons like a+b < a
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Tue Feb 27 11:28:17 UTC 2018
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Patches 12-14 were also reviewed but I clicked on Reply List, instead of
Reply all.
Sam
On 24/02/18 00:56, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> All Gen7+ platforms had similar results. (Skylake shown)
> total instructions in shared programs: 14514555 -> 14514547 (<.01%)
> instructions in affected programs: 1972 -> 1964 (-0.41%)
> helped: 8
> HURT: 0
> helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
> helped stats (rel) min: 0.39% max: 0.42% x̄: 0.41% x̃: 0.41%
> 95% mean confidence interval for instructions value: -1.00 -1.00
> 95% mean confidence interval for instructions %-change: -0.41% -0.40%
> Instructions are helped.
>
> total cycles in shared programs: 533141444 -> 533136780 (<.01%)
> cycles in affected programs: 164728 -> 160064 (-2.83%)
> helped: 181
> HURT: 3
> helped stats (abs) min: 2 max: 94 x̄: 26.17 x̃: 30
> helped stats (rel) min: 0.12% max: 5.33% x̄: 3.42% x̃: 3.80%
> HURT stats (abs) min: 4 max: 54 x̄: 24.00 x̃: 14
> HURT stats (rel) min: 0.20% max: 2.39% x̄: 1.09% x̃: 0.68%
> 95% mean confidence interval for cycles value: -27.12 -23.58
> 95% mean confidence interval for cycles %-change: -3.54% -3.16%
> Cycles are helped.
>
> Sandy Bridge
> total instructions in shared programs: 10533667 -> 10533539 (<.01%)
> instructions in affected programs: 10148 -> 10020 (-1.26%)
> helped: 124
> HURT: 0
> helped stats (abs) min: 1 max: 2 x̄: 1.03 x̃: 1
> helped stats (rel) min: 0.39% max: 4.35% x̄: 2.20% x̃: 2.04%
> 95% mean confidence interval for instructions value: -1.06 -1.00
> 95% mean confidence interval for instructions %-change: -2.46% -1.95%
> Instructions are helped.
>
> total cycles in shared programs: 146136887 -> 146132122 (<.01%)
> cycles in affected programs: 206382 -> 201617 (-2.31%)
> helped: 171
> HURT: 0
> helped stats (abs) min: 2 max: 40 x̄: 27.87 x̃: 30
> helped stats (rel) min: 0.08% max: 5.73% x̄: 2.98% x̃: 2.67%
> 95% mean confidence interval for cycles value: -29.19 -26.54
> 95% mean confidence interval for cycles %-change: -3.20% -2.76%
> Cycles are helped.
>
> Iron Lake
> total instructions in shared programs: 7886515 -> 7886507 (<.01%)
> instructions in affected programs: 3016 -> 3008 (-0.27%)
> helped: 8
> HURT: 0
> helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
> helped stats (rel) min: 0.25% max: 0.28% x̄: 0.27% x̃: 0.27%
> 95% mean confidence interval for instructions value: -1.00 -1.00
> 95% mean confidence interval for instructions %-change: -0.27% -0.26%
> Instructions are helped.
>
> total cycles in shared programs: 178100396 -> 178100388 (<.01%)
> cycles in affected programs: 156128 -> 156120 (<.01%)
> helped: 4
> HURT: 4
> helped stats (abs) min: 4 max: 4 x̄: 4.00 x̃: 4
> helped stats (rel) min: 0.02% max: 0.04% x̄: 0.03% x̃: 0.03%
> HURT stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
> HURT stats (rel) min: <.01% max: 0.01% x̄: <.01% x̃: <.01%
> 95% mean confidence interval for cycles value: -3.68 1.68
> 95% mean confidence interval for cycles %-change: -0.03% <.01%
> Inconclusive result (value mean confidence interval includes 0).
>
> GM45
> total instructions in shared programs: 4857872 -> 4857868 (<.01%)
> instructions in affected programs: 1544 -> 1540 (-0.26%)
> helped: 4
> HURT: 0
> helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
> helped stats (rel) min: 0.25% max: 0.27% x̄: 0.26% x̃: 0.26%
> 95% mean confidence interval for instructions value: -1.00 -1.00
> 95% mean confidence interval for instructions %-change: -0.28% -0.24%
> Instructions are helped.
>
> total cycles in shared programs: 122167654 -> 122167662 (<.01%)
> cycles in affected programs: 96248 -> 96256 (<.01%)
> helped: 0
> HURT: 4
> HURT stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
> HURT stats (rel) min: <.01% max: 0.01% x̄: <.01% x̃: <.01%
> 95% mean confidence interval for cycles value: 2.00 2.00
> 95% mean confidence interval for cycles %-change: <.01% 0.02%
> Cycles are HURT.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/compiler/nir/nir_opt_algebraic.py | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
> index af3ad2c..26ddf10 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -153,6 +153,15 @@ optimizations = [
>
> (('fge', ('fneg', ('b2f', a)), 0.0), ('inot', a)),
>
> + (('~flt', ('fadd', a, b), a), ('flt', b, 0.0)),
> + (('~fge', ('fadd', a, b), a), ('fge', b, 0.0)),
> + (('~feq', ('fadd', a, b), a), ('feq', b, 0.0)),
> + (('~fne', ('fadd', a, b), a), ('fne', b, 0.0)),
> +
> + # Cannot remove the addition from ilt or ige due to overflow.
> + (('ieq', ('iadd', a, b), a), ('ieq', b, 0)),
> + (('ine', ('iadd', a, b), a), ('ine', b, 0)),
> +
> # fmin(-b2f(a), b) >= 0.0
> # -b2f(a) >= 0.0 && b >= 0.0
> # -b2f(a) == 0.0 && b >= 0.0 -b2f can only be 0 or -1, never >0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180227/81edbeea/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180227/81edbeea/attachment-0001.sig>
More information about the mesa-dev
mailing list