[Mlir-commits] [mlir] Fix unsupported transpose ops for scalable vectors in LowerVectorTransfer (PR #86163)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Mar 22 07:27:41 PDT 2024


================
@@ -201,12 +205,19 @@ struct TransferWritePermutationLowering
     // Generate new transfer_write operation.
     Value newVec = rewriter.create<vector::TransposeOp>(
         op.getLoc(), op.getVector(), indices);
+
+    auto vectorType = cast<VectorType>(newVec.getType());
+
+    if (vectorType.isScalable() && !*vectorType.getScalableDims().end()) {
----------------
banach-space wrote:

> Btw, for this check there's isLegalVectorType() 

Re-using that hook would make sense to me, but we can't call it `isLegalVectorType` (and, in general, we need to be careful when labeling vectors as "illegal"):
* vectors like `vector<[4]x4xi32>` are perfectly legal at the "abstract" Vector dialect level,
* only once we start lowering to LLVM (and/or SVE/SME), these types needs to be eliminated and it makes sense to consider them as "illegal".

For scalable vectors that have only 1 scalable dim, this code is correct . @cfRod, I suggest adding a comment that we are assuming that at most 1 dim is scalable. @MacDue , I can rename and move `isLegalVectorType` in a separate PR. WDYT?

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


More information about the Mlir-commits mailing list