[Mlir-commits] [mlir] [MLIR][XeGPU] Support leading unit dims in vector.multi_reduction in sg to wi pass (PR #188767)
Nishant Patel
llvmlistbot at llvm.org
Sat Mar 28 10:19:16 PDT 2026
================
@@ -461,6 +461,91 @@ gpu.func @vector_multi_reduction_dim0_distributed_dim1_reduction(%laneid: index)
gpu.return
}
+// CHECK-LABEL: gpu.func @vector_multi_reduction_3d_leading_unit_dim_lane_local
+// CHECK: %[[CST:.*]] = arith.constant dense<0.000000e+00> : vector<1x16x2xf32>
+// CHECK: %[[CST_0:.*]] = arith.constant dense<0.000000e+00> : vector<1x2xf32>
+// CHECK: %[[RED:.*]] = vector.multi_reduction <add>, %[[CST]], %[[CST_0]] [1] : vector<1x16x2xf32> to vector<1x2xf32>
+// CHECK: gpu.return
+gpu.func @vector_multi_reduction_3d_leading_unit_dim_lane_local() {
+ %src = arith.constant
+ {layout_result_0 = #xegpu.layout<lane_layout = [1, 1, 16], lane_data = [1, 1, 1]>}
+ dense<0.0> : vector<1x16x32xf32>
+ %acc = arith.constant
+ {layout_result_0 = #xegpu.slice<#xegpu.layout<lane_layout = [1, 1, 16], lane_data = [1, 1, 1]>, dims = [1]>}
+ dense<0.0> : vector<1x32xf32>
+ %1 = vector.multi_reduction <add>, %src, %acc
+ {
+ layout_result_0 = #xegpu.slice<#xegpu.layout<lane_layout = [1, 1, 16], lane_data = [1, 1, 1]>, dims = [1]>
+ }
+ [1] : vector<1x16x32xf32> to vector<1x32xf32>
+ gpu.return
+}
+
+// CHECK-LABEL: gpu.func @vector_multi_reduction_3d_leading_unit_dim_cross_lane
+// CHECK-DAG: %[[SRC:.*]] = arith.constant dense<0.000000e+00> : vector<1x1x2xf32>
+// CHECK-DAG: %[[ACC:.*]] = arith.constant dense<0.000000e+00> : vector<1x2xf32>
+// CHECK-DAG: %[[SLICE0:.*]] = vector.extract_strided_slice %[[SRC]]
+// CHECK-SAME: {offsets = [0, 0, 0], sizes = [1, 1, 1], strides = [1, 1, 1]}
+// CHECK-DAG: %[[FLAT0:.*]] = vector.shape_cast %[[SLICE0]] : vector<1x1x1xf32> to vector<1xf32>
----------------
nbpatel wrote:
added
https://github.com/llvm/llvm-project/pull/188767
More information about the Mlir-commits
mailing list