mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 04:40:09 +01:00
aco/ra: create nested affinities for loop header phis
Totals from 875 (0.58% of 150170) affected shaders: (GFX10.3) CodeSize: 6084528 -> 6066628 (-0.29%); split: -0.32%, +0.02% Instrs: 1136497 -> 1133565 (-0.26%); split: -0.28%, +0.02% Latency: 23355051 -> 22952592 (-1.72%); split: -1.83%, +0.10% InvThroughput: 13028151 -> 12859628 (-1.29%); split: -1.38%, +0.09% Copies: 85673 -> 82790 (-3.37%); split: -3.62%, +0.26% Branches: 25049 -> 25098 (+0.20%); split: -0.08%, +0.28% Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12836>
This commit is contained in:
parent
d6bfc95732
commit
b7af10449b
1 changed files with 34 additions and 2 deletions
|
|
@ -2386,14 +2386,46 @@ get_affinities(ra_ctx& ctx, std::vector<IDSet>& live_out_per_block)
|
||||||
affinity_related = &phi_ressources.back();
|
affinity_related = &phi_ressources.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
for (const Operand& op : instr->operands) {
|
||||||
const Operand& op = instr->operands[i];
|
|
||||||
if (op.isTemp() && op.isKill() && op.regClass() == instr->definitions[0].regClass()) {
|
if (op.isTemp() && op.isKill() && op.regClass() == instr->definitions[0].regClass()) {
|
||||||
affinity_related->emplace_back(op.getTemp());
|
affinity_related->emplace_back(op.getTemp());
|
||||||
|
if (block.kind & block_kind_loop_header)
|
||||||
|
continue;
|
||||||
temp_to_phi_ressources[op.tempId()] = index;
|
temp_to_phi_ressources[op.tempId()] = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* visit the loop header phis first in order to create nested affinities */
|
||||||
|
if (block.kind & block_kind_loop_exit) {
|
||||||
|
/* find loop header */
|
||||||
|
auto header_rit = block_rit;
|
||||||
|
while ((header_rit + 1)->loop_nest_depth > block.loop_nest_depth)
|
||||||
|
header_rit++;
|
||||||
|
|
||||||
|
for (aco_ptr<Instruction>& phi : header_rit->instructions) {
|
||||||
|
if (!is_phi(phi))
|
||||||
|
break;
|
||||||
|
if (phi->definitions[0].isKill() || phi->definitions[0].isFixed())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* create an (empty) merge-set for the phi-related variables */
|
||||||
|
auto it = temp_to_phi_ressources.find(phi->definitions[0].tempId());
|
||||||
|
unsigned index = phi_ressources.size();
|
||||||
|
if (it == temp_to_phi_ressources.end()) {
|
||||||
|
temp_to_phi_ressources[phi->definitions[0].tempId()] = index;
|
||||||
|
phi_ressources.emplace_back(std::vector<Temp>{phi->definitions[0].getTemp()});
|
||||||
|
} else {
|
||||||
|
index = it->second;
|
||||||
|
}
|
||||||
|
for (unsigned i = 1; i < phi->operands.size(); i++) {
|
||||||
|
const Operand& op = phi->operands[i];
|
||||||
|
if (op.isTemp() && op.isKill() && op.regClass() == phi->definitions[0].regClass()) {
|
||||||
|
temp_to_phi_ressources[op.tempId()] = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* create affinities */
|
/* create affinities */
|
||||||
for (std::vector<Temp>& vec : phi_ressources) {
|
for (std::vector<Temp>& vec : phi_ressources) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue