diff --git a/src/nouveau/compiler/nak/api.rs b/src/nouveau/compiler/nak/api.rs index 9b381ab0eb6..c2599f731c8 100644 --- a/src/nouveau/compiler/nak/api.rs +++ b/src/nouveau/compiler/nak/api.rs @@ -155,7 +155,11 @@ fn nir_options(dev: &nv_device_info) -> nir_shader_compiler_options { | nir_lower_ineg64 | nir_lower_shift64 | nir_lower_imul_2x32_64 + | nir_lower_vote_ieq64 | nir_lower_conv64); + if dev.sm < 70 { + op.lower_int64_options |= nir_lower_vote_ieq64; + } if dev.sm < 32 { op.lower_int64_options |= nir_lower_shift64; } diff --git a/src/nouveau/compiler/nak/from_nir.rs b/src/nouveau/compiler/nak/from_nir.rs index 850585f9ecb..ef3523081e4 100644 --- a/src/nouveau/compiler/nak/from_nir.rs +++ b/src/nouveau/compiler/nak/from_nir.rs @@ -3689,23 +3689,38 @@ impl<'a> ShaderFromNir<'a> { nir_intrinsic_vote_all | nir_intrinsic_vote_any | nir_intrinsic_vote_ieq => { - assert!(srcs[0].bit_size() == 1); let src = self.get_src(&srcs[0]); + let src_bits = srcs[0].bit_size() * srcs[0].num_components(); assert!(intrin.def.bit_size() == 1); let dst = b.alloc_ssa(RegFile::Pred); - b.push_op(OpVote { - op: match intrin.intrinsic { - nir_intrinsic_vote_all => VoteOp::All, - nir_intrinsic_vote_any => VoteOp::Any, - nir_intrinsic_vote_ieq => VoteOp::Eq, - _ => panic!("Unknown vote intrinsic"), - }, - ballot: Dst::None, - vote: dst.into(), - pred: src, - }); + if src_bits == 1 { + b.push_op(OpVote { + op: match intrin.intrinsic { + nir_intrinsic_vote_all => VoteOp::All, + nir_intrinsic_vote_any => VoteOp::Any, + nir_intrinsic_vote_ieq => VoteOp::Eq, + _ => panic!("Unknown vote intrinsic"), + }, + ballot: Dst::None, + vote: dst.into(), + pred: src, + }); + } else { + assert_eq!(intrin.intrinsic, nir_intrinsic_vote_ieq); + b.push_op(OpMatch { + op: MatchOp::All, + mask: Dst::None, + pred: dst.into(), + src, + u64: match src_bits { + 32 => false, + 64 => true, + _ => panic!("Unsupported vote_ieq bit size"), + }, + }); + } self.set_dst(&intrin.def, dst.into()); } nir_intrinsic_is_sparse_texels_resident => { diff --git a/src/nouveau/compiler/nak_nir.c b/src/nouveau/compiler/nak_nir.c index 63020addf92..74eb90e0c78 100644 --- a/src/nouveau/compiler/nak_nir.c +++ b/src/nouveau/compiler/nak_nir.c @@ -949,7 +949,7 @@ nak_postprocess_nir(nir_shader *nir, .ballot_components = 1, .lower_to_scalar = true, .lower_vote_feq = true, - .lower_vote_ieq = true, + .lower_vote_ieq = nak->sm < 70, .lower_first_invocation_to_ballot = true, .lower_read_first_invocation = true, .lower_elect = true,