From 93606a19c6808557e4e97e4e3b8677f4120bdc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 24 Jul 2025 11:59:32 +0200 Subject: [PATCH] aco/ra: collect register affinities for all precolored operands. Totals from 1280 (1.60% of 79839) affected shaders: (Navi48) Instrs: 817363 -> 812639 (-0.58%); split: -0.58%, +0.00% CodeSize: 4262644 -> 4243540 (-0.45%); split: -0.45%, +0.00% VGPRs: 61692 -> 61668 (-0.04%) Latency: 4354318 -> 4347818 (-0.15%); split: -0.15%, +0.00% InvThroughput: 711914 -> 707698 (-0.59%); split: -0.59%, +0.00% VClause: 14685 -> 14677 (-0.05%); split: -0.09%, +0.03% SClause: 25623 -> 25621 (-0.01%) Copies: 50663 -> 46242 (-8.73%); split: -8.73%, +0.00% VALU: 427744 -> 423323 (-1.03%); split: -1.03%, +0.00% Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 21937526096..d004f07dfa2 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -3091,8 +3091,6 @@ get_affinities(ra_ctx& ctx) if (!instr->definitions[1].isKill() && instr->operands[0].isTemp() && instr->operands[1].isFixed() && instr->operands[1].physReg() == exec) ctx.assignments[instr->operands[0].tempId()].set_precolor_affinity(vcc); - } else if (instr->opcode == aco_opcode::s_sendmsg) { - ctx.assignments[instr->operands[0].tempId()].set_precolor_affinity(m0); } else if (instr->format == Format::DS) { bool is_vector = false; for (unsigned i = 0, vector_begin = 0; i < instr->operands.size(); i++) { @@ -3103,6 +3101,12 @@ get_affinities(ra_ctx& ctx) } } + /* Collect register-affinities for precolored operands. */ + for (Operand op : instr->operands) { + if (op.isTemp() && op.isPrecolored()) + ctx.assignments[op.tempId()].set_precolor_affinity(op.physReg()); + } + auto tied_defs = get_tied_defs(instr.get()); for (unsigned i = 0; i < instr->definitions.size(); i++) { const Definition& def = instr->definitions[i];