From ec81337d8d3c894fdd0fd81980f828b37db7d162 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Thu, 11 Dec 2025 10:59:14 +0100 Subject: [PATCH] radv: use nir_opt_uniform_subgroup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Foz-DB Navi21: Totals from 665 (0.68% of 97581) affected shaders: MaxWaves: 12856 -> 12822 (-0.26%) Instrs: 2073376 -> 2068645 (-0.23%); split: -0.23%, +0.00% CodeSize: 11116904 -> 11098376 (-0.17%); split: -0.18%, +0.01% VGPRs: 39584 -> 39568 (-0.04%); split: -0.20%, +0.16% SpillSGPRs: 160 -> 155 (-3.12%) SpillVGPRs: 2995 -> 2968 (-0.90%) Latency: 15432093 -> 15503462 (+0.46%); split: -0.13%, +0.59% InvThroughput: 3344411 -> 3351185 (+0.20%); split: -0.08%, +0.28% VClause: 50278 -> 50225 (-0.11%); split: -0.15%, +0.04% SClause: 57537 -> 57505 (-0.06%); split: -0.18%, +0.13% Copies: 189642 -> 188175 (-0.77%); split: -0.86%, +0.08% Branches: 68800 -> 68502 (-0.43%); split: -0.45%, +0.02% PreSGPRs: 37646 -> 37068 (-1.54%) PreVGPRs: 35891 -> 35943 (+0.14%) VALU: 1386943 -> 1385881 (-0.08%); split: -0.09%, +0.01% SALU: 287322 -> 284165 (-1.10%); split: -1.11%, +0.01% VMEM: 90874 -> 90820 (-0.06%) Acked-by: Marek Olšák Acked-by: Daniel Schürmann Part-of: --- src/amd/vulkan/radv_pipeline.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 979b94c53be..3f39e28e01e 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -473,6 +473,14 @@ radv_postprocess_nir(struct radv_device *device, const struct radv_graphics_stat if (!radv_use_llvm_for_stage(pdev, stage->stage)) ac_nir_optimize_uniform_atomics(stage->nir); + NIR_PASS(_, stage->nir, nir_opt_uniform_subgroup, + &(struct nir_lower_subgroups_options){ + .subgroup_size = stage->info.wave_size, + .ballot_bit_size = stage->info.wave_size, + .ballot_components = 1, + .lower_ballot_bit_count_to_mbcnt_amd = true, + }); + NIR_PASS(_, stage->nir, nir_opt_idiv_const, 8); NIR_PASS(_, stage->nir, nir_lower_idiv,