From 6dbf8f7b906839bc9fdfd18f9590faafb9940c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 2 Sep 2025 11:19:40 +0200 Subject: [PATCH] aco/ra: don't set precolor affinities for already assigned temporaries Also don't overwrite existing precolor affinities. Totals from 248 (0.31% of 79839) affected shaders: (Navi48) Instrs: 154427 -> 154401 (-0.02%); split: -0.12%, +0.10% CodeSize: 812880 -> 812568 (-0.04%); split: -0.12%, +0.08% VGPRs: 12432 -> 12408 (-0.19%) Latency: 851623 -> 851801 (+0.02%); split: -0.03%, +0.05% InvThroughput: 156569 -> 156581 (+0.01%); split: -0.04%, +0.05% VClause: 2672 -> 2681 (+0.34%); split: -0.34%, +0.67% Copies: 12645 -> 12660 (+0.12%); split: -0.53%, +0.65% VALU: 82894 -> 82909 (+0.02%); split: -0.08%, +0.10% SALU: 25406 -> 25424 (+0.07%); split: -0.07%, +0.14% Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index cb1db265953..a4773ee8ee0 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -72,6 +72,9 @@ struct assignment { } void set_precolor_affinity(PhysReg affinity_reg) { + if (assigned || precolor_affinity) + return; + precolor_affinity = true; reg = affinity_reg; }