pan/bi: Use nir_opt_sink/move for constants

Fixes excessive (and failing) spilling in dEQP-GLES31.functional.ssbo.layout.*

shader-db results are a toss up (I suspect we'd see better results if we
tracked register pressure directly):

total instructions in shared programs: 161377 -> 161377 (0.00%)

total nops in shared programs: 121159 -> 121203 (0.04%)
nops in affected programs: 1839 -> 1883 (2.39%)
Nops are HURT.

total clauses in shared programs: 31604 -> 31606 (<.01%)
clauses in affected programs: 38 -> 40 (5.26%)
Inconclusive result (value mean confidence interval includes 0).

total quadwords in shared programs: 130847 -> 130845 (<.01%)
quadwords in affected programs: 1246 -> 1244 (-0.16%)
Inconclusive result (value mean confidence interval includes 0).

total loops in shared programs: 18 -> 18 (0.00%)
total spills in shared programs: 705 -> 705 (0.00%)
total fills in shared programs: 1645 -> 1645 (0.00%)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
This commit is contained in:
Alyssa Rosenzweig 2021-02-18 15:56:43 -05:00 committed by Marge Bot
parent 5eff64e3a3
commit 3a4d985997

View file

@ -2817,6 +2817,12 @@ bi_optimize_nir(nir_shader *nir)
NIR_PASS(progress, nir, nir_lower_bool_to_int32);
NIR_PASS(progress, nir, bifrost_nir_lower_algebraic_late);
NIR_PASS(progress, nir, nir_lower_alu_to_scalar, NULL, NULL);
/* Backend scheduler is purely local, so do some global optimizations
* to reduce register pressure */
NIR_PASS_V(nir, nir_opt_sink, nir_move_const_undef);
NIR_PASS_V(nir, nir_opt_move, nir_move_const_undef);
NIR_PASS(progress, nir, nir_lower_load_const_to_scalar);
/* Take us out of SSA */