[Mlir-commits] [mlir] [MLIR][XeGPU] Add support for elementwise ops in Wg to Sg distribute pass [1/N] (PR #142797)
Chao Chen
llvmlistbot at llvm.org
Fri Jun 13 12:07:49 PDT 2025
================
@@ -328,6 +331,63 @@ struct WgToSgPrefetchNdOp : public OpConversionPattern<xegpu::PrefetchNdOp> {
}
};
+// This pattern transforms elementwise ops in math/arith dialect
+struct WgToSgElementwiseOp : public ConversionPattern {
+ WgToSgElementwiseOp(MLIRContext *ctx)
+ : ConversionPattern(MatchAnyOpTypeTag(), /*benefit=*/1, ctx) {}
+
+ LogicalResult
+ matchAndRewrite(Operation *op, ArrayRef<ValueRange> operands,
+ ConversionPatternRewriter &rewriter) const override {
+ // Only match ops with elementwise trait
+ if (!OpTrait::hasElementwiseMappableTraits(op))
+ return rewriter.notifyMatchFailure(op, "Not an elementwise op");
+
----------------
chencha3 wrote:
worth to have check that the number of results is 1.
https://github.com/llvm/llvm-project/pull/142797
More information about the Mlir-commits
mailing list