[Mlir-commits] [mlir] Reimplementing target description concept using DLTI attribute (PR #92138)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed May 29 09:13:12 PDT 2024


ftynse wrote:

The original implementation may have gone a bit overboard with two things:
1. Having named methods on the `DataLayout` object doesn't scale very well to adding new kinds of queries.
2. Specialization to Module / builtin types is intrusive.

I don't have a good solution to 1., maybe experiment with more generic methods like `TargetInfo::getIntegerTargetInfoProperty(StringAttr/TypeID/int64_t identifier)` that are parameterized by, e.g., the name of the DLEntry being accessed. This won't necessarily work for queries that require some interpolation logic like integer bitwidth, but will work for discrete cases, which may end being more numerous.

The solution to 2. is to use delayed interface registration + promised interfaces, then drop the special-casing and always go through interfaces. I don't remember if we had that mechanism back when DLTI was introduced, but there was a concern about inefficiency of going through interfaces. The overhead is minor, and we shouldn't optimize prematurely.

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


More information about the Mlir-commits mailing list