[Mlir-commits] [mlir] [MLIR][XeGPU][VectorToXeGPU] Add lowering from vector.gather/scatter to xegpu.load/store (PR #158024)

Dmitry Chigarev llvmlistbot at llvm.org
Thu Sep 11 03:09:46 PDT 2025


================
@@ -183,11 +198,15 @@ static void adjustStridesForPermutation(AffineMap permMap,
 // Computes memory strides for vector transfer operations, handling both
 // static and dynamic memrefs while applying permutation transformations
 // for XeGPU lowering.
-static SmallVector<Value> computeStrides(VectorTransferOpInterface xferOp,
+template <
+    typename OpType,
+    typename = std::enable_if_t<llvm::is_one_of<
+        std::decay_t<OpType>, vector::TransferReadOp, vector::TransferWriteOp,
+        vector::GatherOp, vector::ScatterOp>::value>>
+static SmallVector<Value> computeStrides(OpType xferOp,
----------------
dchigarev wrote:

Unfortunately there is no common interface for Transfer and Gather/Scatter ops, so was forced to do SFINAE here. I don't quite like this approach since this makes the definition bulky, but I don't like runtime checks via `isa<>` either. I'm open to change it to something else if reviewers would want to.

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


More information about the Mlir-commits mailing list