diff options
author | Rhys Perry <[email protected]> | 2019-04-24 10:25:25 +0100 |
---|---|---|
committer | Daniel Schürmann <[email protected]> | 2019-08-20 17:40:10 +0200 |
commit | 7b07034931440e87f8ba0475354bb66a30d2ccde (patch) | |
tree | 204ae958d7d084a7297802959842277569ef4af5 /src/compiler | |
parent | 911a1dfad25feb32e7030b54abd0c69e415f9cc7 (diff) |
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: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_lower_subgroups.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c index 1e2e3f0eebf..249d5e446bd 100644 --- a/src/compiler/nir/nir_lower_subgroups.c +++ b/src/compiler/nir/nir_lower_subgroups.c @@ -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) |