aco: improve phi affinities with p_split_vector
Totals from 5860 (4.59% of 127638) affected shaders: VGPRs: 460212 -> 460216 (+0.00%) CodeSize: 65554356 -> 65464816 (-0.14%) Instrs: 12655972 -> 12633578 (-0.18%) Copies: 1309994 -> 1292163 (-1.36%) 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/4990>
This commit is contained in:
@@ -64,6 +64,7 @@ struct ra_ctx {
|
||||
std::unordered_map<unsigned, phi_info> phi_map;
|
||||
std::unordered_map<unsigned, unsigned> affinities;
|
||||
std::unordered_map<unsigned, Instruction*> vectors;
|
||||
std::unordered_map<unsigned, Instruction*> split_vectors;
|
||||
aco_ptr<Instruction> pseudo_dummy;
|
||||
unsigned max_used_sgpr = 0;
|
||||
unsigned max_used_vgpr = 0;
|
||||
@@ -919,6 +920,21 @@ PhysReg get_reg(ra_ctx& ctx,
|
||||
std::vector<std::pair<Operand, Definition>>& parallelcopies,
|
||||
aco_ptr<Instruction>& instr)
|
||||
{
|
||||
auto split_vec = ctx.split_vectors.find(temp.id());
|
||||
if (split_vec != ctx.split_vectors.end()) {
|
||||
unsigned offset = 0;
|
||||
for (Definition def : split_vec->second->definitions) {
|
||||
auto affinity_it = ctx.affinities.find(def.tempId());
|
||||
if (affinity_it != ctx.affinities.end() && ctx.assignments[affinity_it->second].assigned) {
|
||||
PhysReg reg = ctx.assignments[affinity_it->second].reg;
|
||||
reg.reg_b -= offset;
|
||||
if (get_reg_specified(ctx, reg_file, temp.regClass(), parallelcopies, instr, reg))
|
||||
return reg;
|
||||
}
|
||||
offset += def.bytes();
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.affinities.find(temp.id()) != ctx.affinities.end() &&
|
||||
ctx.assignments[ctx.affinities[temp.id()]].assigned) {
|
||||
PhysReg reg = ctx.assignments[ctx.affinities[temp.id()]].reg;
|
||||
@@ -1435,6 +1451,9 @@ void register_allocation(Program *program, std::vector<TempSet>& live_out_per_bl
|
||||
}
|
||||
}
|
||||
|
||||
if (instr->opcode == aco_opcode::p_split_vector && instr->operands[0].isFirstKillBeforeDef())
|
||||
ctx.split_vectors[instr->operands[0].tempId()] = instr.get();
|
||||
|
||||
/* add operands to live variables */
|
||||
for (const Operand& op : instr->operands) {
|
||||
if (op.isTemp())
|
||||
|
||||
Reference in New Issue
Block a user