[Mlir-commits] [mlir] [mlir][XeGPU] Fix matrix op lowering for a payload that is not contiguous (PR #228638)
Artem Kroviakov
llvmlistbot at llvm.org
Mon Oct 5 02:41:39 PDT 2026
================
@@ -920,11 +907,156 @@ class CreateMemDescOpPattern final
}
};
+/// Returns the shape of the largest piece of a matrix op payload that one LLVM
+/// access can move, as an access only moves consecutive elements. Memory runs
+/// along the dimension whose stride is 1, so on a row-major tile a [1, 4]
+/// payload is four neighbours and moves in one access, while [2, 1] is two
+/// elements a row apart and needs one access each.
+static SmallVector<int64_t>
+getContiguousPayloadShape(ArrayRef<int64_t> payloadShape, size_t numOffsets,
+ xegpu::MemDescType mdescTy) {
+ SmallVector<int64_t> shape(payloadShape);
+ int64_t rank = shape.size();
+ if (rank != static_cast<int64_t>(numOffsets))
+ return shape;
+
+ int64_t fastestDim = 0;
+ for (auto [dim, strideAttr] :
+ llvm::enumerate(mdescTy.getStrideAttr().getValue())) {
+ if (cast<IntegerAttr>(strideAttr).getInt() == 1) {
+ fastestDim = dim;
+ break;
+ }
+ }
+
+ bool spansFastestDim =
----------------
akroviakov wrote:
Does this utility assume a row-major walk order?
https://github.com/llvm/llvm-project/pull/228638
More information about the Mlir-commits
mailing list