[Mlir-commits] [mlir] [mlir][ABI] Fix scalable vector mapping in ABITypeMapper (PR #206617)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Jun 30 08:32:00 PDT 2026
================
@@ -70,12 +70,20 @@ const llvm::abi::Type *ABITypeMapper::mapVectorType(mlir::VectorType type) {
if (!elementTy)
return nullptr;
+ // ABI lowering cannot represent vectors with more than one scalable
+ // dimension (e.g. vector<[2]x[4]xf32>) since ElementCount only has a
+ // single scalable bit and would silently produce vscale*N instead of
+ // the correct vscale^2*N.
+ if (llvm::count(type.getScalableDims(), true) > 1)
+ return nullptr;
+
auto shape = type.getShape();
uint64_t totalElements = 1;
for (int64_t dim : shape)
totalElements *= dim;
- llvm::ElementCount ec = llvm::ElementCount::getFixed(totalElements);
+ bool isScalable = llvm::is_contained(type.getScalableDims(), true);
----------------
banach-space wrote:
https://github.com/llvm/llvm-project/blob/0b5c006208cf7b0fee3709f468152e7de81607ef/mlir/include/mlir/IR/BuiltinTypes.td?plain=1#L1547 ;-)
https://github.com/llvm/llvm-project/pull/206617
More information about the Mlir-commits
mailing list