aco/scheduler: keep track of RegisterDemand at DownwardsCursor::insert_idx{_clause}

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33644>
This commit is contained in:
Daniel Schürmann
2024-04-19 11:43:00 +02:00
committed by Marge Bot
parent f58654e98f
commit 93872270f0
+15 -3
View File
@@ -52,6 +52,10 @@ struct DownwardsCursor {
RegisterDemand clause_demand;
/* Maximum demand of instructions from source_idx to insert_idx_clause (both exclusive) */
RegisterDemand total_demand;
/* Register demand immediately before the insert_idx_clause. */
RegisterDemand insert_demand_clause;
/* Register demand immediately before the insert_idx. */
RegisterDemand insert_demand;
DownwardsCursor(int current_idx, RegisterDemand initial_clause_demand)
: source_idx(current_idx - 1), insert_idx_clause(current_idx), insert_idx(current_idx + 1),
@@ -187,6 +191,12 @@ MoveState::downwards_init(int current_idx, bool improved_rar_, bool may_form_cla
}
DownwardsCursor cursor(current_idx, block->instructions[current_idx]->register_demand);
RegisterDemand temp = get_temp_registers(block->instructions[cursor.insert_idx - 1].get());
cursor.insert_demand = block->instructions[cursor.insert_idx - 1]->register_demand - temp;
temp = get_temp_registers(block->instructions[cursor.insert_idx_clause - 1].get());
cursor.insert_demand_clause =
block->instructions[cursor.insert_idx_clause - 1]->register_demand - temp;
cursor.verify_invariants(block);
return cursor;
}
@@ -236,9 +246,9 @@ MoveState::downwards_move(DownwardsCursor& cursor, bool add_to_clause)
/* New demand for the moved instruction */
const RegisterDemand temp = get_temp_registers(instr.get());
const RegisterDemand temp2 = get_temp_registers(block->instructions[dest_insert_idx - 1].get());
const RegisterDemand new_demand =
block->instructions[dest_insert_idx - 1]->register_demand - temp2 + temp;
const RegisterDemand insert_demand =
add_to_clause ? cursor.insert_demand_clause : cursor.insert_demand;
const RegisterDemand new_demand = insert_demand + temp;
if (new_demand.exceeds(max_registers))
return move_fail_pressure;
@@ -260,8 +270,10 @@ MoveState::downwards_move(DownwardsCursor& cursor, bool add_to_clause)
cursor.clause_demand.update(new_demand);
} else {
cursor.clause_demand -= candidate_diff;
cursor.insert_demand -= candidate_diff;
cursor.insert_idx--;
}
cursor.insert_demand_clause -= candidate_diff;
cursor.source_idx--;
cursor.verify_invariants(block);