LLVM can't shrink loads. Totals from affected shaders: SGPRS: 62528 -> 59955 (-4.11 %) VGPRS: 44708 -> 44616 (-0.21 %) Spilled SGPRs: 16 -> 8 (-50.00 %) Spilled VGPRs: 0 -> 0 (0.00 %) Private memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size: 1355528 -> 1355172 (-0.03 %) bytes LDS: 0 -> 0 (0.00 %) blocks Max Waves: 11710 -> 11670 (-0.34 %) Wait states: 0 -> 0 (0.00 %)
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. Note that we could just do the same optimization directly in visit_load_push_constant(), but I think it's better to move that pass in common code if other drivers want to use it. Signed-off-by: Samuel Pitoiset <[email protected]> --- src/amd/vulkan/radv_shader.c | 1 + .../nir/{nir_opt_shrink_load_constant.c => nir_opt_shrink_load.c} | 0 2 files changed, 1 insertion(+) 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 af094e6220..ad68873055 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -147,6 +147,7 @@ radv_optimize_nir(struct nir_shader *shader) if (shader->options->max_unroll_iterations) { NIR_PASS(progress, shader, nir_opt_loop_unroll, 0); } + NIR_PASS(progress, shader, nir_opt_shrink_load); } while (progress); } 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.16.1 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
