From 441d5aab08ea29f2bc7dafd76d1e778599640d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 14 Aug 2025 18:47:55 +0200 Subject: [PATCH] aco/ra: coalesce vector affinities with tied definitions Totals from 19310 (24.19% of 79839) affected shaders: (Navi48) MaxWaves: 564238 -> 564542 (+0.05%); split: +0.06%, -0.01% Instrs: 10856428 -> 10803360 (-0.49%); split: -0.53%, +0.04% CodeSize: 56405088 -> 56189384 (-0.38%); split: -0.41%, +0.02% VGPRs: 986120 -> 985952 (-0.02%); split: -0.50%, +0.48% Latency: 53956142 -> 53940850 (-0.03%); split: -0.11%, +0.09% InvThroughput: 8769260 -> 8735595 (-0.38%); split: -0.49%, +0.11% VClause: 237471 -> 237452 (-0.01%); split: -0.05%, +0.04% SClause: 225385 -> 225389 (+0.00%) Copies: 799792 -> 744150 (-6.96%); split: -7.25%, +0.30% Branches: 208574 -> 208572 (-0.00%); split: -0.00%, +0.00% VALU: 6116920 -> 6061448 (-0.91%); split: -0.95%, +0.04% SALU: 1442068 -> 1441990 (-0.01%); split: -0.01%, +0.00% VOPD: 1914 -> 1744 (-8.88%); split: +0.10%, -8.99% Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 3e488392d6d..bbb8429032b 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -3122,8 +3122,6 @@ get_affinities(ra_ctx& ctx) if (it != temp_to_phi_resources.end()) { /* mark last-seen phi operand */ phi_resources[it->second][0] = def.getTemp(); - } else if (!ctx.assignments[def.tempId()].precolor_affinity) { - continue; } /* try to coalesce affinities with parallelcopies */ @@ -3148,6 +3146,9 @@ get_affinities(ra_ctx& ctx) phi_resources[it->second].emplace_back(op.getTemp()); temp_to_phi_resources[op.tempId()] = it->second; } + auto vec_it = ctx.vectors.find(def.tempId()); + if (vec_it != ctx.vectors.end()) + ctx.vectors[op.tempId()] = vec_it->second; } } }