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>
(cherry picked from commit 4b27b5895c)
This commit is contained in:
Kenneth Graunke 2025-04-09 16:03:47 -07:00 committed by Eric Engestrom
parent c906f565b6
commit 0d1e83ca6a
2 changed files with 7 additions and 7 deletions

View file

@ -1394,7 +1394,7 @@
"description": "brw: Use live->max_vgrf_size in register coalescing",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -235,10 +235,10 @@ brw_opt_register_coalesce(fs_visitor &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)];
fs_inst **mov = new fs_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];
fs_inst **mov = new fs_inst *[live.max_vgrf_size];
int *dst_var = new int[live.max_vgrf_size];
int *src_var = new int[live.max_vgrf_size];
foreach_block_and_inst(block, fs_inst, inst, s.cfg) {
if (!is_coalesce_candidate(&s, inst))
@ -254,10 +254,10 @@ brw_opt_register_coalesce(fs_visitor &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;
}