[Mlir-commits] [mlir] [mlir] Explain required attrs for CallOpInterface in Toy (NFC) (PR #141018)
Joshua James Venter
llvmlistbot at llvm.org
Thu May 22 00:57:31 PDT 2025
https://github.com/jjvraw created https://github.com/llvm/llvm-project/pull/141018
Following #123176.
>From 5c8f341399969067f527ac64ac5018bc1f417273 Mon Sep 17 00:00:00 2001
From: Joshua James Venter <venter.joshua at gmail.com>
Date: Wed, 21 May 2025 23:38:14 +0200
Subject: [PATCH] [mlir][docs] Explain required attributes for CallOpInterface
in Toy tutorial (NFC)
Signed-off-by: Joshua James Venter <venter.joshua at gmail.com>
---
mlir/docs/Tutorials/Toy/Ch-4.md | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/mlir/docs/Tutorials/Toy/Ch-4.md b/mlir/docs/Tutorials/Toy/Ch-4.md
index 39e9ecdd92221..1275d36de3531 100644
--- a/mlir/docs/Tutorials/Toy/Ch-4.md
+++ b/mlir/docs/Tutorials/Toy/Ch-4.md
@@ -159,7 +159,20 @@ def GenericCallOp : Toy_Op<"generic_call",
In the above we also use the `DeclareOpInterfaceMethods` directive to
auto-declare all of the interface methods in the class declaration of
-GenericCallOp. We have already provided the definition in the `extraClassDeclaration`
+`GenericCallOp`. However, using this directive with `CallOpInterface`
+includes methods for handling argument and result attributes. Therefore,
+we need to add these specifically named attributes to our `GenericCallOp`
+definition:
+
+```tablegen
+let arguments = (ins
+ ...
+ OptionalAttr<DictArrayAttr>:$arg_attrs,
+ OptionalAttr<DictArrayAttr>:$res_attrs
+);
+
+
+We have already provided the definition in the `extraClassDeclaration`
field of the `FuncOp` class:
```c++
More information about the Mlir-commits
mailing list