This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Extend the promise interface mechanism
ClosedPublic

Authored by fmorac on Aug 21 2023, 3:10 PM.

Details

Summary

This patch pairs a promised interface with the object (Op/Attr/Type/Dialect) requesting the promise, ie:

declarePromisedInterface<MyAttr, MyInterface>();

Allowing to make fine grained promises. It also adds a mechanism to query if Op/Attr/Type has an specific promise returning true if the promise is there or if an implementation has been added. Finally it adds a couple of Attr|TypeConstraints that can be used in ODS to query if the promise or an implementation is there.

This patch tries to solve 2 issues:

  1. Different entities cannot use the same promise.
declarePromisedInterface<MyInterface>();
// Resolves a promise.
MyAttr1::attachInterface<MyInterface>(ctx);
// Doesn't resolves a promise, as the previous attachment removed the promise.
MyAttr2::attachInterface<MyInterface>(ctx);
  1. Is not possible to query if a promise has been declared.

Diff Detail

Event Timeline

fmorac created this revision.Aug 21 2023, 3:10 PM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
fmorac edited the summary of this revision. (Show Details)Aug 21 2023, 3:26 PM
fmorac added a reviewer: mehdi_amini.
fmorac published this revision for review.Aug 21 2023, 3:45 PM
fmorac edited the summary of this revision. (Show Details)
fmorac added a comment.Sep 4 2023, 1:51 PM

Ping for review.

mehdi_amini accepted this revision.Sep 4 2023, 10:56 PM
This revision is now accepted and ready to land.Sep 4 2023, 10:56 PM
This revision was automatically updated to reflect the committed changes.