aco: fix reset_block_regs() in postRA-optimizer

Accidentally, we picked the index of the predecessors instead of the predecessors.

Totals from 8496 (6.30% of 134913) affected shaders: (GFX10.3)
CodeSize: 64070724 -> 64022516 (-0.08%); split: -0.08%, +0.00%
Instrs: 11932750 -> 11920698 (-0.10%); split: -0.10%, +0.00%
Latency: 144040266 -> 144017062 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 29327735 -> 29326421 (-0.00%); split: -0.00%, +0.00%

Fossil DB stats on Rembrandt (RDNA2):
Totals from 4488 (3.33% of 134906) affected shaders:
CodeSize: 42759736 -> 42735392 (-0.06%); split: -0.06%, +0.00%
Instrs: 7960522 -> 7954436 (-0.08%); split: -0.08%, +0.00%
Latency: 96192647 -> 96172571 (-0.02%); split: -0.02%, +0.00%
InvThroughput: 19313576 -> 19312575 (-0.01%); split: -0.01%, +0.00%

Fixes: 75967a4814 ('aco/optimizer_postRA: Speed up reset_block() with predecessors.')
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16161>
(cherry picked from commit 8f4eccb138)
This commit is contained in:
Daniel Schürmann 2022-11-14 16:17:25 +01:00 committed by Eric Engestrom
parent 44b4caaa4d
commit fea1fc4b49
2 changed files with 6 additions and 5 deletions

View file

@ -3775,7 +3775,7 @@
"description": "aco: fix reset_block_regs() in postRA-optimizer",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "75967a4814be7988afc20e59bac4b48bafacab00"
},

View file

@ -89,13 +89,14 @@ struct pr_opt_ctx {
/* Mark overwritten if it doesn't match with other predecessors. */
const unsigned until_reg = min_reg + num_regs;
for (unsigned pred = 1; pred < num_preds; ++pred) {
for (unsigned i = min_reg; i < until_reg; ++i) {
Idx& idx = instr_idx_by_regs[block_index][i];
for (unsigned i = 1; i < num_preds; ++i) {
unsigned pred = preds[i];
for (unsigned reg = min_reg; reg < until_reg; ++reg) {
Idx& idx = instr_idx_by_regs[block_index][reg];
if (idx == overwritten_untrackable)
continue;
if (idx != instr_idx_by_regs[pred][i])
if (idx != instr_idx_by_regs[pred][reg])
idx = overwritten_untrackable;
}
}