aco/ra: fix free register counting when moving variables

info.bounds might be smaller than the bounds available for the moved
variables.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Fixes: 626aa7b648 ("aco: workaround GFX9 hardware bug for D16 image instructions")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34158>
This commit is contained in:
Rhys Perry 2025-03-17 14:30:00 +00:00 committed by Marge Bot
parent 53484dc64a
commit 80fef30531

View file

@ -1275,7 +1275,7 @@ get_reg_impl(ra_ctx& ctx, const RegisterFile& reg_file, std::vector<parallelcopy
RegClass rc = info.rc;
/* check how many free regs we have */
unsigned regs_free = reg_file.count_zero(bounds);
unsigned regs_free = reg_file.count_zero(get_reg_bounds(ctx, rc));
/* mark and count killed operands */
unsigned killed_ops = 0;
@ -1844,7 +1844,7 @@ get_reg(ra_ctx& ctx, const RegisterFile& reg_file, Temp temp,
/* We should only fail here because keeping under the limit would require
* too many moves. */
assert(reg_file.count_zero(info.bounds) >= info.size);
assert(reg_file.count_zero(get_reg_bounds(ctx, info.rc)) >= info.size);
/* try using more registers */
if (!increase_register_file(ctx, info.rc)) {