From 7edb08668590e5040faf669e1c700a2b51475a8a Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Thu, 17 Apr 2025 15:36:27 -0400 Subject: [PATCH] nak: Call nir_opt_phi_to_bool This opt seems to be somewhat sensitive to pass order - it really wants to run somewhere between nir_opt_loop and nir_opt_remove_phis. (radv, the only other backend that calls this pass, also matches that ordering). shader-db stats: Totals: CodeSize: 29166032 -> 29034608 (-0.45%); split: -0.46%, +0.01% Number of GPRs: 156968 -> 156969 (+0.00%) SLM Size: 147360 -> 147316 (-0.03%) Static cycle count: 9126931 -> 9158663 (+0.35%); split: -0.07%, +0.42% Spills to memory: 173573 -> 170288 (-1.89%) Fills from memory: 173573 -> 170288 (-1.89%) Spills to reg: 17838 -> 17111 (-4.08%); split: -4.09%, +0.01% Fills from reg: 13089 -> 13090 (+0.01%) Totals from 45 (0.69% of 6568) affected shaders: CodeSize: 8993312 -> 8861888 (-1.46%); split: -1.49%, +0.03% Number of GPRs: 4978 -> 4979 (+0.02%) SLM Size: 93596 -> 93552 (-0.05%) Static cycle count: 4703524 -> 4735256 (+0.67%); split: -0.14%, +0.81% Spills to memory: 107785 -> 104500 (-3.05%) Fills from memory: 107785 -> 104500 (-3.05%) Spills to reg: 5667 -> 4940 (-12.83%); split: -12.86%, +0.04% Fills from reg: 4131 -> 4132 (+0.02%) Reviewed-by: Faith Ekstrand Part-of: --- src/nouveau/compiler/nak_nir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nouveau/compiler/nak_nir.c b/src/nouveau/compiler/nak_nir.c index 6ff52683db3..88aed928b54 100644 --- a/src/nouveau/compiler/nak_nir.c +++ b/src/nouveau/compiler/nak_nir.c @@ -164,6 +164,7 @@ optimize_nir(nir_shader *nir, const struct nak_compiler *nak, bool allow_copies) OPT(nir, nir_opt_dce); } OPT(nir, nir_opt_if, nir_opt_if_optimize_phi_true_false); + OPT(nir, nir_opt_phi_to_bool); if (nir->options->max_unroll_iterations != 0) { OPT(nir, nir_opt_loop_unroll); }