From 3488a3f0332ba1d77e2c4609a26206e77922e81b Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 29 Jan 2018 17:19:18 +0100 Subject: [PATCH] radv: run nir_opt_shrink_load LLVM can't shrink loads. Polaris10: Totals from affected shaders: SGPRS: 62528 -> 59955 (-4.11 %) VGPRS: 44708 -> 44616 (-0.21 %) Spilled SGPRs: 16 -> 8 (-50.00 %) Code Size: 1355504 -> 1355172 (-0.02 %) bytes Max Waves: 11710 -> 11670 (-0.34 %) Vega10: Totals from affected shaders: SGPRS: 51448 -> 50371 (-2.09 %) VGPRS: 39140 -> 39048 (-0.24 %) Spilled SGPRs: 16 -> 16 (0.00 %) Code Size: 1307188 -> 1304296 (-0.22 %) bytes Max Waves: 11312 -> 11292 (-0.18 %) This reduces SGPRs spilling in MadMax, and it also reduces number of SGPRs in DOW3 and F12017. The number of waves slightly decreases in F1 but I don't see any performance changes after benchmarking it. Talos and Serious Sam are not affected because they don't use any push constants. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_shader.c | 2 ++ .../{nir_opt_shrink_load_constant.c => nir_opt_shrink_load.c} | 0 2 files changed, 2 insertions(+) rename src/compiler/nir/{nir_opt_shrink_load_constant.c => nir_opt_shrink_load.c} (100%) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index af094e6220f..42f83bb3355 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -148,6 +148,8 @@ radv_optimize_nir(struct nir_shader *shader) NIR_PASS(progress, shader, nir_opt_loop_unroll, 0); } } while (progress); + + NIR_PASS(progress, shader, nir_opt_shrink_load); } nir_shader * diff --git a/src/compiler/nir/nir_opt_shrink_load_constant.c b/src/compiler/nir/nir_opt_shrink_load.c similarity index 100% rename from src/compiler/nir/nir_opt_shrink_load_constant.c rename to src/compiler/nir/nir_opt_shrink_load.c -- 2.30.2