[Mlir-commits] [mlir] [mlir] Convert TensorType and BaseMemRefType to interfaces (PR #133053)
Andrei Golubev
llvmlistbot at llvm.org
Wed Mar 26 02:46:59 PDT 2025
andrey-golubev wrote:
> Nice cleanup! It always felt a bit odd that `class TensorType` and `class BaseMemRefType` were defined in C++ instead of Tablegen. We didn't have interface inheritance from the beginning, maybe that's the reason why it was designed like that.
Thank you! I believe you're right: interfaces appeared later and at that point memrefs and tensors were already fully functional. Same was done to ShapedTypeInterface - at some earlier point it was also a base class. Looking at,
```cpp
inline bool BaseMemRefType::classof(Type type) {
return llvm::isa<MemRefType, UnrankedMemRefType>(type);
}
inline bool TensorType::classof(Type type) {
return llvm::isa<RankedTensorType, UnrankedTensorType>(type);
}
```
kind of suggests both types ought to be interfaces.
https://github.com/llvm/llvm-project/pull/133053
More information about the Mlir-commits
mailing list