From 96c31d9a555c46b380ea861c08b620eb556954bf Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 18 Sep 2019 12:29:45 +0700 Subject: [PATCH] lima/gpir: Fix postlog2 fixup handling We guarantee that a complex1 op is always used by postlog2 directly by rewriting the postlog2 op to be a move when there would be a move inserted between them. But we weren't doing this in all circumstances where there might be a move. Move the logic to place_move() so that it always happens. Fixes a few log tests that happened to start failing due to changes in the register allocator leading to a different scheduling order. Reviewed-by: Vasily Khoruzhick --- src/gallium/drivers/lima/ir/gp/scheduler.c | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/lima/ir/gp/scheduler.c b/src/gallium/drivers/lima/ir/gp/scheduler.c index ac132776d43..e069079591c 100644 --- a/src/gallium/drivers/lima/ir/gp/scheduler.c +++ b/src/gallium/drivers/lima/ir/gp/scheduler.c @@ -1342,6 +1342,17 @@ static bool try_node(sched_ctx *ctx) static void place_move(sched_ctx *ctx, gpir_node *node) { + /* For complex1 that is consumed by a postlog2, we cannot allow any moves + * in between. Convert the postlog2 to a move and insert a new postlog2, + * and try to schedule it again in try_node(). + */ + gpir_node *postlog2 = consuming_postlog2(node); + if (postlog2) { + postlog2->op = gpir_op_mov; + create_postlog2(ctx, node); + return; + } + gpir_node *move = create_move(ctx, node); gpir_node_foreach_succ_safe(move, dep) { gpir_node *succ = dep->succ; @@ -1380,17 +1391,7 @@ static bool sched_move(sched_ctx *ctx) { list_for_each_entry(gpir_node, node, &ctx->ready_list, list) { if (node->sched.max_node) { - /* For complex1 that is consumed by a postlog2, we cannot allow any - * moves in between. Convert the postlog2 to a move and insert a new - * postlog2, and try to schedule it again in try_node(). - */ - gpir_node *postlog2 = consuming_postlog2(node); - if (postlog2) { - postlog2->op = gpir_op_mov; - create_postlog2(ctx, node); - } else { - place_move(ctx, node); - } + place_move(ctx, node); return true; } } -- 2.30.2