Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MLIR][docs] Mention declarePromisedInterface in Interfaces doc #88689

Merged

Conversation

frederik-h
Copy link
Contributor

No description provided.

@frederik-h frederik-h requested a review from joker-eph April 15, 2024 07:33
@llvmbot llvmbot added the mlir label Apr 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 15, 2024

@llvm/pr-subscribers-mlir

Author: Frederik Harwath (frederik-h)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/88689.diff

1 Files Affected:

  • (modified) mlir/docs/Interfaces.md (+13)
diff --git a/mlir/docs/Interfaces.md b/mlir/docs/Interfaces.md
index 536e7613e50936..4fb6f8a88bfa8d 100644
--- a/mlir/docs/Interfaces.md
+++ b/mlir/docs/Interfaces.md
@@ -299,6 +299,19 @@ owner of the dialect containing the object nor the owner of the interface are
 aware of an interface implementation, which can lead to duplicate or
 diverging implementations.
 
+Forgetting to register an external model can lead to bugs which are hard
+to track down. The `declarePromisedInterface` function can be used
+to declare that an external model implementation for an operation
+must eventually be provided.
+```
+  void MyDialect::initialize() {
+    declarePromisedInterface<SomeInterface, SomeOp>();
+     ...
+  }
+```
+Now attempting to use the interface, e.g in a cast, without a prior
+registration of the external model will lead to a runtime error.
+
 #### Dialect Fallback for OpInterface
 
 Some dialects have an open ecosystem and don't register all of the possible

@ftynse
Copy link
Member

ftynse commented Apr 15, 2024

Would be helpful to list what the message looks like so quick googling references to this page.

@frederik-h
Copy link
Contributor Author

Would be helpful to list what the message looks like so quick googling references to this page.

Thanks for the review. I have now added an example of the error message.

Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rewrap the doc to 80 columns though?

In general I use mdformat --wrap 80 for this.

frederik-h and others added 2 commits April 16, 2024 09:15
Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
* Wrap lines at 80 columns
* Move a part of the remark added by the last commit out of the code block
@frederik-h
Copy link
Contributor Author

Can you please rewrap the doc to 80 columns though?

In general I use mdformat --wrap 80 for this.

I have only rewrapped the new changes introduced by this PR since applying it to the whole document would introduce lots of unrelated changes, i.e. the rest of the document is not formatted in that way yet.

@frederik-h frederik-h merged commit ac1f2de into llvm:main Apr 16, 2024
3 of 4 checks passed
@frederik-h frederik-h deleted the mention-declarePromisedInterface-in-docs branch April 16, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants