[Mlir-commits] [mlir] [MLIR][Vector]Generalize DropUnitDimFromElementwiseOps (PR #92934)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon May 27 03:03:11 PDT 2024
================
@@ -1607,7 +1607,23 @@ struct ChainedReduction final : OpRewritePattern<vector::ReductionOp> {
}
};
-/// For vectors with either leading or trailing unit dim, replaces:
+FailureOr<VectorType> dropNonScalableUnitDimType(VectorType VT) {
+ int removed = 0;
+ auto shape = VT.getShape();
+ auto builder = VectorType::Builder(VT);
+ for (unsigned i = 0; i < shape.size(); i++) {
+ if (shape[i] == 1 && !VT.getScalableDims()[i]) {
+ builder.dropDim(i - removed);
+ removed++;
+ }
+ }
----------------
banach-space wrote:
Please use more descriptive var names:
* `removed` what? (suggestion: `numUnitDimsDropped`)
* `shape` of what? (suggestion: `inVecShape`)
* What kind of `builder`? `builder` taken from where? (suggestion: `newVecBuilder`)
https://github.com/llvm/llvm-project/pull/92934
More information about the Mlir-commits
mailing list