From 73a46e084dea2920e3ae883e20a379b35b6544fb Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Thu, 8 Feb 2024 22:30:38 +0100 Subject: [PATCH] aco: don't remove branches that skip v_writelane_b32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: mesa-stable Reviewed-by: Daniel Schürmann Part-of: (cherry picked from commit cd6d9c5918feabe18a58f6b1096a55c1970d0883) --- .pick_status.json | 2 +- src/amd/compiler/aco_lower_to_hw_instr.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index f1ab9491ea4..410e87b2537 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2114,7 +2114,7 @@ "description": "aco: don't remove branches that skip v_writelane_b32", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/compiler/aco_lower_to_hw_instr.cpp b/src/amd/compiler/aco_lower_to_hw_instr.cpp index 657aa1a2f77..ce39719896f 100644 --- a/src/amd/compiler/aco_lower_to_hw_instr.cpp +++ b/src/amd/compiler/aco_lower_to_hw_instr.cpp @@ -2922,6 +2922,11 @@ lower_to_hw_instr(Program* program) } else if (inst->isSALU()) { num_scalar++; } else if (inst->isVALU() || inst->isVINTRP()) { + if (instr->opcode == aco_opcode::v_writelane_b32 || + instr->opcode == aco_opcode::v_writelane_b32_e64) { + /* writelane ignores exec, writing inactive lanes results in UB. */ + can_remove = false; + } num_vector++; /* VALU which writes SGPRs are always executed on GFX10+ */ if (ctx.program->gfx_level >= GFX10) {