nir/lower_subgroups: use build_cluster_mask for quad mask

build_subgroup_quad_mask can now be written in terms of
build_cluster_mask.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31732>
This commit is contained in:
Job Noorman
2025-02-27 08:05:28 +01:00
committed by Marge Bot
parent 14bc2e2d39
commit 739ca77e66

View File

@@ -926,16 +926,6 @@ build_subgroup_gt_mask(nir_builder *b,
return build_ballot_imm_ishl(b, ~1ull, subgroup_idx, options);
}
static nir_def *
build_subgroup_quad_mask(nir_builder *b,
const nir_lower_subgroups_options *options)
{
nir_def *subgroup_idx = nir_load_subgroup_invocation(b);
nir_def *quad_first_idx = nir_iand_imm(b, subgroup_idx, ~0x3);
return build_ballot_imm_ishl(b, 0xf, quad_first_idx, options);
}
static nir_def *
build_quad_vote_any(nir_builder *b, nir_def *src,
const nir_lower_subgroups_options *options)
@@ -943,7 +933,7 @@ build_quad_vote_any(nir_builder *b, nir_def *src,
nir_def *ballot = nir_ballot(b, options->ballot_components,
options->ballot_bit_size,
src);
nir_def *mask = build_subgroup_quad_mask(b, options);
nir_def *mask = build_cluster_mask(b, 4, options);
return nir_ine_imm(b, nir_iand(b, ballot, mask), 0);
}