[Mlir-commits] [mlir] [mlir][xegpu] Add initial skeleton implementation for lowering ConvertLayoutOp (PR #146176)

Chao Chen llvmlistbot at llvm.org
Thu Jul 17 08:02:02 PDT 2025


================
@@ -78,6 +78,20 @@ resolveUnrealizedConversionCastOp(UnrealizedConversionCastOp castOp) {
   }
 }
 
+struct ConvertLayoutOpPattern
+    : public OpRewritePattern<xegpu::ConvertLayoutOp> {
+  using OpRewritePattern::OpRewritePattern;
+  LogicalResult matchAndRewrite(xegpu::ConvertLayoutOp op,
+                                PatternRewriter &rewriter) const override {
+    xegpu::LayoutAttr input_layout = op.getInputLayoutAttr().dropInstData();
+    xegpu::LayoutAttr target_layout = op.getTargetLayoutAttr().dropInstData();
----------------
chencha3 wrote:

UnrollPatterns always use ExtractStridedSliceOp to unroll the values and use InsertStrideSliceOp at the end to reconstruct the vector with original shape. So, the input and output value of the covertLayoutOp is always with original vector type.

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


More information about the Mlir-commits mailing list