[Mlir-commits] [mlir] [MLIR][Vector]Generalize DropUnitDimFromElementwiseOps (PR #92934)
Han-Chung Wang
llvmlistbot at llvm.org
Fri May 31 10:18:01 PDT 2024
================
@@ -1607,7 +1607,23 @@ struct ChainedReduction final : OpRewritePattern<vector::ReductionOp> {
}
};
-/// For vectors with either leading or trailing unit dim, replaces:
+VectorType dropNonScalableUnitDimType(VectorType inVecTy) {
+ auto newVecBuilder = VectorType::Builder(inVecTy);
+ auto inVecShape = inVecTy.getShape();
+ SmallVector<int64_t> newShape;
+ SmallVector<bool> newScalableDims;
+ for (auto [dim, isScalable] :
+ llvm::zip(inVecShape, inVecTy.getScalableDims())) {
----------------
hanhanW wrote:
nit: use zip_equal. The `zip_equal` version has an assertion, which is safer.
https://github.com/llvm/llvm-project/pull/92934
More information about the Mlir-commits
mailing list