[Mlir-commits] [mlir] [mlir][xegpu] Lower dynamic high-D nd load/store via base-pointer fold (PR #215711)

Jianhui Li llvmlistbot at llvm.org
Fri Aug 21 22:00:55 PDT 2026


================
@@ -288,6 +315,21 @@ class CreateNdDescToXeVMPattern
     payload =
         vector::InsertOp::create(rewriter, loc, basePitch, payload,
                                  static_cast<int>(NdTdescOffset::BasePitch));
+    // For a >2D descriptor, encode the leading (batch) dim element strides into
+    // the spare payload slots; the load/store/prefetch lowering folds the batch
+    // offsets into the base pointer with these, keeping the 2D-block surface at
+    // the innermost matrix. 2D descriptors leave these slots at 0.
+    if (rank > 2) {
+      if (rank - 2 > 3)
+        return rewriter.notifyMatchFailure(
+            op, "Batched nd descriptor supports at most 3 leading dims.");
+      for (int64_t d = 0; d < rank - 2; ++d) {
+        Value leadingStride = createOffset(mixedStrides, d);
----------------
Jianhui-Li wrote:

Add a check in the lowering to validate the assumption memrefRank == tileRank. 
Will do a check in the op verifier in a separate PR (since multiple inconsistent test allows memrefRank > tileRank) 

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


More information about the Mlir-commits mailing list