Mesa (main): r600: Only emit the NOP group triggered by dest.rel after a full group

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 10:41:31 UTC 2022


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Mon Apr 11 11:50:10 2022 +0200

r600: Only emit the NOP group triggered by dest.rel after a full group

In addition really fill all slots, because otherwise the alu-group merger
might move a read from the indirectly written register into the 't' slot.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15848>

---

 src/gallium/drivers/r600/r600_asm.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index c0a29e3d2f4..9da564a184b 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -1152,17 +1152,17 @@ static int r600_bytecode_alloc_kcache_lines(struct r600_bytecode *bc,
 	return 0;
 }
 
-static int insert_nop_r6xx(struct r600_bytecode *bc)
+static int insert_nop_r6xx(struct r600_bytecode *bc, int max_slots)
 {
 	struct r600_bytecode_alu alu;
 	int r, i;
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < max_slots; i++) {
 		memset(&alu, 0, sizeof(alu));
 		alu.op = ALU_OP0_NOP;
-		alu.src[0].chan = i;
-		alu.dst.chan = i;
-		alu.last = (i == 3);
+		alu.src[0].chan = i & 3;
+		alu.dst.chan = i & 3;
+		alu.last = (i == max_slots - 1);
 		r = r600_bytecode_add_alu(bc, &alu);
 		if (r)
 			return r;
@@ -1354,10 +1354,16 @@ int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
 		bc->cf_last->prev2_bs_head = bc->cf_last->prev_bs_head;
 		bc->cf_last->prev_bs_head = bc->cf_last->curr_bs_head;
 		bc->cf_last->curr_bs_head = NULL;
-	}
 
-	if (nalu->dst.rel && bc->r6xx_nop_after_rel_dst)
-		insert_nop_r6xx(bc);
+		if (bc->r6xx_nop_after_rel_dst) {
+			for (int i = 0; i < max_slots; ++i) {
+				if (slots[i] && slots[i]->dst.rel) {
+					insert_nop_r6xx(bc, max_slots);
+					break;
+				}
+			}
+		}
+	}
 
 	/* Might need to insert spill write ops after current clause */
 	if (nalu->last && bc->n_pending_outputs) {



More information about the mesa-commit mailing list