Mesa (master): aco: improve phi affinities with p_split_vector
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 13 13:22:06 UTC 2020
Module: Mesa
Branch: master
Commit: 7ce527a4fed1706aed9ced8e5d3432cc5abfbbd3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ce527a4fed1706aed9ced8e5d3432cc5abfbbd3
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Fri May 8 19:01:09 2020 +0100
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 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4990>
---
src/amd/compiler/aco_register_allocation.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 897a5bc50c7..a5c8ba784f4 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -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())
More information about the mesa-commit
mailing list