Skip to content
Snippets Groups Projects
Commit 7b070349 authored by Rhys Perry's avatar Rhys Perry Committed by Daniel Schürmann
Browse files

nir/subgroups: Lower clustered reductions with cluster_size >= subgroup_size into reductions


The behavior for reductions with cluster_size >= subgroup_size is implementation defined.

Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
parent 911a1dfa
No related branches found
No related tags found
No related merge requests found
......@@ -479,7 +479,18 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options)
return lower_subgroup_op_to_scalar(b, intrin, false);
break;
case nir_intrinsic_reduce:
case nir_intrinsic_reduce: {
nir_ssa_def *ret = NULL;
/* A cluster size greater than the subgroup size is implemention defined */
if (options->subgroup_size &&
nir_intrinsic_cluster_size(intrin) >= options->subgroup_size) {
nir_intrinsic_set_cluster_size(intrin, 0);
ret = NIR_LOWER_INSTR_PROGRESS;
}
if (options->lower_to_scalar && intrin->num_components > 1)
ret = lower_subgroup_op_to_scalar(b, intrin, false);
return ret;
}
case nir_intrinsic_inclusive_scan:
case nir_intrinsic_exclusive_scan:
if (options->lower_to_scalar && intrin->num_components > 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment