Mesa (master): aco: mark phi definitions as last-seen phi operands
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 13 13:22:06 UTC 2020
Module: Mesa
Branch: master
Commit: 138eed45b5362c61b27544d695130bab580c879d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=138eed45b5362c61b27544d695130bab580c879d
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Fri May 8 11:45:57 2020 +0100
aco: mark phi definitions as last-seen phi operands
Totals from 14340 (11.23% of 127638) affected shaders:
SGPRs: 1251648 -> 1251512 (-0.01%)
VGPRs: 994556 -> 994104 (-0.05%); split: -0.06%, +0.01%
CodeSize: 122894528 -> 121099604 (-1.46%); split: -1.49%, +0.03%
MaxWaves: 106039 -> 106103 (+0.06%); split: +0.06%, -0.00%
Instrs: 23860066 -> 23414317 (-1.87%); split: -1.90%, +0.03%
Copies: 2448228 -> 2049305 (-16.29%); split: -16.37%, +0.07%
Branches: 789381 -> 757921 (-3.99%); split: -4.62%, +0.64%
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 | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 318e29b9cf3..a0a4a4f444f 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -1410,9 +1410,10 @@ void register_allocation(Program *program, std::vector<TempSet>& live_out_per_bl
for (rit = block.instructions.rbegin(); rit != block.instructions.rend(); ++rit) {
aco_ptr<Instruction>& instr = *rit;
if (is_phi(instr)) {
- live.erase(instr->definitions[0].getTemp());
- if (instr->definitions[0].isKill() || instr->definitions[0].isFixed())
+ if (instr->definitions[0].isKill() || instr->definitions[0].isFixed()) {
+ live.erase(instr->definitions[0].getTemp());
continue;
+ }
/* collect information about affinity-related temporaries */
std::vector<Temp> affinity_related;
/* affinity_related[0] is the last seen affinity-related temp */
@@ -1425,23 +1426,22 @@ void register_allocation(Program *program, std::vector<TempSet>& live_out_per_bl
}
}
phi_ressources.emplace_back(std::move(affinity_related));
- continue;
- }
+ } else {
+ /* add vector affinities */
+ if (instr->opcode == aco_opcode::p_create_vector) {
+ for (const Operand& op : instr->operands) {
+ if (op.isTemp() && op.isFirstKill() && op.getTemp().type() == instr->definitions[0].getTemp().type())
+ ctx.vectors[op.tempId()] = instr.get();
+ }
+ }
- /* add vector affinities */
- if (instr->opcode == aco_opcode::p_create_vector) {
+ /* add operands to live variables */
for (const Operand& op : instr->operands) {
- if (op.isTemp() && op.isFirstKill() && op.getTemp().type() == instr->definitions[0].getTemp().type())
- ctx.vectors[op.tempId()] = instr.get();
+ if (op.isTemp())
+ live.emplace(op.getTemp());
}
}
- /* add operands to live variables */
- for (const Operand& op : instr->operands) {
- if (op.isTemp())
- live.emplace(op.getTemp());
- }
-
/* erase definitions from live */
for (unsigned i = 0; i < instr->definitions.size(); i++) {
const Definition& def = instr->definitions[i];
More information about the mesa-commit
mailing list