From bcf7a70008f238997ac002ed027fff44b6ca01e4 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 1 Sep 2020 17:42:45 +0100 Subject: [PATCH] aco: use nir_opt_uniform_atomics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Significantly improves performance of a Control compute shader. Also seems to increase FPS at the very start of the game by ~9% (RX 580, 1080p, medium settings, no MSAA). fossil-db (Navi): Totals from 315 (0.23% of 135946) affected shaders: SGPRs: 18296 -> 18336 (+0.22%); split: -0.26%, +0.48% VGPRs: 11856 -> 11844 (-0.10%); split: -0.81%, +0.71% CodeSize: 2233800 -> 2457508 (+10.01%) MaxWaves: 4506 -> 4497 (-0.20%); split: +0.04%, -0.24% Instrs: 438766 -> 486215 (+10.81%); split: -0.00%, +10.81% Cycles: 7880180 -> 8963340 (+13.75%); split: -0.00%, +13.75% Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_instruction_selection_setup.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp b/src/amd/compiler/aco_instruction_selection_setup.cpp index 24e58f32046..b689f1d27cb 100644 --- a/src/amd/compiler/aco_instruction_selection_setup.cpp +++ b/src/amd/compiler/aco_instruction_selection_setup.cpp @@ -336,6 +336,8 @@ void apply_nuw_to_offsets(isel_context *ctx, nir_function_impl *impl) struct hash_table *range_ht = _mesa_pointer_hash_table_create(NULL); + nir_metadata_require(impl, nir_metadata_dominance); + nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_intrinsic) @@ -767,6 +769,7 @@ void init_context(isel_context *ctx, nir_shader *shader) ctx->shader = shader; nir_divergence_analysis(shader); + nir_opt_uniform_atomics(shader); fill_desc_set_info(ctx, impl);