[Mesa-dev] [PATCH 02/12] nir: Pull common multiplication out of flrp arguments

Ian Romanick idr at freedesktop.org
Sat Aug 25 05:52:07 UTC 2018


From: Ian Romanick <ian.d.romanick at intel.com>

Skylake, Broadwell, Haswell, and Sandy Bridge had similar results. (Skylake shown)
total instructions in shared programs: 14303686 -> 14300269 (-0.02%)
instructions in affected programs: 121704 -> 118287 (-2.81%)
helped: 694
HURT: 0
helped stats (abs) min: 1 max: 16 x̄: 4.92 x̃: 3
helped stats (rel) min: 0.22% max: 16.00% x̄: 4.36% x̃: 3.75%
95% mean confidence interval for instructions value: -5.17 -4.67
95% mean confidence interval for instructions %-change: -4.57% -4.14%
Instructions are helped.

total cycles in shared programs: 527549152 -> 527532160 (<.01%)
cycles in affected programs: 858131 -> 841139 (-1.98%)
helped: 505
HURT: 151
helped stats (abs) min: 1 max: 4880 x̄: 45.10 x̃: 16
helped stats (rel) min: 0.04% max: 35.69% x̄: 3.36% x̃: 2.06%
HURT stats (abs)   min: 1 max: 294 x̄: 38.31 x̃: 16
HURT stats (rel)   min: 0.06% max: 29.17% x̄: 3.08% x̃: 2.03%
95% mean confidence interval for cycles value: -41.14 -10.66
95% mean confidence interval for cycles %-change: -2.25% -1.52%
Cycles are helped.

Ivy Bridge
total instructions in shared programs: 11707456 -> 11704465 (-0.03%)
instructions in affected programs: 129460 -> 126469 (-2.31%)
helped: 676
HURT: 0
helped stats (abs) min: 1 max: 16 x̄: 4.42 x̃: 3
helped stats (rel) min: 0.22% max: 19.23% x̄: 3.67% x̃: 3.03%
95% mean confidence interval for instructions value: -4.65 -4.20
95% mean confidence interval for instructions %-change: -3.87% -3.47%
Instructions are helped.

total cycles in shared programs: 254736691 -> 254717085 (<.01%)
cycles in affected programs: 789785 -> 770179 (-2.48%)
helped: 510
HURT: 155
helped stats (abs) min: 1 max: 419 x̄: 51.67 x̃: 18
helped stats (rel) min: 0.02% max: 35.22% x̄: 4.75% x̃: 2.72%
HURT stats (abs)   min: 1 max: 371 x̄: 43.51 x̃: 19
HURT stats (rel)   min: 0.02% max: 28.77% x̄: 4.31% x̃: 3.00%
95% mean confidence interval for cycles value: -35.47 -23.50
95% mean confidence interval for cycles %-change: -3.14% -2.13%
Cycles are helped.

LOST:   3
GAINED: 9

Iron Lake
total instructions in shared programs: 7780824 -> 7778140 (-0.03%)
instructions in affected programs: 149333 -> 146649 (-1.80%)
helped: 622
HURT: 0
helped stats (abs) min: 1 max: 12 x̄: 4.32 x̃: 3
helped stats (rel) min: 0.24% max: 7.55% x̄: 2.26% x̃: 2.45%
95% mean confidence interval for instructions value: -4.54 -4.10
95% mean confidence interval for instructions %-change: -2.36% -2.17%
Instructions are helped.

total cycles in shared programs: 177876974 -> 177866442 (<.01%)
cycles in affected programs: 3215150 -> 3204618 (-0.33%)
helped: 510
HURT: 63
helped stats (abs) min: 4 max: 66 x̄: 22.26 x̃: 18
helped stats (rel) min: 0.05% max: 4.62% x̄: 0.98% x̃: 0.88%
HURT stats (abs)   min: 4 max: 18 x̄: 13.02 x̃: 12
HURT stats (rel)   min: 0.10% max: 1.02% x̄: 0.71% x̃: 0.78%
95% mean confidence interval for cycles value: -19.85 -16.91
95% mean confidence interval for cycles %-change: -0.88% -0.72%
Cycles are helped.

GM45
total instructions in shared programs: 4799457 -> 4798115 (-0.03%)
instructions in affected programs: 76257 -> 74915 (-1.76%)
helped: 311
HURT: 0
helped stats (abs) min: 1 max: 12 x̄: 4.32 x̃: 3
helped stats (rel) min: 0.24% max: 7.02% x̄: 2.22% x̃: 2.42%
95% mean confidence interval for instructions value: -4.63 -4.00
95% mean confidence interval for instructions %-change: -2.36% -2.09%
Instructions are helped.

total cycles in shared programs: 122048862 -> 122042296 (<.01%)
cycles in affected programs: 1947358 -> 1940792 (-0.34%)
helped: 263
HURT: 26
helped stats (abs) min: 6 max: 66 x̄: 26.53 x̃: 18
helped stats (rel) min: 0.05% max: 4.62% x̄: 1.05% x̃: 1.09%
HURT stats (abs)   min: 14 max: 18 x̄: 15.85 x̃: 14
HURT stats (rel)   min: 0.78% max: 1.02% x̄: 0.86% x̃: 0.79%
95% mean confidence interval for cycles value: -25.06 -20.38
95% mean confidence interval for cycles %-change: -0.99% -0.76%
Cycles are helped.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/nir/nir_opt_algebraic.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 01e3843334a..2e7d9e8bbaf 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -123,6 +123,11 @@ optimizations = [
    (('~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 at 32', a, ('fmul(is_used_once)', a, b), c), ('fmul', ('flrp', 1.0, b, c), a), 'options->lower_flrp32'),
+   (('~flrp at 64', a, ('fmul(is_used_once)', a, b), c), ('fmul', ('flrp', 1.0, b, c), a), 'options->lower_flrp64'),
+
+   (('~flrp', ('fmul(is_used_once)', a, b), ('fmul(is_used_once)', a, c), d), ('fmul', ('flrp', b, c, d), a)),
+
    (('~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'),
-- 
2.14.4



More information about the mesa-dev mailing list