From 8cc269a16f964c2e512f3dfba98423ce783f9b34 Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Mon, 5 Aug 2024 13:35:20 +0200 Subject: [PATCH] ir3/postsched: fix calculation of max_delay max_delay is a measure for the maximum delay from a node to the end of a block. However, the current calculation would include the delay of the node itself (which is the maximum delay from the node's sources). At the point a node is scheduled, this source delay might already be much smaller (or even zero) because its sources have hopefully been scheduled much earlier. This means the max_delay value would be an overestimate of the actual delay from the node to the block's end. This commit fixes this and makes sure max_delay is always the maximum delay from a node to the end of the block from the point where the node is scheduled. Signed-off-by: Job Noorman Part-of: --- src/freedreno/ir3/ir3_postsched.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c index 086e56046ab..ab2ffe14567 100644 --- a/src/freedreno/ir3/ir3_postsched.c +++ b/src/freedreno/ir3/ir3_postsched.c @@ -581,10 +581,11 @@ sched_dag_max_delay_cb(struct dag_node *node, void *state) util_dynarray_foreach (&n->dag.edges, struct dag_edge, edge) { struct ir3_postsched_node *child = (struct ir3_postsched_node *)edge->child; - max_delay = MAX2(child->max_delay, max_delay); + unsigned delay = edge->data; + max_delay = MAX2(child->max_delay + delay, max_delay); } - n->max_delay = MAX2(n->max_delay, max_delay + n->delay); + n->max_delay = MAX2(n->max_delay, max_delay); } static void