[Mlir-commits] [mlir] [MLIR][XeGPU] Add lowering from transfer_read/transfer_write to load_gather/store_scatter (PR #152429)
Adam Siemieniuk
llvmlistbot at llvm.org
Thu Aug 14 02:04:05 PDT 2025
================
@@ -155,6 +153,284 @@ createNdDescriptor(PatternRewriter &rewriter, Location loc,
return ndDesc;
}
+// Adjusts the strides of a memref according to a given permutation map for
+// vector operations.
+//
+// This function updates the last `vecRank` elements of the `strides` array to
+// reflect the permutation specified by `permMap`. The permutation is applied
+// to the innermost dimensions of the memref, corresponding to the vector
+// shape. This is typically used when lowering vector transfer operations with
+// permutation maps to memory accesses, ensuring that the memory strides match
+// the logical permutation of vector dimensions.
+//
+// Example:
+// Suppose we have a memref of rank 4 with strides `[s0, s1, s2, s3]` and a
+// vector of rank 2. If the permutation map swaps the last two dimensions
+// (e.g., [0, 1] -> [1, 0]), then after calling this function, the last two
+// strides will be swapped:
+// Original strides: [s0, s1, s2, s3]
+// After permutation: [s0, s1, s3, s2]
+//
+static void adjustStridesForPermutation(Operation *op,
+ PatternRewriter &rewriter,
+ MemRefType memrefType,
+ AffineMap permMap, VectorType vecType,
+ SmallVectorImpl<Value> &strides) {
----------------
adam-smnk wrote:
A few unused arguments to be removed
https://github.com/llvm/llvm-project/pull/152429
More information about the Mlir-commits
mailing list