From 08fc7a40821f935d1290fc008200d474fed8fe9e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 8 Jan 2024 21:58:51 -0400 Subject: [PATCH] agx: stop lowering in opt loop silly total instructions in shared programs: 2278756 -> 2278751 (<.01%) instructions in affected programs: 587 -> 582 (-0.85%) helped: 2 HURT: 0 total bytes in shared programs: 15008934 -> 15008916 (<.01%) bytes in affected programs: 3794 -> 3776 (-0.47%) helped: 2 HURT: 0 total halfregs in shared programs: 519245 -> 519253 (<.01%) halfregs in affected programs: 63 -> 71 (12.70%) helped: 0 HURT: 1 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 95bff0b66b1..a088aee1830 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2366,12 +2366,8 @@ agx_optimize_loop_nir(nir_shader *nir) do { progress = false; - NIR_PASS(progress, nir, nir_lower_var_copies); - NIR_PASS(progress, nir, nir_lower_vars_to_ssa); - NIR_PASS(progress, nir, nir_copy_prop); NIR_PASS(progress, nir, nir_opt_remove_phis); - NIR_PASS(progress, nir, nir_lower_phis_to_scalar, true); NIR_PASS(progress, nir, nir_opt_dce); NIR_PASS(progress, nir, nir_opt_dead_cf); NIR_PASS(progress, nir, nir_opt_cse); @@ -2379,9 +2375,7 @@ agx_optimize_loop_nir(nir_shader *nir) NIR_PASS(progress, nir, nir_opt_phi_precision); NIR_PASS(progress, nir, nir_opt_algebraic); NIR_PASS(progress, nir, nir_opt_constant_folding); - NIR_PASS(progress, nir, nir_opt_undef); - NIR_PASS(progress, nir, nir_opt_shrink_vectors); NIR_PASS(progress, nir, nir_opt_loop_unroll); } while (progress); @@ -2999,6 +2993,7 @@ agx_preprocess_nir(nir_shader *nir, const nir_shader *libagx, nir_metadata_block_index | nir_metadata_dominance, NULL); NIR_PASS_V(nir, nir_lower_frag_coord_to_pixel_coord); NIR_PASS_V(nir, agx_nir_lower_subgroups); + NIR_PASS_V(nir, nir_lower_phis_to_scalar, true); /* After lowering, run through the standard suite of NIR optimizations. We * will run through the loop later, once we have the shader key, but if we @@ -3056,6 +3051,8 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, if (nir->info.stage == MESA_SHADER_FRAGMENT) NIR_PASS(needs_libagx, nir, agx_nir_lower_interpolation); + NIR_PASS_V(nir, nir_lower_vars_to_ssa); + if (needs_libagx) { link_libagx(nir, key->libagx);