[Mlir-commits] [mlir] [MLIR][XeGPU] Add support for vector.multi_reduction in wg to sg pass [1/N] (PR #157554)
Adam Siemieniuk
llvmlistbot at llvm.org
Tue Sep 16 02:25:36 PDT 2025
================
@@ -1027,6 +1027,62 @@ struct WgToSgVectorShapeCastOp
}
};
+// Pattern for lowering vector.multi_reduction op to subgroup level.
+struct WgToSgMultiDimReductionOp
+ : public OpConversionPattern<vector::MultiDimReductionOp> {
+ using OpConversionPattern<vector::MultiDimReductionOp>::OpConversionPattern;
+
+ LogicalResult
+ matchAndRewrite(vector::MultiDimReductionOp op, OneToNOpAdaptor adaptor,
+ ConversionPatternRewriter &rewriter) const override {
+ VectorType srcType = dyn_cast<VectorType>(op.getSource().getType());
+ VectorType dstType = dyn_cast<VectorType>(op.getResult().getType());
+ if (!srcType || !dstType)
----------------
adam-smnk wrote:
`src` should be guaranteed to be a vector. `dst` can be a scalar.
https://github.com/llvm/llvm-project/pull/157554
More information about the Mlir-commits
mailing list