aco/scheduler: Fix register demand computation for upwards moves

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 <daniel@schuermann.dev>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10644>
This commit is contained in:
Tony Wasserka
2021-05-07 16:22:45 +02:00
committed by Marge Bot
parent c528af1076
commit 50ba919d37

View File

@@ -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;
}
@@ -776,7 +776,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;
}