Mesa (main): ir3/ra: Handle huge merge sets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 10:57:10 UTC 2021


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Fri Jul 23 11:59:34 2021 +0200

ir3/ra: Handle huge merge sets

It can happen that we create an enormous merge set, even larger than the
entire register file, in which case find_best_gap() would loop
infinitely. This seems to be triggered more often with
IR3_SHADER_DEBUG=spillall, since it actually happened with a CTS test.
Just bail out in that case.

Fixes: 0ffcb19b9d9 ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>

---

 src/freedreno/ir3/ir3_ra.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index 46fd8d3afdb..2b2b1fec1e4 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -965,6 +965,12 @@ static physreg_t
 find_best_gap(struct ra_file *file, unsigned file_size, unsigned size,
               unsigned align, bool is_source)
 {
+   /* This can happen if we create a very large merge set. Just bail out in that
+    * case.
+    */
+   if (size > file_size)
+      return (physreg_t) ~0;
+
    BITSET_WORD *available =
       is_source ? file->available_to_evict : file->available;
 



More information about the mesa-commit mailing list