summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_subgroups.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-29 20:09:58 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commit82d493a939e9485311f002f65bdc98cddcb44ce8 (patch)
tree36c251e3b10bb67c62961f9b07a276a47895834d /src/compiler/nir/nir_lower_subgroups.c
parentb3a5b0f3fcac3ff722ea2727302aa6f53463d50a (diff)
nir: Add subgroup arithmetic reduction intrinsics
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_subgroups.c')
-rw-r--r--src/compiler/nir/nir_lower_subgroups.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c
index 1ada6354af3..f18ad00c370 100644
--- a/src/compiler/nir/nir_lower_subgroups.c
+++ b/src/compiler/nir/nir_lower_subgroups.c
@@ -104,6 +104,9 @@ lower_subgroup_op_to_scalar(nir_builder *b, nir_intrinsic_instr *intrin)
nir_src_copy(&chan_intrin->src[1], &intrin->src[1], chan_intrin);
}
+ chan_intrin->const_index[0] = intrin->const_index[0];
+ chan_intrin->const_index[1] = intrin->const_index[1];
+
nir_builder_instr_insert(b, &chan_intrin->instr);
reads[i] = &chan_intrin->dest.ssa;
@@ -372,6 +375,13 @@ lower_subgroups_intrin(nir_builder *b, nir_intrinsic_instr *intrin,
return lower_subgroup_op_to_scalar(b, intrin);
break;
+ case nir_intrinsic_reduce:
+ case nir_intrinsic_inclusive_scan:
+ case nir_intrinsic_exclusive_scan:
+ if (options->lower_to_scalar && intrin->num_components > 1)
+ return lower_subgroup_op_to_scalar(b, intrin);
+ break;
+
default:
break;
}