Mesa (staging/21.2): ir3/ra: Handle huge merge sets

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 23:01:11 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 387039e4d06dd3c47a8b62f9331df23b86a7159b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=387039e4d06dd3c47a8b62f9331df23b86a7159b

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>
(cherry picked from commit efb34d6ee6af4b51fa3f3f32b7536c4b3de47100)

---

 .pick_status.json          | 2 +-
 src/freedreno/ir3/ir3_ra.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 73ec49fe575..2709c3f9745 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1129,7 +1129,7 @@
         "description": "ir3/ra: Handle huge merge sets",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "0ffcb19b9d9fbe902224542047c389a661fbf816"
     },
diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index 60eab79971f..b92155cdc3b 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -962,6 +962,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