[Mlir-commits] [mlir] [mlir][bufferization] Add tensor-like and memref-like interfaces (PR #134220)
Andrei Golubev
llvmlistbot at llvm.org
Thu Apr 3 03:41:33 PDT 2025
andrey-golubev wrote:
> > So the flow is: users load the dialect
>
> Well we're talking about the builtin dialect, user never has to load it. Are you talking about something else here?
I mean loading bufferization dialect. I assume that if the users want to user bufferization infrastructure, they have to load bufferization dialect first? And this is when interface attachment happens (for builtins).
> > Indeed, as we cannot depend on bufferization in builtins, this is done via [external model](https://mlir.llvm.org/docs/Interfaces/#external-models-for-attribute-operation-and-type-interfaces).
>
> Right, but we should never have external interface with a [promise](https://mlir.llvm.org/docs/Interfaces/#external-models-for-attribute-operation-and-type-interfaces) in the first place. It is interestingly OK here though because the special combination of builtin types (always loaded) and the external interface being attached in the initialization of the pass. This makes it impossible to misuse the pass. There is still a concern that people using bufferization without reusing the pass as-is will hit silent issues here because the lack of promise won't trigger a failure if they don't attach the model (we should refactor the initialization to be reusable by other bufferization pass using the bufferization infra here I think).
I'm not sure I follow. Do you think there could be a case where we don't load the bufferization dialect but still use `--some-pass-X` that relies on it? Wouldn't this introduce other problems also (e.g. "bufferization Op A not found")?
Do you imply that I need to add `declarePromisedInterface<ExternalModel, RankedTensorType>(), ...` to some place *outside* of bufferization dialect? So that at least there's an LLVM error when we call a pass but bufferization is not loaded?
https://github.com/llvm/llvm-project/pull/134220
More information about the Mlir-commits
mailing list