mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 08:10:14 +01:00
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> (cherry picked from commit3e26fc4498)
This commit is contained in:
parent
c72a9e2795
commit
e6134c388d
2 changed files with 4 additions and 2 deletions
|
|
@ -94,7 +94,7 @@
|
|||
"description": "nir/opt_algebraic: disable fsat(a + 1.0) opt if a can be NaN",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "a4a3487aae98cc83990b1c79785983b65124145f",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -980,7 +980,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))),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue