mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
aco: create vector affinities for phi operands
fossil-db (navi21): Totals from 2934 (3.70% of 79395) affected shaders: Instrs: 8368484 -> 8365630 (-0.03%); split: -0.05%, +0.01% CodeSize: 46032152 -> 45998480 (-0.07%); split: -0.09%, +0.01% VGPRs: 200360 -> 200280 (-0.04%); split: -0.12%, +0.08% Latency: 85556147 -> 85562615 (+0.01%); split: -0.09%, +0.10% InvThroughput: 19066462 -> 19065173 (-0.01%); split: -0.09%, +0.09% VClause: 209834 -> 209783 (-0.02%); split: -0.14%, +0.12% SClause: 261811 -> 261826 (+0.01%); split: -0.00%, +0.01% Copies: 727502 -> 724394 (-0.43%); split: -0.56%, +0.13% Branches: 291083 -> 291120 (+0.01%); split: -0.01%, +0.03% VALU: 5564021 -> 5560975 (-0.05%); split: -0.07%, +0.02% SALU: 1100996 -> 1100942 (-0.00%); split: -0.02%, +0.02% fossil-db (navi31): Totals from 34207 (43.08% of 79395) affected shaders: MaxWaves: 1036893 -> 1036781 (-0.01%); split: +0.01%, -0.02% Instrs: 21977229 -> 21884600 (-0.42%); split: -0.47%, +0.05% CodeSize: 112680884 -> 112298404 (-0.34%); split: -0.38%, +0.04% VGPRs: 1590832 -> 1615912 (+1.58%); split: -0.25%, +1.83% Latency: 142542601 -> 142670271 (+0.09%); split: -0.12%, +0.21% InvThroughput: 19481055 -> 19434110 (-0.24%); split: -0.44%, +0.20% VClause: 462865 -> 462558 (-0.07%); split: -0.20%, +0.13% SClause: 619822 -> 619685 (-0.02%); split: -0.02%, +0.00% Copies: 1704870 -> 1610889 (-5.51%); split: -5.89%, +0.38% Branches: 518238 -> 518241 (+0.00%); split: -0.01%, +0.01% VALU: 12230157 -> 12136112 (-0.77%); split: -0.82%, +0.05% SALU: 2444075 -> 2444099 (+0.00%); split: -0.01%, +0.01% VOPD: 3443 -> 3476 (+0.96%); split: +1.80%, -0.84% Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11186 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31346>
This commit is contained in:
parent
1e60509135
commit
24c60be1ad
1 changed files with 43 additions and 0 deletions
|
|
@ -2634,6 +2634,46 @@ sop2_can_use_sopk(ra_ctx& ctx, Instruction* instr)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
create_phi_vector_affinities(ra_ctx& ctx, aco_ptr<Instruction>& instr,
|
||||
std::map<Operand*, std::vector<vector_info>>& vector_phis)
|
||||
{
|
||||
auto it = ctx.vectors.find(instr->definitions[0].tempId());
|
||||
if (it == ctx.vectors.end())
|
||||
return;
|
||||
vector_info& dest_vector = it->second;
|
||||
|
||||
auto pair = vector_phis.try_emplace(dest_vector.parts, instr->operands.size(), dest_vector);
|
||||
std::vector<vector_info>& src_vectors = pair.first->second;
|
||||
if (pair.second) {
|
||||
RegType type = instr->definitions[0].regClass().type();
|
||||
|
||||
for (vector_info& src_vector : src_vectors) {
|
||||
src_vector.parts =
|
||||
(Operand*)ctx.memory.allocate(sizeof(Operand) * src_vector.num_parts, alignof(Operand));
|
||||
for (unsigned j = 0; j < src_vector.num_parts; j++)
|
||||
src_vector.parts[j] = Operand(RegClass::get(type, dest_vector.parts[j].bytes()));
|
||||
}
|
||||
}
|
||||
|
||||
unsigned index = 0;
|
||||
for (; index < dest_vector.num_parts; index++) {
|
||||
if (dest_vector.parts[index].isTemp() &&
|
||||
dest_vector.parts[index].tempId() == instr->definitions[0].tempId())
|
||||
break;
|
||||
}
|
||||
assert(index != dest_vector.num_parts);
|
||||
|
||||
for (int i = instr->operands.size() - 1; i >= 0; i--) {
|
||||
const Operand& op = instr->operands[i];
|
||||
if (!op.isTemp() || op.regClass() != instr->definitions[0].regClass())
|
||||
continue;
|
||||
|
||||
src_vectors[i].parts[index] = op;
|
||||
ctx.vectors[op.tempId()] = src_vectors[i];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
get_affinities(ra_ctx& ctx)
|
||||
{
|
||||
|
|
@ -2718,6 +2758,7 @@ get_affinities(ra_ctx& ctx)
|
|||
}
|
||||
|
||||
/* collect phi affinities */
|
||||
std::map<Operand*, std::vector<vector_info>> vector_phis;
|
||||
for (; rit != block.instructions.rend(); ++rit) {
|
||||
aco_ptr<Instruction>& instr = *rit;
|
||||
assert(is_phi(instr));
|
||||
|
|
@ -2746,6 +2787,8 @@ get_affinities(ra_ctx& ctx)
|
|||
temp_to_phi_resources[op.tempId()] = index;
|
||||
}
|
||||
}
|
||||
|
||||
create_phi_vector_affinities(ctx, instr, vector_phis);
|
||||
}
|
||||
|
||||
/* visit the loop header phis first in order to create nested affinities */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue