nir/divergence: ignore boolean phis for ignore_undef_if_phi_srcs

The only user of this option (ACO) doesn't support this for boolean phis.

fossil-db (navi21):
Totals from 1208 (1.51% of 79825) affected shaders:
Instrs: 826592 -> 823201 (-0.41%); split: -0.41%, +0.00%
CodeSize: 4228296 -> 4224280 (-0.09%); split: -0.11%, +0.01%
Latency: 3030803 -> 3028410 (-0.08%); split: -0.08%, +0.01%
InvThroughput: 578588 -> 578693 (+0.02%); split: -0.00%, +0.02%
VClause: 19500 -> 19494 (-0.03%)
Copies: 60914 -> 57589 (-5.46%); split: -5.47%, +0.01%
PreVGPRs: 50759 -> 50774 (+0.03%)
VALU: 528582 -> 528671 (+0.02%); split: -0.00%, +0.02%
SALU: 121134 -> 117646 (-2.88%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Backport-to: 25.1
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13455
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13509
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36005>
(cherry picked from commit 8fd5266b69)
This commit is contained in:
Rhys Perry 2025-07-16 14:49:32 +01:00 committed by Eric Engestrom
parent 5188b2d4b5
commit 4d30564f2b
2 changed files with 6 additions and 2 deletions

View file

@ -1784,7 +1784,7 @@
"description": "nir/divergence: ignore boolean phis for ignore_undef_if_phi_srcs",
"nominated": true,
"nomination_type": 4,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1371,7 +1371,11 @@ visit_if(nir_if *if_stmt, struct divergence_state *state)
phi->def.loop_invariant =
invariant && nir_foreach_src(&phi->instr, src_invariant, state->loop);
}
bool ignore_undef = state->options & nir_divergence_ignore_undef_if_phi_srcs;
/* The only user of this option (ACO) only supports it for non-boolean phis. */
bool ignore_undef =
(state->options & nir_divergence_ignore_undef_if_phi_srcs) && phi->def.bit_size != 1;
progress |= visit_if_merge_phi(phi, cond_divergent, ignore_undef);
}