projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d49eab2
)
nir: Transform -fabs(a) < 0 to a != 0
author
Ian Romanick
<ian.d.romanick@intel.com>
Fri, 27 Jul 2018 01:26:18 +0000
(18:26 -0700)
committer
Ian Romanick
<ian.d.romanick@intel.com>
Sat, 4 Aug 2018 08:12:03 +0000
(
01:12
-0700)
Unlike the much older -abs(a) >= 0.0 transformation, this is not
precise. The behavior changes if a is NaN.
All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs:
14277216
->
14277184
(<.01%)
instructions in affected programs: 2300 -> 2268 (-1.39%)
helped: 8
HURT: 0
helped stats (abs) min: 1 max: 8 x̄: 4.00 x̃: 3
helped stats (rel) min: 0.48% max: 15.15% x̄: 4.41% x̃: 1.01%
95% mean confidence interval for instructions value: -6.45 -1.55
95% mean confidence interval for instructions %-change: -9.96% 1.13%
Inconclusive result (%-change mean confidence interval includes 0).
total cycles in shared programs:
532577848
->
532577990
(<.01%)
cycles in affected programs: 17486 -> 17628 (0.81%)
helped: 2
HURT: 5
helped stats (abs) min: 2 max: 6 x̄: 4.00 x̃: 4
helped stats (rel) min: 0.06% max: 1.81% x̄: 0.93% x̃: 0.93%
HURT stats (abs) min: 6 max: 50 x̄: 30.00 x̃: 26
HURT stats (rel) min: 0.55% max: 2.17% x̄: 1.19% x̃: 1.02%
95% mean confidence interval for cycles value: -1.06 41.63
95% mean confidence interval for cycles %-change: -0.58% 1.74%
Inconclusive result (value mean confidence interval includes 0).
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
src/compiler/nir/nir_opt_algebraic.py
patch
|
blob
|
history
diff --git
a/src/compiler/nir/nir_opt_algebraic.py
b/src/compiler/nir/nir_opt_algebraic.py
index b96a7f93c0884a61ba2da1cb8ddb856214a1e766..8300d6d01f52c979fb5814acc0295583d216ec1d 100644
(file)
--- a/
src/compiler/nir/nir_opt_algebraic.py
+++ b/
src/compiler/nir/nir_opt_algebraic.py
@@
-212,6
+212,10
@@
optimizations = [
# a != 0.0
(('~flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
+ # -fabs(a) < 0.0
+ # fabs(a) > 0.0
+ (('~flt', ('fneg', ('fabs', a)), 0.0), ('fne', a, 0.0)),
+
(('fmax', ('b2f(is_used_once)', a), ('b2f', b)), ('b2f', ('ior', a, b))),
(('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', ('b2f', b))), ('fneg', ('b2f', ('ior', a, b)))),
(('fmin', ('b2f(is_used_once)', a), ('b2f', b)), ('b2f', ('iand', a, b))),