ir3/ra: Consider reg file size when swapping killed sources

Don't swap a 2-component vector of half-regs with a full reg if that
would result in the half regs going outside of the allowable half-reg
space.

Fixes: d4b5d2a020 ("ir3/ra: Use killed sources in register eviction")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13818>
This commit is contained in:
Connor Abbott 2021-11-15 12:11:07 +01:00 committed by Marge Bot
parent f9a46ad22a
commit 9d88b98b08

View file

@ -780,10 +780,12 @@ try_evict_regs(struct ra_ctx *ctx, struct ra_file *file,
return false;
}
unsigned conflicting_file_size =
reg_file_size(file, conflicting->interval.reg);
unsigned avail_start, avail_end;
bool evicted = false;
BITSET_FOREACH_RANGE (avail_start, avail_end, available_to_evict,
reg_file_size(file, conflicting->interval.reg)) {
conflicting_file_size) {
unsigned size = avail_end - avail_start;
/* non-half registers must be aligned */
@ -820,6 +822,10 @@ try_evict_regs(struct ra_ctx *ctx, struct ra_file *file,
conflicting->physreg_end - conflicting->physreg_start)
continue;
if (killed->physreg_end > conflicting_file_size ||
conflicting->physreg_end > reg_file_size(file, killed->interval.reg))
continue;
/* We can't swap the killed range if it partially/fully overlaps the
* space we're trying to allocate or (in speculative mode) if it's
* already been swapped and will overlap when we actually evict.