Problem with memref return type

I was experimenting with a very simple matmul example, where I want to bufferize the linalg-based matmul function. So I run the following command:

mlir-opt --linalg-comprehensive-module-bufferize matmul.mlir

However, there is an error: “memref return type is unsupported”

I noticed that there is another option in the mlir-opt help information:
“allow-return-memref: Allows the return of memrefs (for testing purposes only)”

So I added this option, and ran the following command:

mlir-opt --linalg-comprehensive-module-bufferize --allow-return-memref test.mlir

But mlir-opt complained:
mlir-opt: Unknown command line argument ‘–allow-return-memref’.

The “allow-return-memref” option is listed in the help information, why is it “unknown”?

The allow-return-memref is a pass option. You need to use it as follows

mlir-opt --linalg-comprehensive-module-bufferize=allow-return-memref matmul.mlir
1 Like

It works, thank you so much!