brw: Use live->max_vgrf_size in register coalescing

We already require liveness, so just use the actual maximum size we saw
instead of a hardcoded pessimal size.

Cc: mesa-stable
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34461>
This commit is contained in:
Kenneth Graunke 2025-04-09 16:03:47 -07:00 committed by Marge Bot
parent ea468412f6
commit 4b27b5895c

View file

@ -234,10 +234,10 @@ brw_opt_register_coalesce(brw_shader &s)
int src_size = 0;
int channels_remaining = 0;
unsigned src_reg = ~0u, dst_reg = ~0u;
int *dst_reg_offset = new int[MAX_VGRF_SIZE(devinfo)];
brw_inst **mov = new brw_inst *[MAX_VGRF_SIZE(devinfo)];
int *dst_var = new int[MAX_VGRF_SIZE(devinfo)];
int *src_var = new int[MAX_VGRF_SIZE(devinfo)];
int *dst_reg_offset = new int[live.max_vgrf_size];
brw_inst **mov = new brw_inst *[live.max_vgrf_size];
int *dst_var = new int[live.max_vgrf_size];
int *src_var = new int[live.max_vgrf_size];
const brw_def_analysis &defs = s.def_analysis.require();
foreach_block_and_inst(block, brw_inst, inst, s.cfg) {
@ -268,10 +268,10 @@ brw_opt_register_coalesce(brw_shader &s)
src_reg = inst->src[0].nr;
src_size = s.alloc.sizes[inst->src[0].nr];
assert(src_size <= MAX_VGRF_SIZE(devinfo));
assert(src_size <= (int) live.max_vgrf_size);
channels_remaining = src_size;
memset(mov, 0, sizeof(*mov) * MAX_VGRF_SIZE(devinfo));
memset(mov, 0, sizeof(*mov) * live.max_vgrf_size);
dst_reg = inst->dst.nr;
}