[Mlir-commits] [mlir] [mlir][linalg] Fix crashes in parser on linalg ops without operands (PR #97944)
Matthias Springer
llvmlistbot at llvm.org
Sun Jul 7 03:18:49 PDT 2024
================
@@ -455,6 +455,18 @@ func.func @map_input_output_shape_mismatch(
// -----
+func.func @map_no_operands(
+ %lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>)
+ -> tensor<64xf32> {
+ // This must not crash the parser.
+ linalg.map { arith.addf }
----------------
matthias-springer wrote:
Why is this op not rejected by the verifier? `linalg.map` has a region according to the TableGen file:
```
let regions = (region SizedRegion<1>:$mapper);
```
But your new implementation never calls `addBodyWithPayloadOp`, so no region is added to the op. Am I missing something?
```c++
if (payloadOpName.has_value()) {
if (!result.operands.empty())
addBodyWithPayloadOp(parser, result, payloadOpName.value(),
payloadOpAttrs,
ArrayRef(result.operands).drop_back());
}
```
https://github.com/llvm/llvm-project/pull/97944
More information about the Mlir-commits
mailing list