Mesa (staging/21.2): ir3/ra: Handle huge merge sets
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 23 17:44:10 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: d0f90adc8e2bc1309e179dff371fd656abc552a5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0f90adc8e2bc1309e179dff371fd656abc552a5
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 fa1929c482d..b4ea14439ab 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -652,7 +652,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