[Mlir-commits] [mlir] [MLIR][docs] Mention declarePromisedInterface in Interfaces doc (PR #88689)
Frederik Harwath
llvmlistbot at llvm.org
Mon Apr 15 00:33:36 PDT 2024
https://github.com/frederik-h created https://github.com/llvm/llvm-project/pull/88689
None
>From 6994d7c96b2e345e83e300d2259679ac690f3043 Mon Sep 17 00:00:00 2001
From: Frederik Harwath <fharwath at amd.com>
Date: Mon, 15 Apr 2024 09:19:33 +0200
Subject: [PATCH] [MLIR][docs] Mention declarePromisedInterface in Interfaces
doc
---
mlir/docs/Interfaces.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
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
More information about the Mlir-commits
mailing list