Mesa (main): ir3: Fix compress_regs_left accounting for half-regs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 10:57:11 UTC 2021
Module: Mesa
Branch: main
Commit: 6a5312bf86e7b19fc53555d9e4597d199682d886
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a5312bf86e7b19fc53555d9e4597d199682d886
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Thu Aug 19 18:50:07 2021 +0200
ir3: Fix compress_regs_left accounting for half-regs
This was just wrong - we need to check against the entire register file,
and we need to include removed full regs even if the register we're
trying to insert is a half-reg, or else we could run out of space when
reinserting full regs after it. There does need to be an additional
check so that we don't try to insert a half-reg beyond the half-reg
limit, but that has to happen in addition to the normal check.
This fixes KHR-GLES31.core.arrays_of_arrays.InteractionArgumentAliasing6
once spilling is added.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
---
src/freedreno/ir3/ir3_ra.c | 37 ++++++++++++++++---------------------
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index cc0bad2f461..9c320e0ed90 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -876,27 +876,23 @@ compress_regs_left(struct ra_ctx *ctx, struct ra_file *file, unsigned size,
intervals_count = intervals_sz = 0;
intervals = NULL;
- unsigned removed_full_size = 0;
- unsigned removed_half_size = 0;
+ unsigned removed_size = 0, removed_half_size = 0;
unsigned file_size =
align == 1 ? MIN2(file->size, RA_HALF_SIZE) : file->size;
physreg_t start_reg = 0;
foreach_interval_rev_safe (interval, file) {
- /* Check if we can sort the intervals *after* this one and have
- * enough space leftover to accomodate "size" units.
+ /* Check if we can sort the intervals *after* this one and have enough
+ * space leftover to accomodate "size" units. Also check that we have
+ * enough space leftover for half-registers, if we're inserting a
+ * half-register (otherwise we only shift any half-registers down so they
+ * should be safe).
*/
- if (align == 1) {
- if (interval->physreg_end + removed_half_size <= file_size - size) {
- start_reg = interval->physreg_end;
- break;
- }
- } else {
- if (interval->physreg_end + removed_half_size <=
- file_size - removed_full_size - size) {
- start_reg = interval->physreg_end;
- break;
- }
+ if (interval->physreg_end + size + removed_size <= file->size &&
+ (align != 1 ||
+ interval->physreg_end + size + removed_half_size <= file_size)) {
+ start_reg = interval->physreg_end;
+ break;
}
/* We assume that all frozen intervals are at the start and that we
@@ -908,12 +904,11 @@ compress_regs_left(struct ra_ctx *ctx, struct ra_file *file, unsigned size,
* overlap the register we're trying to add.
*/
if (!interval->is_killed && !is_source) {
- if (interval->interval.reg->flags & IR3_REG_HALF)
- removed_half_size +=
- interval->physreg_end - interval->physreg_start;
- else
- removed_full_size +=
- interval->physreg_end - interval->physreg_start;
+ removed_size += interval->physreg_end - interval->physreg_start;
+ if (interval->interval.reg->flags & IR3_REG_HALF) {
+ removed_half_size += interval->physreg_end -
+ interval->physreg_start;
+ }
}
/* Now that we've done the accounting, pop this off */
More information about the mesa-commit
mailing list