Mesa (main): r600: limit loops when trying to merge alu groups

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 13 13:31:37 UTC 2022


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Mon Jul 11 19:34:05 2022 +0200

r600: limit loops when trying to merge alu groups

On Cayman bank_swizzle[4] is never counted up, so add an
additional condition to make sure the loop is finished
at one point. This is a hot-fix, the logic below should be
improved.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Filip Gawin <filip at gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17484>

---

 src/gallium/drivers/r600/r600_asm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 954af066307..b7319ab6871 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -593,6 +593,7 @@ static int check_and_set_bank_swizzle(const struct r600_bytecode *bc,
 	int i, r = 0, forced = 1;
 	boolean scalar_only = bc->gfx_level == CAYMAN ? false : true;
 	int max_slots = bc->gfx_level == CAYMAN ? 4 : 5;
+	int max_checks = max_slots * 1000;
 
 	for (i = 0; i < max_slots; i++) {
 		if (slots[i]) {
@@ -618,8 +619,8 @@ static int check_and_set_bank_swizzle(const struct r600_bytecode *bc,
 			bank_swizzle[i] = slots[i]->bank_swizzle;
 
 	bank_swizzle[4] = SQ_ALU_SCL_210;
-	while(bank_swizzle[4] <= SQ_ALU_SCL_221) {
 
+	while(bank_swizzle[4] <= SQ_ALU_SCL_221 && max_checks--) {
 		init_bank_swizzle(&bs);
 		if (scalar_only == false) {
 			for (i = 0; i < 4; i++) {



More information about the mesa-commit mailing list