ac/nir/lower_mem_access_bit_sizes: make 8/16bit access 32bit if possible

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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36164>
This commit is contained in:
Georg Lehmann 2025-07-16 14:34:57 +02:00 committed by Marge Bot
parent 3cdaf55334
commit 05ee3c6e0f

View file

@ -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);