[Mlir-commits] [mlir] [mlir][XeGPU] add WgToSg distribution pattern for load_matrix and store_matrix. (PR #154403)

Charitha Saumya llvmlistbot at llvm.org
Wed Aug 20 09:59:27 PDT 2025


================
@@ -884,6 +913,70 @@ struct WgToSgArithConstantOp : public OpConversionPattern<arith::ConstantOp> {
   }
 };
 
+struct WgToSgLoadMatrixOp : public OpConversionPattern<xegpu::LoadMatrixOp> {
+  using OpConversionPattern<xegpu::LoadMatrixOp>::OpConversionPattern;
+  LogicalResult
+  matchAndRewrite(xegpu::LoadMatrixOp op, OneToNOpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    Location loc = op.getLoc();
+    VectorType valueTy = op.getRes().getType();
+    ArrayRef<int64_t> wgShape = valueTy.getShape();
+    Type elemTy = valueTy.getElementType();
+
+    // the call back function for creating new LoadMatrixOps,
+    // the baseOffsets is the origial offsets of the op, and
+    // descOffsets is the relative offsets to the mem_desc accessed
+    // by each subgroup op.
+    auto callback = [&](ArrayRef<OpFoldResult> baseOffsets,
----------------
charithaintc wrote:

same as above. could use a better name. 

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


More information about the Mlir-commits mailing list