From 05ee3c6e0fd811919cf8c7de08da45fff6820d50 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 16 Jul 2025 14:34:57 +0200 Subject: [PATCH] ac/nir/lower_mem_access_bit_sizes: make 8/16bit access 32bit if possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also means we stop splitting 8/16bit vec8. Foz-DB GFX1201: Totals from 112 (0.14% of 80301) affected shaders: Instrs: 219953 -> 218280 (-0.76%) CodeSize: 1335916 -> 1325748 (-0.76%) VGPRs: 10460 -> 10412 (-0.46%) Latency: 1435629 -> 1432818 (-0.20%); split: -0.22%, +0.02% InvThroughput: 733424 -> 733271 (-0.02%); split: -0.02%, +0.00% VClause: 4178 -> 4182 (+0.10%) SClause: 2191 -> 2196 (+0.23%) Copies: 13911 -> 13784 (-0.91%); split: -1.06%, +0.14% PreVGPRs: 7620 -> 7619 (-0.01%); split: -0.03%, +0.01% VALU: 140400 -> 140167 (-0.17%); split: -0.17%, +0.01% SALU: 18459 -> 18276 (-0.99%) VMEM: 9219 -> 8944 (-2.98%) VOPD: 4216 -> 4220 (+0.09%); split: +0.24%, -0.14% Reviewed-by: Marek Olšák Part-of: --- src/amd/common/nir/ac_nir_lower_mem_access_bit_sizes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/common/nir/ac_nir_lower_mem_access_bit_sizes.c b/src/amd/common/nir/ac_nir_lower_mem_access_bit_sizes.c index 3690b9ab977..d6d24e85b2e 100644 --- a/src/amd/common/nir/ac_nir_lower_mem_access_bit_sizes.c +++ b/src/amd/common/nir/ac_nir_lower_mem_access_bit_sizes.c @@ -66,6 +66,9 @@ lower_mem_access_cb(nir_intrinsic_op intrin, uint8_t bytes, uint8_t bit_size, ui /* Make 8-bit accesses 16-bit if possible */ if (is_load && bit_size == 8 && combined_align >= 2 && bytes % 2 == 0) bit_size = 16; + /* Make 8/16-bit accesses 32-bit if possible */ + if (bit_size <= 16 && combined_align >= 4 && bytes % 4 == 0) + bit_size = 32; bit_size = MIN2(bit_size, combined_align == 4 ? 64 : combined_align * 8ull);