[Mlir-commits] [mlir] [mlir][bufferization] Add tensor-like and memref-like interfaces (PR #134220)

Matthias Springer llvmlistbot at llvm.org
Mon Apr 7 00:41:28 PDT 2025


matthias-springer wrote:

> AFAICS, one-shot-bufferize does not list the bufferization dialect as dependent, so there is no guarantee it is loaded when the pass runs. I'd find it worryingly inconsistent if built-in types wouldn't bufferize when another dialect is not loaded.

I just looked into this.

The bufferization dialect is a dependency of the pass:
```c++
  void getDependentDialects(DialectRegistry &registry) const override {
    registry
        .insert<bufferization::BufferizationDialect, memref::MemRefDialect>();
  }
```

The reason for this is that we are creating `bufferization.to_tensor` / `bufferization.to_memref` at the bufferization boundaries.

These two ops will also have to be updated to accept an arbitrary type. And improve the op verifiers to check that the operands/results implement the new type interfaces. (Actually, I'm not sure about the verifiers... Is it OK for ops to pass/fail verification depending on whether a type interface external model was loaded or not?) I would recommend to make the to_memref/to_tensor change in a separate, follow-up PR. (Or a PR that will be merged before this PR.) The assembly format will have to change and the diff will likely be quite large.


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


More information about the Mlir-commits mailing list