[Mlir-commits] [mlir] [MLIR][XeGPU] Matrix load/store subgroup distribution (PR #165008)

Charitha Saumya llvmlistbot at llvm.org
Mon Oct 27 13:34:19 PDT 2025


================
@@ -906,6 +907,123 @@ struct StoreDistribution final : public gpu::WarpDistributionPattern {
   }
 };
 
+template <class MatrixOp>
+struct MatrixOpDistribution final : public gpu::WarpDistributionPattern {
+  using gpu::WarpDistributionPattern::WarpDistributionPattern;
+  LogicalResult matchAndRewrite(gpu::WarpExecuteOnLane0Op warpOp,
+                                PatternRewriter &rewriter) const override {
+    gpu::YieldOp yield = warpOp.getTerminator();
+    Operation *lastNode = yield->getPrevNode();
+    auto matrixOp = dyn_cast_or_null<MatrixOp>(lastNode);
+    if (!matrixOp)
+      return failure();
+    constexpr bool isLoad{std::is_same_v<MatrixOp, xegpu::LoadMatrixOp>};
+    int operandIdx{-1};
+
+    VectorType sgPayloadTy;
+    VectorType warpResultTy;
+    if constexpr (isLoad) {
----------------
charithaintc wrote:

+1. I don't think we gain much by trying to unify them. LoadNd and StoreNd are also seperate patterns.

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


More information about the Mlir-commits mailing list