From ddeabcc19b022c1137ec41701dc819ef446fa717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Fri, 31 Mar 2023 22:10:05 +0200 Subject: [PATCH] ac/nir/ngg: Call nir_convert_to_lcssa before divergence analysis. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've recently learned that this is necessary to get correct results from divergence analysis. No Fossil DB stats changes on GFX10.3. Note, when backporting this patch to stable, make sure the call to nir_convert_to_lcssa is before nir_divergence_analysis, which may be located in a different place in the stable branch. Cc: mesa-stable Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/amd/common/ac_nir_lower_ngg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index e7e2a660f40..e4cb010b9e6 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -1103,6 +1103,8 @@ analyze_shader_before_culling_walk(nir_ssa_def *ssa, static void analyze_shader_before_culling(nir_shader *shader, lower_ngg_nogs_state *s) { + /* LCSSA is needed to get correct results from divergence analysis. */ + nir_convert_to_lcssa(shader, true, true); /* We need divergence info for culling shaders. */ nir_divergence_analysis(shader);