mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
nir/opt_algebraic: optimize fmax(ffma(a, b, c), 0.0) to fsat
Foz-DB Navi21: Totals from 2621 (3.28% of 79789) affected shaders: MaxWaves: 55744 -> 55736 (-0.01%) Instrs: 2840180 -> 2832647 (-0.27%); split: -0.27%, +0.00% CodeSize: 15497364 -> 15464692 (-0.21%); split: -0.21%, +0.00% VGPRs: 138448 -> 138456 (+0.01%) Latency: 22319512 -> 22307018 (-0.06%); split: -0.06%, +0.01% InvThroughput: 5745108 -> 5729197 (-0.28%); split: -0.28%, +0.00% Copies: 110279 -> 110268 (-0.01%); split: -0.04%, +0.03% VALU: 2210578 -> 2203211 (-0.33%); split: -0.33%, +0.00% SALU: 169014 -> 168841 (-0.10%) Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34125>
This commit is contained in:
parent
f71fc26393
commit
18a0de1834
1 changed files with 6 additions and 0 deletions
|
|
@ -1031,6 +1031,12 @@ optimizations.extend([
|
|||
(('fmax', ('fadd(is_used_once)', 'a(is_not_positive)', '#b(is_zero_to_one)'), 0.0),
|
||||
('fsat', ('fadd', a, b)), '!options->lower_fsat'),
|
||||
|
||||
# ffma variants of the pattern above.
|
||||
(('fmax', ('ffma(is_used_once)', 'a(is_not_positive)', 'b(is_not_negative)', '#c(is_zero_to_one)'), 0.0),
|
||||
('fsat', ('ffma', a, b, c)), '!options->lower_fsat'),
|
||||
(('fmax', ('ffma(is_used_once)', 'a', ('fneg', a), '#b(is_zero_to_one)'), 0.0),
|
||||
('fsat', ('ffma', a, ('fneg', a), b)), '!options->lower_fsat'),
|
||||
|
||||
(('extract_u8', ('imin', ('imax', a, 0), 0xff), 0), ('imin', ('imax', a, 0), 0xff)),
|
||||
|
||||
# The ior versions are exact because fmin and fmax will always pick a
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue