[Mlir-commits] [mlir] [MLIR][docs] Mention declarePromisedInterface in Interfaces doc (PR #88689)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Apr 15 00:34:06 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Frederik Harwath (frederik-h)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/88689.diff
1 Files Affected:
- (modified) mlir/docs/Interfaces.md (+13)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/88689
More information about the Mlir-commits
mailing list