[Mesa-dev] [PATCH 01/12] nir: Pull common addition out of flrp arguments
Ian Romanick
idr at freedesktop.org
Sat Aug 25 05:52:06 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
Skylake
total instructions in shared programs: 14304116 -> 14303686 (<.01%)
instructions in affected programs: 49036 -> 48606 (-0.88%)
helped: 209
HURT: 0
helped stats (abs) min: 1 max: 8 x̄: 2.06 x̃: 1
helped stats (rel) min: 0.23% max: 6.67% x̄: 1.19% x̃: 0.56%
95% mean confidence interval for instructions value: -2.27 -1.85
95% mean confidence interval for instructions %-change: -1.35% -1.04%
Instructions are helped.
total cycles in shared programs: 527552861 -> 527549152 (<.01%)
cycles in affected programs: 895530 -> 891821 (-0.41%)
helped: 142
HURT: 83
helped stats (abs) min: 2 max: 210 x̄: 58.15 x̃: 32
helped stats (rel) min: 0.05% max: 12.18% x̄: 2.98% x̃: 1.75%
HURT stats (abs) min: 1 max: 224 x̄: 54.81 x̃: 14
HURT stats (rel) min: 0.02% max: 28.02% x̄: 3.16% x̃: 0.95%
95% mean confidence interval for cycles value: -28.25 -4.72
95% mean confidence interval for cycles %-change: -1.40% -0.04%
Cycles are helped.
Broadwell
total instructions in shared programs: 14615782 -> 14615353 (<.01%)
instructions in affected programs: 49130 -> 48701 (-0.87%)
helped: 209
HURT: 0
helped stats (abs) min: 1 max: 8 x̄: 2.05 x̃: 1
helped stats (rel) min: 0.23% max: 6.67% x̄: 1.19% x̃: 0.56%
95% mean confidence interval for instructions value: -2.26 -1.84
95% mean confidence interval for instructions %-change: -1.34% -1.03%
Instructions are helped.
total cycles in shared programs: 554541474 -> 554552501 (<.01%)
cycles in affected programs: 938374 -> 949401 (1.18%)
helped: 72
HURT: 164
helped stats (abs) min: 1 max: 162 x̄: 40.78 x̃: 19
helped stats (rel) min: 0.08% max: 12.02% x̄: 2.46% x̃: 1.44%
HURT stats (abs) min: 1 max: 248 x̄: 85.14 x̃: 27
HURT stats (rel) min: 0.02% max: 12.48% x̄: 4.15% x̃: 1.74%
95% mean confidence interval for cycles value: 34.39 59.06
95% mean confidence interval for cycles %-change: 1.50% 2.77%
Cycles are HURT.
Haswell
total instructions in shared programs: 13005162 -> 13004752 (<.01%)
instructions in affected programs: 49860 -> 49450 (-0.82%)
helped: 209
HURT: 0
helped stats (abs) min: 1 max: 7 x̄: 1.96 x̃: 1
helped stats (rel) min: 0.23% max: 6.67% x̄: 1.16% x̃: 0.54%
95% mean confidence interval for instructions value: -2.15 -1.77
95% mean confidence interval for instructions %-change: -1.32% -1.00%
Instructions are helped.
total cycles in shared programs: 407143838 -> 407142554 (<.01%)
cycles in affected programs: 900617 -> 899333 (-0.14%)
helped: 116
HURT: 99
helped stats (abs) min: 1 max: 272 x̄: 30.32 x̃: 16
helped stats (rel) min: 0.04% max: 12.64% x̄: 1.53% x̃: 0.73%
HURT stats (abs) min: 1 max: 198 x̄: 22.56 x̃: 10
HURT stats (rel) min: <.01% max: 10.30% x̄: 1.32% x̃: 0.54%
95% mean confidence interval for cycles value: -12.79 0.85
95% mean confidence interval for cycles %-change: -0.56% 0.13%
Inconclusive result (value mean confidence interval includes 0).
Ivy Bridge
total instructions in shared programs: 11709181 -> 11708722 (<.01%)
instructions in affected programs: 61839 -> 61380 (-0.74%)
helped: 226
HURT: 0
helped stats (abs) min: 1 max: 7 x̄: 2.03 x̃: 2
helped stats (rel) min: 0.18% max: 8.33% x̄: 1.07% x̃: 0.54%
95% mean confidence interval for instructions value: -2.21 -1.85
95% mean confidence interval for instructions %-change: -1.23% -0.92%
Instructions are helped.
total cycles in shared programs: 254741126 -> 254744080 (<.01%)
cycles in affected programs: 966459 -> 969413 (0.31%)
helped: 117
HURT: 108
helped stats (abs) min: 1 max: 129 x̄: 20.26 x̃: 11
helped stats (rel) min: 0.02% max: 12.30% x̄: 1.15% x̃: 0.50%
HURT stats (abs) min: 1 max: 214 x̄: 49.31 x̃: 14
HURT stats (rel) min: <.01% max: 48.42% x̄: 2.79% x̃: 0.80%
95% mean confidence interval for cycles value: 5.05 21.21
95% mean confidence interval for cycles %-change: 0.14% 1.34%
Cycles are HURT.
Sandy Bridge
total instructions in shared programs: 10488075 -> 10487724 (<.01%)
instructions in affected programs: 30308 -> 29957 (-1.16%)
helped: 124
HURT: 0
helped stats (abs) min: 1 max: 7 x̄: 2.83 x̃: 3
helped stats (rel) min: 0.35% max: 8.00% x̄: 1.59% x̃: 1.29%
95% mean confidence interval for instructions value: -3.08 -2.58
95% mean confidence interval for instructions %-change: -1.81% -1.37%
Instructions are helped.
total cycles in shared programs: 150260469 -> 150259141 (<.01%)
cycles in affected programs: 328692 -> 327364 (-0.40%)
helped: 75
HURT: 50
helped stats (abs) min: 1 max: 284 x̄: 45.91 x̃: 13
helped stats (rel) min: 0.04% max: 9.16% x̄: 1.47% x̃: 0.68%
HURT stats (abs) min: 1 max: 728 x̄: 42.30 x̃: 11
HURT stats (rel) min: 0.03% max: 12.62% x̄: 1.36% x̃: 0.60%
95% mean confidence interval for cycles value: -28.01 6.76
95% mean confidence interval for cycles %-change: -0.79% 0.11%
Inconclusive result (value mean confidence interval includes 0).
Iron Lake
total instructions in shared programs: 7781330 -> 7780824 (<.01%)
instructions in affected programs: 17370 -> 16864 (-2.91%)
helped: 70
HURT: 0
helped stats (abs) min: 1 max: 14 x̄: 7.23 x̃: 7
helped stats (rel) min: 1.01% max: 10.77% x̄: 3.46% x̃: 3.34%
95% mean confidence interval for instructions value: -8.07 -6.39
95% mean confidence interval for instructions %-change: -3.95% -2.98%
Instructions are helped.
total cycles in shared programs: 177879330 -> 177876974 (<.01%)
cycles in affected programs: 303114 -> 300758 (-0.78%)
helped: 66
HURT: 0
helped stats (abs) min: 8 max: 84 x̄: 35.70 x̃: 28
helped stats (rel) min: 0.12% max: 4.69% x̄: 1.25% x̃: 1.23%
95% mean confidence interval for cycles value: -40.44 -30.95
95% mean confidence interval for cycles %-change: -1.48% -1.02%
Cycles are helped.
GM45
total instructions in shared programs: 4799710 -> 4799457 (<.01%)
instructions in affected programs: 8766 -> 8513 (-2.89%)
helped: 35
HURT: 0
helped stats (abs) min: 1 max: 14 x̄: 7.23 x̃: 7
helped stats (rel) min: 1.01% max: 10.45% x̄: 3.43% x̃: 3.30%
95% mean confidence interval for instructions value: -8.45 -6.01
95% mean confidence interval for instructions %-change: -4.13% -2.73%
Instructions are helped.
total cycles in shared programs: 122050288 -> 122048862 (<.01%)
cycles in affected programs: 173654 -> 172228 (-0.82%)
helped: 33
HURT: 0
helped stats (abs) min: 12 max: 84 x̄: 43.21 x̃: 42
helped stats (rel) min: 0.15% max: 4.69% x̄: 1.40% x̃: 1.42%
95% mean confidence interval for cycles value: -50.64 -35.79
95% mean confidence interval for cycles %-change: -1.77% -1.03%
Cycles are helped.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/nir/nir_opt_algebraic.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index e770a61d9ff..01e3843334a 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -114,6 +114,15 @@ optimizations = [
(('~flrp', a, b, 1.0), b),
(('~flrp', a, a, b), a),
(('~flrp', 0.0, a, b), ('fmul', a, b)),
+
+ # flrp(a, a + b, c) => a + flrp(0, b, c) => a + (b * c)
+ (('~flrp', a, ('fadd(is_used_once)', a, b), c), ('fadd', ('fmul', b, c), a)),
+ (('~flrp at 32', a, ('fadd', a, b), c), ('fadd', ('fmul', b, c), a), 'options->lower_flrp32'),
+ (('~flrp at 64', a, ('fadd', a, b), c), ('fadd', ('fmul', b, c), a), 'options->lower_flrp64'),
+
+ (('~flrp at 32', ('fadd', a, b), ('fadd', a, c), d), ('fadd', ('flrp', b, c, d), a), 'options->lower_flrp32'),
+ (('~flrp at 64', ('fadd', a, b), ('fadd', a, c), d), ('fadd', ('flrp', b, c, d), a), 'options->lower_flrp64'),
+
(('~flrp', a, b, ('b2f', c)), ('bcsel', c, b, a), 'options->lower_flrp32'),
(('~flrp', a, 0.0, c), ('fadd', ('fmul', ('fneg', a), c), a)),
(('flrp at 32', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp32'),
@@ -872,6 +881,9 @@ late_optimizations = [
(('fdot4', a, b), ('fdot_replicated4', a, b), 'options->fdot_replicates'),
(('fdph', a, b), ('fdph_replicated', a, b), 'options->fdot_replicates'),
+ (('~flrp at 32', ('fadd(is_used_once)', a, b), ('fadd(is_used_once)', a, c), d), ('fadd', ('flrp', b, c, d), a)),
+ (('~flrp at 64', ('fadd(is_used_once)', a, b), ('fadd(is_used_once)', a, c), d), ('fadd', ('flrp', b, c, d), a)),
+
(('b2f(is_used_more_than_once)', ('inot', a)), ('bcsel', a, 0.0, 1.0)),
(('fneg(is_used_more_than_once)', ('b2f', ('inot', a))), ('bcsel', a, -0.0, -1.0)),
--
2.14.4
More information about the mesa-dev
mailing list