mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
r300: lower flrp in NIR
Shader-db RV370: total instructions in shared programs: 82071 -> 82155 (0.10%) instructions in affected programs: 792 -> 876 (10.61%) helped: 0 HURT: 12 total temps in shared programs: 12775 -> 12778 (0.02%) temps in affected programs: 27 -> 30 (11.11%) helped: 0 HURT: 3 total cycles in shared programs: 128403 -> 128499 (0.07%) cycles in affected programs: 864 -> 960 (11.11%) helped: 0 HURT: 12 The same regression for the few GTK shaders that happens with the R500 nir fcsel lowering also happens here due to the nir_move_vec_src_uses_to_dest. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6126 Reviewed-by: Filip Gawin <filip.gawin@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26816>
This commit is contained in:
parent
ddcf29202d
commit
6167f6e096
3 changed files with 11 additions and 0 deletions
|
|
@ -2451,6 +2451,7 @@ const void *nir_to_rc_options(struct nir_shader *s,
|
|||
if (s->info.stage == MESA_SHADER_VERTEX) {
|
||||
if (is_r500)
|
||||
NIR_PASS_V(s, r300_nir_lower_fcsel_r500);
|
||||
NIR_PASS_V(s, r300_nir_lower_flrp);
|
||||
}
|
||||
NIR_PASS_V(s, nir_opt_dce);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,4 +83,6 @@ extern bool r300_nir_post_integer_lowering(struct nir_shader *shader);
|
|||
|
||||
extern bool r300_nir_lower_fcsel_r500(nir_shader *shader);
|
||||
|
||||
extern bool r300_nir_lower_flrp(nir_shader *shader);
|
||||
|
||||
#endif /* R300_NIR_H */
|
||||
|
|
|
|||
|
|
@ -94,6 +94,11 @@ r300_nir_clean_double_fneg = [
|
|||
(('fneg', ('fneg', a)), a)
|
||||
]
|
||||
|
||||
# This is very late flrp lowering to clean up after bcsel->fcsel->flrp.
|
||||
r300_nir_lower_flrp = [
|
||||
(('flrp', a, b, c), ('ffma', b, c, ('ffma', ('fneg', a), c, a)))
|
||||
]
|
||||
|
||||
r300_nir_post_integer_lowering = [
|
||||
# If ffloor result is used only for indirect constant load, we can get rid of it
|
||||
# completelly as ntt emits ARL by default which already does the flooring.
|
||||
|
|
@ -160,5 +165,8 @@ def main():
|
|||
f.write(nir_algebraic.AlgebraicPass("r300_nir_post_integer_lowering",
|
||||
r300_nir_post_integer_lowering).render())
|
||||
|
||||
f.write(nir_algebraic.AlgebraicPass("r300_nir_lower_flrp",
|
||||
r300_nir_lower_flrp).render())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue