nouveau/nir: Enable nir_opt_move/sink.

NIR load_consts/inputs tend to happen together at the top of the program.
In the TGSI backend the loads got emitted at use time, while the NIR
backend was emitting the loads at load intrinsic time.  By sinking the
intrinsics, we can greatly reduce register pressure.

nv92 NIR results:

total local in shared programs: 2024 -> 2020 (-0.20%)
local in affected programs: 4 -> 0
total gpr in shared programs: 790424 -> 735455 (-6.95%)
gpr in affected programs: 215968 -> 160999 (-25.45%)
total instructions in shared programs: 6058339 -> 6051208 (-0.12%)
instructions in affected programs: 410795 -> 403664 (-1.74%)
total bytes in shared programs: 41820104 -> 41660304 (-0.38%)
bytes in affected programs: 7147296 -> 6987496 (-2.24%)

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15542>
This commit is contained in:
Emma Anholt 2022-03-23 22:13:20 -07:00 committed by Marge Bot
parent df1c7ca0e5
commit b1fa2068b8
1 changed files with 8 additions and 0 deletions

View File

@ -3173,6 +3173,14 @@ Converter::run()
NIR_PASS(progress, nir, nir_lower_64bit_phis);
} while (progress);
nir_move_options move_options =
(nir_move_options)(nir_move_const_undef |
nir_move_load_ubo |
nir_move_load_uniform |
nir_move_load_input);
NIR_PASS_V(nir, nir_opt_sink, move_options);
NIR_PASS_V(nir, nir_opt_move, move_options);
NIR_PASS_V(nir, nir_lower_bool_to_int32);
NIR_PASS_V(nir, nir_convert_from_ssa, true);