From 2649717a36d7d790b1c01c343a7208eefc3d1bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 6 Feb 2024 22:05:56 +0100 Subject: [PATCH] aco: enable WQM if demote is used with maximal reconvergence If otherwise no helper lanes are required by the shader, then demote behaves like discard and immediately terminates the invocations. With maximal reconvergence, however, we need to ensure that helper lanes are not terminated unless the entire quad was demoted. In order to fix this, generally enable helper lanes in this unlikely corner case and avoid a major refactor. Reviewed-by: Georg Lehmann Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index eb790a5dc77..3adfb5b96af 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -8913,6 +8913,11 @@ visit_intrinsic(isel_context* ctx, nir_intrinsic_instr* instr) ctx->block->kind |= block_kind_uses_discard; ctx->program->needs_exact = true; + + /* Enable WQM in order to prevent helper lanes from getting terminated. */ + if (ctx->shader->info.maximally_reconverges) + ctx->program->needs_wqm = true; + break; } case nir_intrinsic_terminate: