Mesa (master): freedreno/a2xx: ir2: fix incorrect instruction reordering

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Sep 6 02:24:45 UTC 2019


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

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Thu Sep  5 11:23:53 2019 -0400

freedreno/a2xx: ir2: fix incorrect instruction reordering

Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Reviewed-by: Rob Clark <robdclark at chromium.org>

---

 src/gallium/drivers/freedreno/a2xx/ir2.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/drivers/freedreno/a2xx/ir2.c b/src/gallium/drivers/freedreno/a2xx/ir2.c
index 8995d7e8aaf..89ac21a81e1 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir2.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir2.c
@@ -258,6 +258,22 @@ static int sched_next(struct ir2_context *ctx, struct ir2_sched_instr *sched)
 				is_ok &= !ctx->instr[src->num].need_emit;
 			}
 		}
+		/* don't reorder non-ssa write before read */
+		if (!instr->is_ssa) {
+			ir2_foreach_instr(p, ctx) {
+				if (!p->need_emit || p->idx >= instr->idx)
+					continue;
+
+				ir2_foreach_src(src, p) {
+					if (get_reg_src(ctx, src) == instr->reg)
+						is_ok = false;
+				}
+			}
+		}
+		/* don't reorder across predicates */
+		if (avail_count && instr->pred != avail[0]->pred)
+			is_ok = false;
+
 		if (!is_ok)
 			continue;
 




More information about the mesa-commit mailing list