nir/opt_algebraic: disable fsat(a + 1.0) opt if a can be NaN
Foz-DB Navi21:
Totals from 9 (0.01% of 79789) affected shaders:
Instrs: 6782 -> 6796 (+0.21%); split: -0.03%, +0.24%
CodeSize: 40020 -> 40108 (+0.22%); split: -0.04%, +0.26%
Latency: 23764 -> 23758 (-0.03%)
InvThroughput: 6424 -> 6431 (+0.11%); split: -0.08%, +0.19%
SClause: 273 -> 275 (+0.73%)
Copies: 338 -> 339 (+0.30%)
VALU: 5138 -> 5147 (+0.18%); split: -0.06%, +0.23%
SALU: 349 -> 350 (+0.29%)
SMEM: 498 -> 500 (+0.40%)
Fixes: a4a3487aae ("nir/opt_algebraic: optimize patterns from Skia")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34125>
This commit is contained in:
@@ -1012,7 +1012,9 @@ optimizations.extend([
|
||||
(('~fmin', ('fsat', a), '#b(is_zero_to_one)'), ('fsat', ('fmin', a, b))),
|
||||
|
||||
# If a >= 0 ... 1 + a >= 1 ... so fsat(1 + a) = 1
|
||||
(('fsat', ('fadd', 1.0, 'a(is_ge_zero)')), 1.0),
|
||||
# But 1 + NaN is NaN and fsat(NaN) = 0.
|
||||
(('~fsat', ('fadd', 1.0, 'a(is_not_negative)')), 1.0),
|
||||
(('fsat', ('fadd', 1.0, 'a(is_a_number_not_negative)')), 1.0),
|
||||
|
||||
# Let constant folding do its job. This can have emergent behaviour.
|
||||
(('fneg', ('bcsel(is_used_once)', a, '#b', '#c')), ('bcsel', a, ('fneg', b), ('fneg', c))),
|
||||
|
||||
Reference in New Issue
Block a user