Mesa (master): freedreno/ir3/postsched: avoid moving tex ahead of kill

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 13 21:06:29 UTC 2020


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Apr  3 09:04:10 2020 -0700

freedreno/ir3/postsched: avoid moving tex ahead of kill

Add extra dependencies of tex/mem instructions on previous kill
instructions to avoid moving them ahead of kills.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4440>

---

 src/freedreno/ir3/ir3_postsched.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c
index 3dc4505c52d..09e58750c04 100644
--- a/src/freedreno/ir3/ir3_postsched.c
+++ b/src/freedreno/ir3/ir3_postsched.c
@@ -506,6 +506,14 @@ sched_dag_init(struct ir3_postsched_ctx *ctx)
 	calculate_forward_deps(ctx);
 	calculate_reverse_deps(ctx);
 
+	/*
+	 * To avoid expensive texture fetches, etc, from being moved ahead
+	 * of kills, track the kills we've seen so far, so we can add an
+	 * extra dependency on them for tex/mem instructions
+	 */
+	struct util_dynarray kills;
+	util_dynarray_init(&kills, ctx->mem_ctx);
+
 	/*
 	 * Normal srcs won't be in SSA at this point, those are dealt with in
 	 * calculate_forward_deps() and calculate_reverse_deps().  But we still
@@ -532,6 +540,16 @@ sched_dag_init(struct ir3_postsched_ctx *ctx)
 
 			dag_add_edge(&sn->dag, &n->dag, NULL);
 		}
+
+		if (is_kill(instr)) {
+			util_dynarray_append(&kills, struct ir3_instruction *, instr);
+		} else if (is_tex(instr) || is_mem(instr)) {
+			util_dynarray_foreach(&kills, struct ir3_instruction *, instrp) {
+				struct ir3_instruction *kill = *instrp;
+				struct ir3_postsched_node *kn = kill->data;
+				dag_add_edge(&kn->dag, &n->dag, NULL);
+			}
+		}
 	}
 
 	// TODO do we want to do this after reverse-dependencies?



More information about the mesa-commit mailing list