(forked from a discussion that started specific to python: Checking types between different python extensions - #33 by stellaraccident)
Mehdi did some great work in ⚙ D105903 Emit strong definition for TypeID storage in Op definition (WIP) to begin to give
TypeIDs a strong-linked home for Attributes, Types, Dialects and Operations, which has started to chip away at our long standing problems using MLIR in combination with dynamic linking (tl;dr - some people have no problems but it is really easy to break with symptoms of
TypeID mismatches across shared libraries).
However, there are still issues. See a recent dump here (ignore
IREE symbols - this just happened to be from that project). This is indicative that OpTraits, Interface ids and a handful of other things are still being emitted in the fragile way. This isn’t just academic: I was able to trivially reproduce TypeID mismatches on operator terminator detection in an MLIR-HLO build with
-DBUILD_SHARED_LIBS=ON linked to mlir-hlo-opt without anything special going on.
I know this kind of thing can be intimidating, but you don’t need to understand the mechanic in order to contribute fixes to any of the above. I think we should be shooting for a world where we remove the ability to have weak linked type ids from TypeID.h, and to do that, we need to eliminate some more of these classes of uses, following the template of the above patch. I can verify that strong linking, where we have done it solves the problems.