From b4d951c175bc0ed3070bcf739b6c2179e4e52619 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Fri, 7 May 2021 16:22:45 +0200 Subject: [PATCH] aco/scheduler: Fix register demand computation for upwards moves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initial value needs to be taken from the instruction that is being moved over, not the one to be moved. Additionally the parameter of this function was removed because it was misleading. Setting it to any value other than source_idx would cause register_demand to be initialized incorrectly. (Instead, the maximum demand among the covered instructions would need to be determined.) Reviewed-by: Daniel Schürmann Cc: mesa-stable Part-of: (cherry picked from commit 50ba919d37289d1ed9bf2464042eaa0b8e3dbb2e) --- .pick_status.json | 2 +- src/amd/compiler/aco_scheduler.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9b20f9d71db..e700dbcabf3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -382,7 +382,7 @@ "description": "aco/scheduler: Fix register demand computation for upwards moves", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_scheduler.cpp b/src/amd/compiler/aco_scheduler.cpp index 7be7e7057f9..865d057b7b0 100644 --- a/src/amd/compiler/aco_scheduler.cpp +++ b/src/amd/compiler/aco_scheduler.cpp @@ -74,7 +74,7 @@ struct MoveState { /* for moving instructions after the first use of the current instruction upwards */ void upwards_init(int source_idx, bool improved_rar); bool upwards_check_deps(); - void upwards_set_insert_idx(int before); + void upwards_update_insert_idx(); MoveResult upwards_move(); void upwards_skip(); @@ -261,10 +261,10 @@ bool MoveState::upwards_check_deps() return true; } -void MoveState::upwards_set_insert_idx(int before) +void MoveState::upwards_update_insert_idx() { - insert_idx = before; - total_demand = register_demand[before - 1]; + insert_idx = source_idx; + total_demand = register_demand[insert_idx]; } MoveResult MoveState::upwards_move() @@ -635,7 +635,7 @@ void schedule_SMEM(sched_ctx& ctx, Block* block, if (is_dependency) { if (!found_dependency) { - ctx.mv.upwards_set_insert_idx(candidate_idx); + ctx.mv.upwards_update_insert_idx(); init_hazard_query(&hq); found_dependency = true; } @@ -778,7 +778,7 @@ void schedule_VMEM(sched_ctx& ctx, Block* block, is_dependency |= !found_dependency && !ctx.mv.upwards_check_deps(); if (is_dependency) { if (!found_dependency) { - ctx.mv.upwards_set_insert_idx(candidate_idx); + ctx.mv.upwards_update_insert_idx(); init_hazard_query(&indep_hq); found_dependency = true; }