nak: Implement nir_intrinsic_vote_ieq with OpMatch

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35778>
This commit is contained in:
Mel Henning
2025-06-26 16:47:23 -04:00
committed by Marge Bot
parent 10acb44c64
commit 694523e2b9
3 changed files with 32 additions and 13 deletions
+4
View File
@@ -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;
}
+27 -12
View File
@@ -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 => {
+1 -1
View File
@@ -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,