diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2020-08-19 13:35:14 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2021-04-02 12:56:18 -0700 |
commit | 53bd69ef51ef4b03039c42ee828ce3b64bee3b03 (patch) | |
tree | f185ba98ef3e9ff4c68da4052fc1113661bbbd6d | |
parent | fa1225e2835d29bb2f4afd1acd701b1b168ce57d (diff) |
nir/algebraic: Mark some more comparison reductions exact
All Haswell and later Intel platforms had similar results. (Tiger Lake shown)
total instructions in shared programs: 21049056 -> 21048939 (<.01%)
instructions in affected programs: 4716 -> 4599 (-2.48%)
helped: 39
HURT: 0
helped stats (abs) min: 1 max: 6 x̄: 3.00 x̃: 3
helped stats (rel) min: 0.99% max: 5.43% x̄: 2.80% x̃: 2.51%
95% mean confidence interval for instructions value: -3.46 -2.54
95% mean confidence interval for instructions %-change: -3.22% -2.38%
Instructions are helped.
total cycles in shared programs: 855141411 -> 855141159 (<.01%)
cycles in affected programs: 54491 -> 54239 (-0.46%)
helped: 28
HURT: 5
helped stats (abs) min: 2 max: 34 x̄: 12.82 x̃: 12
helped stats (rel) min: 0.06% max: 2.73% x̄: 0.94% x̃: 0.75%
HURT stats (abs) min: 2 max: 52 x̄: 21.40 x̃: 6
HURT stats (rel) min: 0.11% max: 2.46% x̄: 0.90% x̃: 0.56%
95% mean confidence interval for cycles value: -13.72 -1.55
95% mean confidence interval for cycles %-change: -1.01% -0.31%
Cycles are helped.
Tiger Lake
Instructions in all programs: 160902191 -> 160899554 (-0.0%)
SENDs in all programs: 6812435 -> 6812435 (+0.0%)
Loops in all programs: 38225 -> 38225 (+0.0%)
Cycles in all programs: 7428581420 -> 7428555881 (-0.0%)
Spills in all programs: 192582 -> 192582 (+0.0%)
Fills in all programs: 304539 -> 304539 (+0.0%)
A lot of fragment shaders in Shadow of the Tomb Raider were helped, and
a bunch of vertex shaders in Octopath Traveler were hurt.
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 6d9c1d21187..f7af3e22c71 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -842,12 +842,17 @@ optimizations.extend([ # These patterns can result when (a < b || a < c) => (a < min(b, c)) # transformations occur before constant propagation and loop-unrolling. - (('~flt', a, ('fmax', b, a)), ('flt', a, b)), - (('~flt', ('fmin', a, b), a), ('flt', b, a)), + # + # The flt versions are exact. If isnan(a), the original pattern is + # trivially false, and the replacements are false too. If isnan(b): + # + # a < fmax(NaN, a) => a < a => false vs a < NaN => false + (('flt', a, ('fmax', b, a)), ('flt', a, b)), + (('flt', ('fmin', a, b), a), ('flt', b, a)), (('~fge', a, ('fmin', b, a)), True), (('~fge', ('fmax', a, b), a), True), - (('~flt', a, ('fmin', b, a)), False), - (('~flt', ('fmax', a, b), a), False), + (('flt', a, ('fmin', b, a)), False), + (('flt', ('fmax', a, b), a), False), (('~fge', a, ('fmax', b, a)), ('fge', a, b)), (('~fge', ('fmin', a, b), a), ('fge', b, a)), |