From a8e530766855db44d48e1126f049e098483df997 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 7 May 2026 16:33:49 +0200 Subject: [PATCH] asahi: fix fdiv lowering Fixes: d3adef31641 ("agx: defer nir_opt_idiv_const") --- src/asahi/compiler/agx_compile.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 8070e610700..e131bcf0721 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3619,8 +3619,6 @@ agx_preprocess_nir(nir_shader *nir) nir_metadata_control_flow, NULL); NIR_PASS(_, nir, agx_nir_lower_subgroups); NIR_PASS(_, nir, nir_lower_all_phis_to_scalar); - NIR_PASS(_, nir, nir_shader_alu_pass, agx_nir_lower_fdiv, - nir_metadata_control_flow, NULL); /* After lowering, run through the standard suite of NIR optimizations. We * will run through the loop later, once we have the shader key, but if we @@ -3638,6 +3636,11 @@ agx_preprocess_nir(nir_shader *nir) }; NIR_PASS(_, nir, nir_lower_idiv, &idiv_options); + + /* Has to run after nir_lower_idiv */ + NIR_PASS(_, nir, nir_shader_alu_pass, agx_nir_lower_fdiv, + nir_metadata_control_flow, NULL); + NIR_PASS(_, nir, nir_opt_deref); NIR_PASS(_, nir, nir_lower_vars_to_ssa);