[Mlir-commits] [mlir] [MLIR] Make `OneShotModuleBufferize` use `OpInterface` (PR #110322)

Ingo Müller llvmlistbot at llvm.org
Mon Oct 7 09:57:59 PDT 2024


ingomueller-net wrote:

This change breaks bufferization of ops that implement the `FunctionOpInterface` but have a terminator that doesn't implement the `ReturnOpInterface`, such as `transform.named_sequence` and `transform.yield`. For example, the following snippet now breaks:

```
// mlir-opt test.mlir -one-shot-bufferize="bufferize-function-boundaries=1"
module attributes {transform.with_named_sequence} {
  transform.named_sequence @__transform_main() {
    transform.yield 
  }
}
```

This produes the following error:

```
test.mlir:1:54: error: cannot bufferize a FuncOp with tensors and without a unique ReturnOp
module attributes {transform.with_named_sequence} {  "transform.named_sequence"() <{function_type = () -> (), sym_name = "__transform_main"}> ({
                                                     ^
test.mlir:1:54: note: see current operation: 
"transform.named_sequence"() <{function_type = () -> (), sym_name = "__transform_main"}> ({
  "transform.yield"() : () -> ()
}) : () -> ()
```

Also note that the error message still hardcodes `FuncOp`.

Finally, there might be other cases where people didn't expect their `FunctionOpInterfaces` to be bufferized and now be surprised but I guess that that's acceptable breakage, for which we get better genericity in return.

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


More information about the Mlir-commits mailing list