[Mlir-commits] [mlir] [mlir][gpu] Add 'cluster_stride' attribute to gpu.subgroup_reduce (PR #107142)
Jakub Kuderski
llvmlistbot at llvm.org
Tue Sep 3 14:16:08 PDT 2024
================
@@ -335,15 +335,31 @@ func.func @reduce_invalid_op_type_maximumf(%arg0 : i32) {
func.func @subgroup_reduce_zero_cluster_size(%arg0 : vector<4xf32>) {
// expected-error at +1 {{cluster size 0 is not a power of two}}
- %res = gpu.subgroup_reduce add %arg0 cluster_size(0) : (vector<4xf32>) -> vector<4xf32>
+ %res = gpu.subgroup_reduce add %arg0 cluster(size = 0) : (vector<4xf32>) -> vector<4xf32>
return
}
// -----
func.func @subgroup_reduce_npot_cluster_size(%arg0 : vector<4xf32>) {
// expected-error at +1 {{cluster size 3 is not a power of two}}
- %res = gpu.subgroup_reduce add %arg0 cluster_size(3) : (vector<4xf32>) -> vector<4xf32>
+ %res = gpu.subgroup_reduce add %arg0 cluster(size = 3) : (vector<4xf32>) -> vector<4xf32>
+ return
+}
+
+// -----
+
+func.func @subgroup_reduce_zero_cluster_stride(%arg0 : vector<4xf32>) {
+ // expected-error at +1 {{cluster stride 0 is not a power of two}}
+ %res = gpu.subgroup_reduce add %arg0 cluster(size = 4, stride = 0) : (vector<4xf32>) -> vector<4xf32>
+ return
+}
+
+// -----
+
+func.func @subgroup_reduce_npot_cluster_stride(%arg0 : vector<4xf32>) {
+ // expected-error at +1 {{cluster stride 3 is not a power of two}}
+ %res = gpu.subgroup_reduce add %arg0 { cluster_stride = 3 : i32 } : (vector<4xf32>) -> vector<4xf32>
----------------
kuhar wrote:
Can we have a verifier check that disallows cluster stride without size being set and check for it instead?
https://github.com/llvm/llvm-project/pull/107142
More information about the Mlir-commits
mailing list