From b8fbce045e6789042f9f5f4e9a0ed42b7d43939b Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Wed, 28 Jun 2023 13:26:50 +0200 Subject: [PATCH] etnaviv: nir: do a late nir_opt_cse run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This cleans up a lot and helps to generate much better code. There are only benefits on GPUs without inline immediate support. shader-db results on GC2000: total instructions in shared programs: 237168 -> 235101 (-0.87%) instructions in affected programs: 17297 -> 15230 (-11.95%) helped: 758 HURT: 0 helped stats (abs) min: 1 max: 24 x̄: 2.73 x̃: 2 helped stats (rel) min: 7.14% max: 29.41% x̄: 14.47% x̃: 14.29% 95% mean confidence interval for instructions value: -2.94 -2.51 95% mean confidence interval for instructions %-change: -14.84% -14.09% Instructions are helped. total temps in shared programs: 85553 -> 84969 (-0.68%) temps in affected programs: 2879 -> 2295 (-20.28%) helped: 584 HURT: 0 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 5.00% max: 25.00% x̄: 21.48% x̃: 20.00% 95% mean confidence interval for temps value: -1.00 -1.00 95% mean confidence interval for temps %-change: -21.76% -21.21% Temps are helped. total immediates in shared programs: 154800 -> 154800 (0.00%) immediates in affected programs: 0 -> 0 helped: 0 HURT: 0 total loops in shared programs: 0 -> 0 loops in affected programs: 0 -> 0 helped: 0 HURT: 0 LOST: 0 GAINED: 0 No changes on GC3000 and GC7000. Signed-off-by: Christian Gmeiner Reviewed-by: Philipp Zabel Part-of: --- src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index 936c655f7e7..ab49c067810 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -1189,6 +1189,7 @@ etna_compile_shader(struct etna_shader_variant *v) */ NIR_PASS_V(s, nir_opt_dce); + NIR_PASS_V(s, nir_opt_cse); NIR_PASS_V(s, nir_lower_bool_to_bitsize); NIR_PASS_V(s, etna_lower_alu, c->specs->has_new_transcendentals);