mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
aco/ra: move optimize_encoding earlier
We have to handle tied definitions after optimize_encoding, but a rewrite of that will need the register file from before clearing the killed operands. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34700>
This commit is contained in:
parent
fd05181a26
commit
f783f5df6d
1 changed files with 8 additions and 4 deletions
|
|
@ -3009,7 +3009,9 @@ optimize_encoding_vop2(ra_ctx& ctx, RegisterFile& register_file, aco_ptr<Instruc
|
|||
if (ctx.assignments[def_id].affinity) {
|
||||
assignment& affinity = ctx.assignments[ctx.assignments[def_id].affinity];
|
||||
if (affinity.assigned && affinity.reg != instr->operands[2].physReg() &&
|
||||
!register_file.test(affinity.reg, instr->operands[2].bytes()))
|
||||
(!register_file.test(affinity.reg, instr->operands[2].bytes()) ||
|
||||
std::any_of(instr->operands.begin(), instr->operands.end(), [&](Operand op)
|
||||
{ return op.isKillBeforeDef() && op.physReg() == affinity.reg; })))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3057,7 +3059,9 @@ optimize_encoding_sopk(ra_ctx& ctx, RegisterFile& register_file, aco_ptr<Instruc
|
|||
if (ctx.assignments[def_id].affinity) {
|
||||
assignment& affinity = ctx.assignments[ctx.assignments[def_id].affinity];
|
||||
if (affinity.assigned && affinity.reg != instr->operands[!literal_idx].physReg() &&
|
||||
!register_file.test(affinity.reg, instr->operands[!literal_idx].bytes()))
|
||||
(!register_file.test(affinity.reg, instr->operands[!literal_idx].bytes()) ||
|
||||
std::any_of(instr->operands.begin(), instr->operands.end(), [&](Operand op)
|
||||
{ return op.isKillBeforeDef() && op.physReg() == affinity.reg; })))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3315,14 +3319,14 @@ register_allocation(Program* program, ra_test_policy policy)
|
|||
}
|
||||
bool temp_in_scc = register_file[scc];
|
||||
|
||||
optimize_encoding(ctx, register_file, instr);
|
||||
|
||||
/* remove dead vars from register file */
|
||||
for (const Operand& op : instr->operands) {
|
||||
if (op.isTemp() && op.isFirstKillBeforeDef())
|
||||
register_file.clear(op);
|
||||
}
|
||||
|
||||
optimize_encoding(ctx, register_file, instr);
|
||||
|
||||
/* Handle definitions which must have the same register as an operand.
|
||||
* We expect that the definition has the same size as the operand, otherwise the new
|
||||
* location for the operand (if it's not killed) might intersect with the old one.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue