From b03ee0a308385d5ef8130dd9c2b76a4ef439eaf7 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: (cherry picked from commit a714a19e1626464f73b8f76402d74c52c57d25f4) --- .pick_status.json | 2 +- src/amd/compiler/aco_insert_NOPs.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index c1f099aba20..8fef1f4028c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5044,7 +5044,7 @@ "description": "aco/gfx12: fix VALUReadSGPRHazard with carry-out", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "65f95ae74e9c0e30bd14bfca347caeedce486bba", "notes": null diff --git a/src/amd/compiler/aco_insert_NOPs.cpp b/src/amd/compiler/aco_insert_NOPs.cpp index a2142444110..a964a1928d6 100644 --- a/src/amd/compiler/aco_insert_NOPs.cpp +++ b/src/amd/compiler/aco_insert_NOPs.cpp @@ -1618,9 +1618,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()) {