[Mlir-commits] [mlir] [MLIR][XeGPU] Add support for elementwise ops in Wg to Sg distribute pass [1/N] (PR #142797)

Adam Siemieniuk llvmlistbot at llvm.org
Tue Jun 10 09:31:08 PDT 2025


================
@@ -314,6 +317,90 @@ struct WgToSgPrefetchNdOp : public OpConversionPattern<xegpu::PrefetchNdOp> {
   }
 };
 
+// This pattern transforms elementwise ops (unary/binary) in math/arith dialect
+template <typename Op>
+struct WgToSgElementwiseOp : public OpConversionPattern<Op> {
----------------
adam-smnk wrote:

Instead of templating, I'd suggest using `RewritePattern(MatchAnyOpTypeTag()` and filtering ops based on `OpTrait::hasElementwiseMappableTraits` and other properties like number of operands/results, their types etc.

https://github.com/llvm/llvm-project/pull/142797


More information about the Mlir-commits mailing list