Mesa (main): ir3/ra: Consider reg file size when swapping killed sources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 19 17:23:03 UTC 2021


Module: Mesa
Branch: main
Commit: 9d88b98b0820198c0050965cbd6f1909b9eb8fa5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d88b98b0820198c0050965cbd6f1909b9eb8fa5

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Mon Nov 15 12:11:07 2021 +0100

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: d4b5d2a0204 ("ir3/ra: Use killed sources in register eviction")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13818>

---

 src/freedreno/ir3/ir3_ra.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index 1d8b81c0002..a282b033c5d 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -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.



More information about the mesa-commit mailing list