On 04/09/2013 10:58 AM, Martin Andersson wrote:
On Tue, Apr 9, 2013 at 3:18 AM, Marek Olšák <mar...@gmail.com> wrote:
Pushed, thanks. The transform feedback test still doesn't pass, but at least
the hardlocks are gone.

Thanks, I have looked into the other issue as well
http://lists.freedesktop.org/archives/mesa-dev/2013-March/036941.html

The problem arises when there are nested loops. If I rework the code
so there are
no nested loops the issue disappears. At least one pixel also needs to enter the
outer loop. The pixels that should enter the outer loop behaves
correctly. It is those
pixels that should not enter the outer loop that misbehaves. It does
not matter if they
also fails the test for the inner loop, they will still execute the
instruction inside. That
leads to the strange results for that test.

Please test the attached patch.

Vadim


The strangeness is easier to see if the NUM_POINTS in the
ext_transform_feedback/
order.c are run with smaller values,like 3, 6 and 9. Disable the code
that fail the test
and print starting_x, shift_reg_final and iteration_count.

Marek, since you implemented transform feedback for r600, do you think the issue
is with the tranform feedback code or the shader compiler or some other thing?

//Martin
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


>From 46456ca7ecfa3f0b107b1f9106d024f9f239a571 Mon Sep 17 00:00:00 2001
From: Vadim Girlin <vadimgir...@gmail.com>
Date: Wed, 10 Apr 2013 01:20:19 +0400
Subject: [PATCH] r600g: use ALU EXECUTE_MASK_OP on cayman instead of
 LOOP_BREAK/CONTINUE

Signed-off-by: Vadim Girlin <vadimgir...@gmail.com>
---
 src/gallium/drivers/r600/r600_asm.c    | 14 ++++++++++++--
 src/gallium/drivers/r600/r600_shader.c | 24 +++++++++++++++++++++++-
 src/gallium/drivers/r600/r600d.h       |  5 +++++
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 26a848a..2874adf 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -1985,6 +1985,7 @@ void r600_bytecode_disasm(struct r600_bytecode *bc)
 		LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
 			const char *omod_str[] = {"","*2","*4","/2"};
 			const struct alu_op_info *aop = r600_isa_alu(alu->op);
+			bool cm_execmask_op = alu->execute_mask && bc->chip_class == CAYMAN;
 			int o = 0;
 
 			r600_bytecode_alu_nliterals(bc, alu, literal, &nliteral);
@@ -1997,8 +1998,10 @@ void r600_bytecode_disasm(struct r600_bytecode *bc)
 					alu->update_pred ? 'P':' ',
 					alu->pred_sel ? alu->pred_sel==2 ? '0':'1':' ');
 
-			o += fprintf(stderr, "%s%s%s ", aop->name,
-					omod_str[alu->omod], alu->dst.clamp ? "_sat":"");
+			o += fprintf(stderr, "%s ", aop->name);
+			if (!cm_execmask_op)
+				o += fprintf(stderr, "%s ", omod_str[alu->omod]);
+			o += fprintf(stderr, "%s ", alu->dst.clamp ? "_sat":"");
 
 			o += print_indent(o,60);
 			o += print_dst(alu);
@@ -2012,6 +2015,13 @@ void r600_bytecode_disasm(struct r600_bytecode *bc)
 				o += fprintf(stderr, "  BS:%d", alu->bank_swizzle);
 			}
 
+			if (cm_execmask_op && alu->omod) {
+				static const char* cm_em_op_names[] =
+					{"BREAK", "CONTINUE", "KILL"};
+
+				fprintf(stderr, "  %s", cm_em_op_names[alu->omod - 1]);
+			}
+
 			fprintf(stderr, "\n");
 			id += 2;
 
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index f801707..d1cac36 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -5827,7 +5827,29 @@ static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx)
 		return -EINVAL;
 	}
 
-	r600_bytecode_add_cfinst(ctx->bc, ctx->inst_info->op);
+
+	if (ctx->bc->chip_class == CAYMAN) {
+		struct r600_bytecode_alu alu = {};
+		int r;
+
+		alu.op = ALU_OP2_PRED_SETE;
+		alu.src[0].sel = V_SQ_ALU_SRC_0;
+		alu.src[1].sel = V_SQ_ALU_SRC_1;
+
+		if (ctx->inst_info->op == CF_OP_LOOP_BREAK)
+			alu.omod = SQ_ALU_EXECUTE_MASK_OP_BREAK;
+		else
+			alu.omod = SQ_ALU_EXECUTE_MASK_OP_CONTINUE;
+
+		alu.execute_mask = 1;
+		alu.last = 1;
+
+		r = r600_bytecode_add_alu(ctx->bc, &alu);
+		if (r)
+			return r;
+	} else {
+		r600_bytecode_add_cfinst(ctx->bc, ctx->inst_info->op);
+	}
 
 	fc_set_mid(ctx, fscp);
 
diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h
index 9b31383..679dd81 100644
--- a/src/gallium/drivers/r600/r600d.h
+++ b/src/gallium/drivers/r600/r600d.h
@@ -3698,4 +3698,9 @@
 #define DMA_PACKET_CONSTANT_FILL	0xd /* 7xx only */
 #define DMA_PACKET_NOP			0xf
 
+#define SQ_ALU_EXECUTE_MASK_OP_DEACTIVATE    0x0
+#define SQ_ALU_EXECUTE_MASK_OP_BREAK         0x1
+#define SQ_ALU_EXECUTE_MASK_OP_CONTINUE      0x2
+#define SQ_ALU_EXECUTE_MASK_OP_KILL          0x3
+
 #endif
-- 
1.8.1.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to