[Mlir-commits] [mlir] [mlir][vector] Fix TransferWriteNonPermutationLowering for scalable v… (PR #85632)
Benjamin Maxwell
llvmlistbot at llvm.org
Mon Mar 18 09:05:37 PDT 2024
================
@@ -41,8 +41,16 @@ static Value extendVectorRank(OpBuilder &builder, Location loc, Value vec,
SmallVector<int64_t> newShape(addedRank, 1);
newShape.append(originalVecType.getShape().begin(),
originalVecType.getShape().end());
- VectorType newVecType =
- VectorType::get(newShape, originalVecType.getElementType());
+
+ ArrayRef<bool> originalScalableDims = originalVecType.getScalableDims();
+ SmallVector<bool> tempScalableDims(originalVecType.getShape().size());
+ for (const auto &pos : llvm::enumerate(originalScalableDims)) {
+ tempScalableDims[pos.index()] = originalScalableDims[pos.index()];
+ }
+ SmallVector<bool> newScalableDims(addedRank, 0);
+ newScalableDims.append(tempScalableDims);
----------------
MacDue wrote:
Don't use `0` for `false`, and the copying to `tempScalableDims` is unnecessary:
```suggestion
SmallVector<bool> newScalableDims(addedRank, false);
newScalableDims.append(originalVecType.getScalableDims().begin(),
originalVecType.getScalableDims().end());
```
https://github.com/llvm/llvm-project/pull/85632
More information about the Mlir-commits
mailing list