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 <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34591>
This commit is contained in:
Mel Henning
2025-04-17 15:36:27 -04:00
committed by Marge Bot
parent c0dfdc907b
commit 7edb086685
+1
View File
@@ -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);
}