[Mlir-commits] [mlir] [mlir][linalg] Support `ParamType` in `vector_sizes` option of `VectorizeOp` transform (PR #87557)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri Apr 5 00:43:18 PDT 2024
================
@@ -3122,6 +3122,75 @@ transform::VectorizeChildrenAndApplyPatternsOp::applyToOne(
//===----------------------------------------------------------------------===//
// VectorizeOp
//===----------------------------------------------------------------------===//
+ParseResult transform::VectorizeOp::parse(OpAsmParser &parser,
+ OperationState &result) {
+ OpAsmParser::UnresolvedOperand target;
+ SmallVector<OpAsmParser::UnresolvedOperand> dynamicSizes;
+ DenseI64ArrayAttr staticSizes;
+ SmallVector<Type> operandTypes;
+ llvm::SMLoc operandLoc;
+ DenseBoolArrayAttr scalableVals;
+
+ if (parser.parseOperand(target) || parser.getCurrentLocation(&operandLoc))
+ return ParseResult::failure();
+
+ if (succeeded(parser.parseOptionalKeyword("vector_sizes"))) {
+ if (parseDynamicIndexList(parser, dynamicSizes, staticSizes, scalableVals))
+ return ParseResult::failure();
+ }
+
+ if (succeeded(parser.parseOptionalKeyword("vectorize_nd_extract")))
+ result.addAttribute(getVectorizeNdExtractAttrName(result.name),
+ parser.getBuilder().getUnitAttr());
+
+ if (parser.parseOptionalAttrDict(result.attributes) ||
+ parser.parseColonTypeList(operandTypes))
+ return ParseResult::failure();
+
+ if (operandTypes.size() != dynamicSizes.size() + 1) {
+ return parser.emitError(operandLoc)
+ << "expected " << dynamicSizes.size() + 1 << " operand type(s)";
+ }
+ if (parser.resolveOperand(target, operandTypes.front(), result.operands) ||
+ parser.resolveOperands(
+ dynamicSizes,
+ SmallVector<Type>(operandTypes.begin() + 1, operandTypes.end()),
----------------
ftynse wrote:
Nit: there is no need to construct (and allocate) a vector here. Something like `ArrayRef(operandTypes).drop_front()` or even `llvm::drop_begin(operandTypes)` should work here.
https://github.com/llvm/llvm-project/pull/87557
More information about the Mlir-commits
mailing list