nir_to_tgsi: Enable nir_opt_move.

This moves some ops down to when they're needed, generally reducing the
number of temps in use.  It's not always a win -- sometimes you can end up
moving a generator of a component used by a nir_op_vec down, which means
that op's sources stay live while the vec (whose register likely gets
coalesced with the ops creating it) is also live.  But it's generally
good.

softpipe results:

temps in affected programs: 18115 -> 18026 (-0.49%)
imm in affected programs: 19 -> 22 (15.79%)

r300 results:

instructions in affected programs: 174 -> 178 (2.30%)
vinst in affected programs: 156 -> 160 (2.56%)
sinst in affected programs: 54 -> 50 (-7.41%)
temps in affected programs: 2634 -> 2169 (-17.65%)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14096>
This commit is contained in:
Emma Anholt
2021-12-08 11:33:28 -08:00
committed by Marge Bot
parent 7d2ea9b0ed
commit 5887768f48

View File

@@ -3147,6 +3147,12 @@ nir_to_tgsi(struct nir_shader *s,
NIR_PASS_V(s, nir_opt_dce);
}
nir_move_options move_all =
nir_move_const_undef | nir_move_load_ubo | nir_move_load_input |
nir_move_comparisons | nir_move_copies | nir_move_load_ssbo;
NIR_PASS_V(s, nir_opt_move, move_all);
/* Only lower 32-bit floats. The only other modifier type officially
* supported by TGSI is 32-bit integer negates, but even those are broken on
* virglrenderer, so skip lowering all integer and f64 float mods.