[Mlir-commits] [mlir] [MLIR][Vector]Generalize DropUnitDimFromElementwiseOps (PR #92934)

Hugo Trachino llvmlistbot at llvm.org
Mon Jun 3 01:22:09 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())) {
----------------
nujaa wrote:

the vector and its ScalableDims attribute should always be of the same size by contruction. But, sure, updated.

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


More information about the Mlir-commits mailing list