From a714a19e1626464f73b8f76402d74c52c57d25f4 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 6 Jun 2025 17:45:48 +0100 Subject: [PATCH] aco/gfx12: fix VALUReadSGPRHazard with carry-out fossil-db (gfx1201): Totals from 370 (0.46% of 79653) affected shaders: Instrs: 3933639 -> 3935914 (+0.06%) CodeSize: 20743448 -> 20752068 (+0.04%); split: -0.00%, +0.04% Latency: 26261246 -> 26261921 (+0.00%); split: -0.00%, +0.00% InvThroughput: 5363675 -> 5363760 (+0.00%); split: -0.00%, +0.00% Signed-off-by: Rhys Perry Fixes: 65f95ae74e9c ("aco/insert_NOPs: implement VALU -> VALU case for VALUReadSGPRHazard on GFX12") Reviewed-by: Georg Lehmann Part-of: --- src/amd/compiler/aco_insert_NOPs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_insert_NOPs.cpp b/src/amd/compiler/aco_insert_NOPs.cpp index 33aface7a8e..a7116b20259 100644 --- a/src/amd/compiler/aco_insert_NOPs.cpp +++ b/src/amd/compiler/aco_insert_NOPs.cpp @@ -1606,9 +1606,9 @@ handle_instruction_gfx11(State& state, NOP_ctx_gfx11& ctx, aco_ptr& } if (instr->isVALU() && !instr->definitions.empty()) { - PhysReg reg = instr->definitions[0].physReg(); + PhysReg reg = instr->definitions.back().physReg(); if (reg < m0 && ctx.sgpr_read_by_valu[reg / 2]) { - for (unsigned i = 0; i < instr->definitions[0].size(); i++) + for (unsigned i = 0; i < instr->definitions.back().size(); i++) ctx.sgpr_read_by_valu_then_wr_by_valu.set(reg + i); } } else if (instr->isSALU() && !instr->definitions.empty()) {