Mesa (master): freedreno/ir3: fix ir3_nir_move_varying_inputs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jun 14 18:08:57 UTC 2020


Module: Mesa
Branch: master
Commit: 1d9e6e456ad60f4c995c24c5cde6d73943141e6c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d9e6e456ad60f4c995c24c5cde6d73943141e6c

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Sat Jun 13 23:50:22 2020 -0400

freedreno/ir3: fix ir3_nir_move_varying_inputs

ir3_nir_move_varying_inputs is broken when there a load input outside of
the first block which depends on the result of a previous load input.

This simplification/rework avoids the problem, and should also be faster.

Fixes this dEQP-VK test:

dEQP-VK.pipeline.multisample_interpolation.offset_interpolate_at_pixel_center.128_128_1.samples_2

Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5465>

---

 src/freedreno/ir3/ir3_nir_move_varying_inputs.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/freedreno/ir3/ir3_nir_move_varying_inputs.c b/src/freedreno/ir3/ir3_nir_move_varying_inputs.c
index 625666f07e2..91590393c78 100644
--- a/src/freedreno/ir3/ir3_nir_move_varying_inputs.c
+++ b/src/freedreno/ir3/ir3_nir_move_varying_inputs.c
@@ -42,7 +42,6 @@
 typedef struct {
 	nir_shader *shader;
 	nir_block *start_block;
-	struct nir_instr *cursor;
 } state;
 
 static void move_instruction_to_start_block(state *state, nir_instr *instr);
@@ -59,6 +58,10 @@ move_src(nir_src *src, void *state)
 static void
 move_instruction_to_start_block(state *state, nir_instr *instr)
 {
+	/* nothing to do if the instruction is already in the start block */
+	if (instr->block == state->start_block)
+		return;
+
 	/* first move (recursively) all src's to ensure they appear before
 	 * load*_input that we are trying to move:
 	 */
@@ -67,14 +70,7 @@ move_instruction_to_start_block(state *state, nir_instr *instr)
 	/* and then move the instruction itself:
 	 */
 	exec_node_remove(&instr->node);
-
-	if (state->cursor) {
-		exec_node_insert_after(&state->cursor->node, &instr->node);
-	} else {
-		exec_list_push_head(&state->start_block->instr_list, &instr->node);
-	}
-
-	state->cursor = instr;
+	exec_list_push_tail(&state->start_block->instr_list, &instr->node);
 	instr->block = state->start_block;
 }
 
@@ -100,7 +96,6 @@ move_varying_inputs_block(state *state, nir_block *block)
 
 		debug_assert(intr->dest.is_ssa);
 
-		state->cursor = NULL;
 		move_instruction_to_start_block(state, instr);
 
 		progress = true;



More information about the mesa-commit mailing list