[Mlir-commits] [mlir] [MLIR][XeGPU] Decompose unsupported 'vector.transfer_read'-transpose-permutations (PR #182875)
Jianhui Li
llvmlistbot at llvm.org
Wed Mar 4 22:12:56 PST 2026
================
@@ -577,39 +578,64 @@ struct TransferReadLowering : public OpRewritePattern<vector::TransferReadOp> {
AffineMap readMap = readOp.getPermutationMap();
bool isTransposeLoad = !readMap.isMinorIdentity();
- Type elementType = vecTy.getElementType();
+ Type elementType = loadedVecTy.getElementType();
unsigned minTransposeBitWidth = 32;
- if (isTransposeLoad &&
- elementType.getIntOrFloatBitWidth() < minTransposeBitWidth)
- return rewriter.notifyMatchFailure(
- readOp, "Unsupported data type for transposition");
-
- // If load is transposed, get the base shape for the tensor descriptor.
- SmallVector<int64_t> descShape(vecTy.getShape());
- if (isTransposeLoad)
- std::reverse(descShape.begin(), descShape.end());
+ // Here we separate two transpose cases:
+ // 1. With transpose attribute in xegpu.load_nd for larger element types
+ // 2. With separate vector.transpose after load_nd for smaller element types
+ bool shouldUseTransposeAttr =
+ isTransposeLoad &&
+ elementType.getIntOrFloatBitWidth() >= minTransposeBitWidth;
----------------
Jianhui-Li wrote:
It is not guaranteed that the xegpu.load_nd with trasnposeAttr at workgroup level works. Instead of using trasnposeAttr, this pass should use the canonical form: "xegpu.load_nd + transpose". But we can treat this as separate PR if you are not comfortable removing it in this PR.
https://github.com/llvm/llvm-project/pull/182875
More information about the Mlir-commits
mailing list