aco/ra: propagate precolor affinities through phis

Totals from 917 (1.15% of 79839) affected shaders: (Navi48)

Instrs: 3217861 -> 3216947 (-0.03%); split: -0.04%, +0.01%
CodeSize: 17427204 -> 17432264 (+0.03%); split: -0.06%, +0.09%
VGPRs: 65328 -> 65316 (-0.02%)
Latency: 35336268 -> 35335528 (-0.00%); split: -0.01%, +0.01%
InvThroughput: 7305032 -> 7302187 (-0.04%); split: -0.04%, +0.00%
SClause: 120537 -> 120553 (+0.01%); split: -0.01%, +0.02%
Copies: 307257 -> 306852 (-0.13%); split: -0.21%, +0.08%
Branches: 115744 -> 115743 (-0.00%)
VALU: 1572522 -> 1572183 (-0.02%); split: -0.02%, +0.00%
SALU: 574229 -> 574155 (-0.01%); split: -0.05%, +0.04%
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36345>
This commit is contained in:
Daniel Schürmann
2025-07-25 11:02:51 +02:00
committed by Marge Bot
parent 2ddd8ef0a3
commit a667d9a68d
+7 -4
View File
@@ -3149,21 +3149,24 @@ get_affinities(ra_ctx& ctx)
continue;
assert(instr->definitions[0].isTemp());
auto it = temp_to_phi_resources.find(instr->definitions[0].tempId());
Temp def = instr->definitions[0].getTemp();
auto it = temp_to_phi_resources.find(def.id());
unsigned index = phi_resources.size();
std::vector<Temp>* affinity_related;
if (it != temp_to_phi_resources.end()) {
index = it->second;
phi_resources[index][0] = instr->definitions[0].getTemp();
phi_resources[index][0] = def;
affinity_related = &phi_resources[index];
} else {
phi_resources.emplace_back(std::vector<Temp>{instr->definitions[0].getTemp()});
phi_resources.emplace_back(std::vector<Temp>{def});
affinity_related = &phi_resources.back();
}
for (const Operand& op : instr->operands) {
if (op.isTemp() && op.isKill() && op.regClass() == instr->definitions[0].regClass()) {
if (op.isTemp() && op.isKill() && op.regClass() == def.regClass()) {
affinity_related->emplace_back(op.getTemp());
if (ctx.assignments[def.id()].precolor_affinity)
ctx.assignments[op.tempId()].set_precolor_affinity(ctx.assignments[def.id()].reg);
if (block.kind & block_kind_loop_header)
continue;
temp_to_phi_resources[op.tempId()] = index;