From 92e609f4feaa7abbd8396d370ec4c244902c7914 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 26 Nov 2025 11:51:32 -0800 Subject: [PATCH] glsl: Move flrp lowering out of the loop Other lower_flrp Intel platforms had similar shader-db changes. Lunar Lake total instructions in shared programs: 17131619 -> 17131182 (<.01%) instructions in affected programs: 59924 -> 59487 (-0.73%) helped: 255 / HURT: 9 total loops in shared programs: 5336 -> 5334 (-0.04%) loops in affected programs: 4 -> 2 (-50.00%) helped: 2 / HURT: 0 total cycles in shared programs: 888274988 -> 888269628 (<.01%) cycles in affected programs: 1753370 -> 1748010 (-0.31%) helped: 182 / HURT: 94 Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/glsl/gl_nir_linker.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index d5ed4b10e44..35eb9c26c97 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -102,23 +102,6 @@ gl_nir_opts(nir_shader *nir) NIR_PASS(progress, nir, nir_opt_algebraic); NIR_PASS(progress, nir, nir_opt_constant_folding); - if (!nir->info.flrp_lowered) { - unsigned lower_flrp = - (nir->options->lower_flrp16 ? 16 : 0) | - (nir->options->lower_flrp32 ? 32 : 0) | - (nir->options->lower_flrp64 ? 64 : 0); - - if (lower_flrp) { - NIR_PASS(progress, nir, nir_lower_flrp, - lower_flrp, false /* always_precise */); - } - - /* Nothing should rematerialize any flrps, so we only need to do this - * lowering once. - */ - nir->info.flrp_lowered = true; - } - NIR_PASS(progress, nir, nir_opt_undef); peephole_select_options = (nir_opt_peephole_select_options){ @@ -133,6 +116,16 @@ gl_nir_opts(nir_shader *nir) } } while (progress); + unsigned lower_flrp = + (nir->options->lower_flrp16 ? 16 : 0) | + (nir->options->lower_flrp32 ? 32 : 0) | + (nir->options->lower_flrp64 ? 64 : 0); + + if (lower_flrp) { + NIR_PASS(progress, nir, nir_lower_flrp, + lower_flrp, false /* always_precise */); + } + NIR_PASS(_, nir, nir_lower_var_copies); }