This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix delayed object interfaces registration
ClosedPublic

Authored by vinograd47 on Aug 2 2021, 6:50 AM.

Details

Summary

Store both interfaceID and objectID as key for interface registration callback.
Otherwise the implementation allows to register only one external model per one object in the single dialect.

Diff Detail

Event Timeline

vinograd47 created this revision.Aug 2 2021, 6:50 AM
vinograd47 requested review of this revision.Aug 2 2021, 6:50 AM
ftynse accepted this revision.Aug 3 2021, 1:07 AM

I wouldn't call this a fix. Having the same class implement the interface for different objects actually sounds like a new functionality.

This revision is now accepted and ready to land.Aug 3 2021, 1:07 AM

I wouldn't call this a fix. Having the same class implement the interface for different objects actually sounds like a new functionality.

It's not the same class. In the test I've used template class TestExternalTestOpModel<ConcreteOp>, so for different objects we have different types. It might be different classes (for example, TestExternalTestOpModelForJ and TestExternalTestOpModelForH), it doesn't matter. But DialectRegistration uses base interface type ID as key, so it doesn't distinguish different model classes for the same interface.

vinograd47 added a comment.EditedAug 3 2021, 1:50 AM

Or in other words, current implementation doesn't allow to attach the same interface implementation to several objects from one dialect. And it doesn't matter if it is a single interface model for all objects or it is different model classes.

This revision was automatically updated to reflect the committed changes.