From 3a4d98599768f62700fd5a4f6e65ad180f17e345 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 18 Feb 2021 15:56:43 -0500 Subject: [PATCH] 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 Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index e87213b..a6c33ab 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -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 */ -- 2.7.4