[Mlir-commits] [mlir] [mlir][LLVM] Add operand bundle support (PR #108933)
Tobias Gysi
llvmlistbot at llvm.org
Mon Sep 23 09:56:28 PDT 2024
================
@@ -1285,14 +1400,53 @@ static ParseResult parseOptionalCallFuncPtr(
return success();
}
+static ParseResult resolveOpBundleOperands(
+ OpAsmParser &parser, SMLoc loc, OperationState &state,
+ ArrayRef<SmallVector<OpAsmParser::UnresolvedOperand>> opBundleOperands,
+ ArrayRef<SmallVector<Type>> opBundleOperandTypes,
+ StringAttr opBundleSizesAttrName) {
+ assert(opBundleOperands.size() == opBundleOperandTypes.size() &&
+ "operand bundle operand groups and type groups should match");
+
+ unsigned opBundleIndex = 0;
+ for (const auto &[operands, types] :
+ llvm::zip(opBundleOperands, opBundleOperandTypes)) {
+ if (operands.size() != types.size())
+ return parser.emitError(loc, "expected ")
+ << operands.size()
+ << " types for operand bundle operands for operand bundle #"
+ << opBundleIndex << ", but actually got " << types.size();
+ if (parser.resolveOperands(operands, types, loc, state.operands))
+ return failure();
+ }
+
+ SmallVector<int32_t> opBundleSizes;
+ opBundleSizes.reserve(opBundleOperands.size());
+ for (const auto &operands : opBundleOperands) {
+ opBundleSizes.push_back(operands.size());
+ }
----------------
gysit wrote:
```suggestion
for (const auto &operands : opBundleOperands)
opBundleSizes.push_back(operands.size());
```
nit:
https://github.com/llvm/llvm-project/pull/108933
More information about the Mlir-commits
mailing list