glsl: lower fp64 subgroup ops

This has to happen before lowering doubles, we can't do this in the backend.
Otherwise the backend's own vote_feq lower will result in an unlowered 64-bit
feq operation which it can't consume and can't lower. On GL drivers without
native fp64, this fixes tests like:

KHR-Single-GL46.subgroups.vote.graphics.subgroupallequal_double

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36649>
This commit is contained in:
Alyssa Rosenzweig
2025-08-07 13:54:11 -04:00
committed by Marge Bot
parent 8566a566e6
commit 61db1470a6
+14
View File
@@ -270,6 +270,20 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
bool revectorize = false;
if (nir->options->lower_doubles_options) {
/* 64-bit subgroup ops like vote_feq and inclusive_scan are secretly
* fp64 operations, so lower them first to make the ALU operation
* appear for nir_lower_doubles to lower after.
*/
nir_lower_subgroups_options subgroup_opts = {0};
subgroup_opts.subgroup_size = nir->options->subgroup_size;
subgroup_opts.ballot_bit_size = nir->options->ballot_bit_size;
subgroup_opts.ballot_components = nir->options->ballot_components;
subgroup_opts.lower_fp64 = true;
if (subgroup_opts.ballot_bit_size) {
NIR_PASS(lowered_64bit_ops, nir, nir_lower_subgroups, &subgroup_opts);
}
/* nir_lower_doubles is not prepared for vector ops, so if the backend doesn't
* request lower_alu_to_scalar until now, lower all 64 bit ops, and try to
* vectorize them afterwards again */