nir: don't sink alu that uses ballot(true)
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Don't sink alu that uses ballot(true), as that can a local system value
and moving the alu then requires a new mov in the old location.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38829>
This commit is contained in:
Georg Lehmann 2025-11-29 18:29:41 +01:00 committed by Marge Bot
parent 96662cd459
commit 077b654cc7

View file

@ -100,6 +100,17 @@ can_sink_instr(nir_instr *instr, nir_move_options options, bool *can_mov_out_of_
} }
if (non_const >= 0) { if (non_const >= 0) {
nir_instr *parent = nir_def_instr(alu->src[non_const].src.ssa);
if (parent->type == nir_instr_type_intrinsic) {
/* Don't sink alu that uses ballot(true), as that can be a local system value
* and moving the alu then requires a mov in the old location.
*/
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(parent);
if (intrin->intrinsic == nir_intrinsic_ballot &&
nir_src_is_const(intrin->src[0]))
return false;
}
unsigned src_bits = nir_ssa_alu_instr_src_components(alu, non_const) * unsigned src_bits = nir_ssa_alu_instr_src_components(alu, non_const) *
alu->src[non_const].src.ssa->bit_size; alu->src[non_const].src.ssa->bit_size;
unsigned dest_bits = alu->def.num_components * alu->def.bit_size; unsigned dest_bits = alu->def.num_components * alu->def.bit_size;